From 2412b17a45b0201007d2c0de6a253fd10ea8f3c2 Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Sat, 17 Jun 2023 10:50:20 -0700 Subject: [PATCH] Not able to use :LspHover with 'keywordprg' --- autoload/lsp/hover.vim | 7 +++++-- doc/lsp.txt | 6 +++++- plugin/lsp.vim | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/autoload/lsp/hover.vim b/autoload/lsp/hover.vim index 24ac702..d69b797 100644 --- a/autoload/lsp/hover.vim +++ b/autoload/lsp/hover.vim @@ -78,7 +78,7 @@ export def HoverReply(lspserver: dict, hoverResult: any, cmdmods: string): # Nothing to show if hoverText->empty() if cmdmods !~ 'silent' - util.WarnMsg($'No hover messages found for current position') + util.WarnMsg($'No documentation found for current keyword') endif return endif @@ -95,8 +95,11 @@ export def HoverReply(lspserver: dict, hoverResult: any, cmdmods: string): :wincmd p else popup_clear() - var winid = hoverText->popup_atcursor({moved: 'word', + var winid = hoverText->popup_atcursor({moved: 'any', + close: 'click', + fixed: true, maxwidth: 80, + minwidth: 80, border: [0, 1, 0, 1], borderchars: [' ']}) win_execute(winid, $'setlocal ft={hoverKind}') diff --git a/doc/lsp.txt b/doc/lsp.txt index 14b4cd9..bd774c4 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -770,8 +770,12 @@ can map these commands to keys and make it easier to invoke them. LspOptionsSet({'hoverInPreview': true}) < - Default is false. + You can use the |K| key in normal mode to display the + documentation for the keyword under the cursor by + setting the 'keywordprg' Vim option: > + :set keywordprg=:LspHover +< *:LspIncomingCalls* :LspIncomingCalls Display a hierarchy of symbols calling the symbol under the cursor in a window. See diff --git a/plugin/lsp.vim b/plugin/lsp.vim index 1dbc26d..cc9856e 100644 --- a/plugin/lsp.vim +++ b/plugin/lsp.vim @@ -75,7 +75,7 @@ command! -nargs=0 -bar -count LspGotoImpl lsp.GotoImplementation(v:false, , ) command! -nargs=0 -bar LspHighlight call LspDocHighlight() command! -nargs=0 -bar LspHighlightClear call LspDocHighlightClear() -command! -nargs=0 -bar LspHover lsp.Hover() +command! -nargs=? -bar LspHover lsp.Hover() command! -nargs=0 -bar LspIncomingCalls lsp.IncomingCalls() command! -nargs=0 -bar LspOutgoingCalls lsp.OutgoingCalls() command! -nargs=0 -bar -count LspOutline lsp.Outline(, ) -- 2.44.0