mirror of
https://github.com/prabirshrestha/vim-lsp.git
synced 2025-12-14 20:35:59 +01:00
add new preview window id api (#1323)
* add new preview window id api resolves #1281 * add alias for getpreviewwinid() * add documentation
This commit is contained in:
@@ -1216,6 +1216,10 @@ function! lsp#get_progress() abort
|
|||||||
return lsp#internal#work_done_progress#get_progress()
|
return lsp#internal#work_done_progress#get_progress()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! lsp#document_hover_preview_winid() abort
|
||||||
|
return lsp#internal#document_hover#under_cursor#getpreviewwinid()
|
||||||
|
endfunction
|
||||||
|
|
||||||
"
|
"
|
||||||
" Scroll vim-lsp related windows.
|
" Scroll vim-lsp related windows.
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -74,6 +74,13 @@ function! lsp#internal#document_hover#under_cursor#do(options) abort
|
|||||||
\ )
|
\ )
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! lsp#internal#document_hover#under_cursor#getpreviewwinid() abort
|
||||||
|
if exists('s:doc_win')
|
||||||
|
return s:doc_win.get_winid()
|
||||||
|
endif
|
||||||
|
return v:null
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:show_hover(ui, server_name, request, response) abort
|
function! s:show_hover(ui, server_name, request, response) abort
|
||||||
if !has_key(a:response, 'result') || empty(a:response['result']) ||
|
if !has_key(a:response, 'result') || empty(a:response['result']) ||
|
||||||
\ empty(a:response['result']['contents'])
|
\ empty(a:response['result']['contents'])
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ CONTENTS *vim-lsp-contents*
|
|||||||
lsp#get_buffer_diagnostics_counts() |lsp#get_buffer_diagnostics_counts()|
|
lsp#get_buffer_diagnostics_counts() |lsp#get_buffer_diagnostics_counts()|
|
||||||
lsp#get_buffer_first_error_line() |lsp#get_buffer_first_error_line()|
|
lsp#get_buffer_first_error_line() |lsp#get_buffer_first_error_line()|
|
||||||
lsp#get_progress() |lsp#get_progress()|
|
lsp#get_progress() |lsp#get_progress()|
|
||||||
|
lsp#document_hover_preview_winid() |lsp#document_hover_preview_winid()|
|
||||||
Commands |vim-lsp-commands|
|
Commands |vim-lsp-commands|
|
||||||
LspAddTreeCallHierarchyIncoming |:LspAddTreeCallHierarchyIncoming|
|
LspAddTreeCallHierarchyIncoming |:LspAddTreeCallHierarchyIncoming|
|
||||||
LspCallHierarchyIncoming |:LspCallHierarchyIncoming|
|
LspCallHierarchyIncoming |:LspCallHierarchyIncoming|
|
||||||
@@ -324,7 +325,7 @@ g:lsp_preview_float *g:lsp_preview_float*
|
|||||||
<
|
<
|
||||||
After opening an autocmd User event lsp_float_opened is issued, as well as
|
After opening an autocmd User event lsp_float_opened is issued, as well as
|
||||||
and lsp_float_closed upon closing. This can be used to alter the preview
|
and lsp_float_closed upon closing. This can be used to alter the preview
|
||||||
window (using lsp#ui#vim#output#getpreviewwinid() to get the window id),
|
window (using |lsp#document_hover_preview_winid()| to get the window id),
|
||||||
setup custom bindings while a preview is open, or change the highlighting
|
setup custom bindings while a preview is open, or change the highlighting
|
||||||
of the window.
|
of the window.
|
||||||
|
|
||||||
@@ -342,12 +343,12 @@ g:lsp_preview_float *g:lsp_preview_float*
|
|||||||
autocmd!
|
autocmd!
|
||||||
if !has('nvim')
|
if !has('nvim')
|
||||||
autocmd User lsp_float_opened
|
autocmd User lsp_float_opened
|
||||||
\ call setwinvar(lsp#ui#vim#output#getpreviewwinid(),
|
\ call setwinvar(lsp#document_hover_preview_winid(),
|
||||||
\ '&wincolor', 'PopupWindow')
|
\ '&wincolor', 'PopupWindow')
|
||||||
else
|
else
|
||||||
autocmd User lsp_float_opened
|
autocmd User lsp_float_opened
|
||||||
\ call nvim_win_set_option(
|
\ call nvim_win_set_option(
|
||||||
\ lsp#ui#vim#output#getpreviewwinid(),
|
\ lsp#document_hover_preview_winid(),
|
||||||
\ 'winhighlight', 'Normal:PopupWindow')
|
\ 'winhighlight', 'Normal:PopupWindow')
|
||||||
endif
|
endif
|
||||||
augroup end
|
augroup end
|
||||||
@@ -1451,6 +1452,11 @@ lsp#get_progress() *lsp#get_progress()*
|
|||||||
Type: |Number|
|
Type: |Number|
|
||||||
0 - 100 or not exist
|
0 - 100 or not exist
|
||||||
|
|
||||||
|
lsp#document_hover_preview_winid() *lsp#document_hover_preview_winid()*
|
||||||
|
|
||||||
|
Returns |windowid| of the current hover preview window or |v:null| if it does not
|
||||||
|
exist.
|
||||||
|
|
||||||
lsp#scroll(count) *lsp#scroll()*
|
lsp#scroll(count) *lsp#scroll()*
|
||||||
|
|
||||||
Scroll current displayed floating/popup window with specified count.
|
Scroll current displayed floating/popup window with specified count.
|
||||||
|
|||||||
Reference in New Issue
Block a user