]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Set option for hover in preview with new lspOptions
authorIndelog <maxime@indelog.fr>
Tue, 16 Nov 2021 10:19:27 +0000 (11:19 +0100)
committerIndelog <maxime@indelog.fr>
Tue, 16 Nov 2021 10:19:27 +0000 (11:19 +0100)
autoload/handlers.vim
autoload/lspoptions.vim
doc/lsp.txt
plugin/lsp.vim

index 7a40de4a75e51c278e02200e4f7de7bacd3f3d2c..7a9126a92fe43e635ba259ef13debdd99d10ddcb 100644 (file)
@@ -330,7 +330,7 @@ def s:processHoverReply(lspserver: dict<any>, req: dict<any>, reply: dict<any>):
     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 @@ def s:processHoverReply(lspserver: dict<any>, req: dict<any>, reply: dict<any>):
       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'})
index ab7daa0b0ec8ae263d1892ef671e2ac689a150a6..6edd8b14d37be61cac5b2cb8ffab2bdc00c21540 100644 (file)
@@ -14,5 +14,7 @@ export var lspOptions: dict<any> = {
   # 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,
 }
index 9f80f656e0c0907e43461dac9b136206b3e40a35..1422d4e2f6df8809f1b01d99d145a5af326d3b66 100644 (file)
@@ -371,7 +371,8 @@ diagnostic messages, you can add the following line to your .vimrc file:
                        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
 
index 0f324c41c0ab62d7fbdea086be27c53c54628a00..8683e639089068d7879f39e45e49bb0d3b81f521 100644 (file)
@@ -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 *