# process the 'textDocument/hover' reply from the LSP server
# Result: Hover | null
-export def HoverReply(lspserver: dict<any>, hoverResult: any): void
+export def HoverReply(lspserver: dict<any>, hoverResult: any, cmdmods: string): void
var [hoverText, hoverKind] = GetHoverText(lspserver, hoverResult)
# Nothing to show
if hoverText->empty()
- util.WarnMsg($'No hover messages found for current position')
+ if cmdmods !~ 'silent'
+ util.WarnMsg($'No hover messages found for current position')
+ endif
return
endif
if opt.lspOptions.hoverInPreview
- :silent! pedit LspHoverReply
+ execute $':silent! {cmdmods} pedit LspHoverReply'
:wincmd P
:setlocal buftype=nofile
:setlocal bufhidden=delete
# Display the hover message from the LSP server for the current cursor
# location
-export def Hover()
+export def Hover(cmdmods: string)
var lspserver: dict<any> = buf.CurbufGetServer('hover')
if lspserver->empty() || !lspserver.running || !lspserver.ready
return
endif
- lspserver.hover()
+ lspserver.hover(cmdmods)
enddef
# show symbol references
# get the hover information
# Request: "textDocument/hover"
# Param: HoverParams
-def ShowHoverInfo(lspserver: dict<any>): void
+def ShowHoverInfo(lspserver: dict<any>, cmdmods: string): void
# Check whether LSP server supports getting hover information.
# caps->hoverProvider can be a "boolean" or "HoverOptions"
if !lspserver.isHoverProvider
# interface HoverParams
# interface TextDocumentPositionParams
var params = GetLspTextDocPosition(false)
- lspserver.rpc_a('textDocument/hover', params, hover.HoverReply)
+ lspserver.rpc_a('textDocument/hover', params, (_, reply) => {
+ hover.HoverReply(lspserver, reply, cmdmods)
+ })
enddef
# Request: "textDocument/references"
command! -nargs=0 -bar LspGotoTypeDef lsp.GotoTypedef(v:false, <q-mods>)
command! -nargs=0 -bar LspHighlight call LspDocHighlight()
command! -nargs=0 -bar LspHighlightClear call LspDocHighlightClear()
-command! -nargs=0 -bar LspHover lsp.Hover()
+command! -nargs=0 -bar LspHover lsp.Hover(<q-mods>)
command! -nargs=0 -bar LspIncomingCalls lsp.IncomingCalls()
command! -nargs=0 -bar LspOutgoingCalls lsp.OutgoingCalls()
command! -nargs=0 -bar LspOutline lsp.Outline()
cursor(7, 1)
output = execute(':LspHover')->split("\n")
assert_equal('No hover messages found for current position', output[0])
+ output = execute(':silent LspHover')->split("\n")
+ assert_equal([], output)
assert_equal([], popup_list())
# Show current diagnostic as to open another popup.