ErrMsg('Error: Unsupported hover contents (' .. reply.result.contents .. ')')
return
endif
- hoverText->popup_atcursor({moved: 'word'})
+ if g:LSP_Hover_Reply_In_Preview
+ silent! pedit HoverReply
+ wincmd P
+ setlocal buftype=nofile
+ setlocal bufhidden=delete
+ if !reply.result.contents.kind->empty()
+ exe 'setlocal ft=' .. reply.result.contents.kind
+ endif
+ exe 'normal ggdG'
+ append(0, hoverText)
+ exe 'normal gg'
+ wincmd p
+ else
+ hoverText->popup_atcursor({moved: 'word'})
+ endif
enddef
# process the 'textDocument/references' reply from the LSP server
*:LspHover*
:LspHover Show the documentation for the symbol under the cursor
- in a popup window.
+ in a popup window. If you prefer show documentation in
+ a preview window rather a popup set
+ g:LSP_Hover_Reply_In_Preview = v:true .
*:LspSelectionRange*
:LspSelectionRange Visually select the current symbol range.
let g:LSP_Show_Signature = v:true
endif
+if !exists('g:LSP_Hover_Reply_In_Preview')
+ let g:LSP_Hover_Reply_In_Preview = v:false
+endif
+
augroup LSPAutoCmds
au!
autocmd BufNewFile,BufReadPost *