autoload/handlers.vim | 6 +++--- autoload/lspoptions.vim | 4 +++- doc/lsp.txt | 3 ++- plugin/lsp.vim | 15 --------------- diff --git a/autoload/handlers.vim b/autoload/handlers.vim index 7a40de4a75e51c278e02200e4f7de7bacd3f3d2c..7a9126a92fe43e635ba259ef13debdd99d10ddcb 100644 --- a/autoload/handlers.vim +++ b/autoload/handlers.vim @@ -330,7 +330,7 @@ else ErrMsg('Error: Unsupported hover contents (' .. reply.result.contents .. ')') return endif - if g:LSP_Hover_In_Preview + if lspOptions.hoverInPreview silent! pedit HoverReply wincmd P setlocal buftype=nofile @@ -338,9 +338,9 @@ setlocal bufhidden=delete if !reply.result.contents.kind->empty() exe 'setlocal ft=' .. reply.result.contents.kind endif - exe 'normal ggdG' + deletebufline(bufnr(), 1, getbufinfo(bufnr())[0].linecount) append(0, hoverText) - exe 'normal gg' + cursor(1, 1) wincmd p else hoverText->popup_atcursor({moved: 'word'}) diff --git a/autoload/lspoptions.vim b/autoload/lspoptions.vim index ab7daa0b0ec8ae263d1892ef671e2ac689a150a6..6edd8b14d37be61cac5b2cb8ffab2bdc00c21540 100644 --- a/autoload/lspoptions.vim +++ b/autoload/lspoptions.vim @@ -14,5 +14,7 @@ # In insert mode, echo the current symbol signature in the status line # instead of showing it in a popup echoSignature: false, # Automatically highlight diagnostics messages from LSP server - autoHighlightDiags: true + autoHighlightDiags: true, + # Show the symbol documentation in the preview window instead of in a popup + hoverInPreview: false, } diff --git a/doc/lsp.txt b/doc/lsp.txt index 9f80f656e0c0907e43461dac9b136206b3e40a35..1422d4e2f6df8809f1b01d99d145a5af326d3b66 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -371,7 +371,8 @@ :LspHover Show the documentation for the symbol under the cursor in a popup window. If you want to show the symbol documentation in the preview window instead of in a popup set > - let g:LSP_Hover_In_preview variable = v:true + + call lsp#setOptions({'hoverInPreview': v:true}) < Default is false diff --git a/plugin/lsp.vim b/plugin/lsp.vim index 0f324c41c0ab62d7fbdea086be27c53c54628a00..8683e639089068d7879f39e45e49bb0d3b81f521 100644 --- a/plugin/lsp.vim +++ b/plugin/lsp.vim @@ -5,21 +5,6 @@ if v:version < 802 || !has('patch-8.2.2342') finish endif - -" Perform completion in insert mode automatically. Otherwise use -" omni-complete. -if !exists('g:LSP_24x7_Complete') - let g:LSP_24x7_Complete = v:true -endif - -if !exists('g:LSP_Show_Signature') - let g:LSP_Show_Signature = v:true -endif - -if !exists('g:LSP_Hover_In_Preview') - let g:LSP_Hover_In_Preview = v:false -endif - augroup LSPAutoCmds au! autocmd BufNewFile,BufReadPost *