symbol.GotoSymbol(lspserver, location, req.method)
enddef
+# process the 'textDocument/switchSourceHeader' reply from the LSP server
+# Result: URI | null
+def ProcessSwitchHeaderReply(lspserver: dict<any>, req: dict<any>, reply: dict<any>): void
+ var fname = util.LspUriToFile(reply.result)
+ if (&modified && !&hidden) || &buftype != ''
+ # if the current buffer has unsaved changes and 'hidden' is not set,
+ # or if the current buffer is a special buffer, then ask to save changes
+ exe 'confirm edit ' .. fname
+ else
+ exe 'edit ' .. fname
+ endif
+enddef
+
# process the 'textDocument/signatureHelp' reply from the LSP server
# Result: SignatureHelp | null
def ProcessSignaturehelpReply(lspserver: dict<any>, req: dict<any>, reply: dict<any>): void
'textDocument/definition': ProcessDefDeclReply,
'textDocument/declaration': ProcessDefDeclReply,
'textDocument/typeDefinition': ProcessDefDeclReply,
+ 'textDocument/switchSourceHeader': ProcessSwitchHeaderReply,
'textDocument/implementation': ProcessDefDeclReply,
'textDocument/signatureHelp': ProcessSignaturehelpReply,
'textDocument/completion': ProcessCompletionReply,
lspserver.gotoDefinition(peek)
enddef
+# Switch source header using "textDocument/switchSourceHeader" LSP request
+export def SwitchSourceHeader()
+ var lspserver: dict<any> = CurbufGetServerChecked()
+ if lspserver->empty()
+ return
+ endif
+
+ lspserver.switchSourceHeader()
+enddef
+
# Go to a declaration using "textDocument/declaration" LSP request
export def GotoDeclaration(peek: bool)
var lspserver: dict<any> = CurbufGetServerChecked()
lspserver.waitForReponse(req)
enddef
+# Request: "textDocument/switchSourceHeader"
+# Param: TextDocumentIdentifier
+def SwitchSourceHeader(lspserver: dict<any>)
+ var req = lspserver.createRequest('textDocument/switchSourceHeader')
+ req.params->extend({uri: util.LspFileToUri(@%)})
+ lspserver.sendMessage(req)
+
+ lspserver.waitForReponse(req)
+enddef
+
# Request: "textDocument/declaration"
# Param: DeclarationParams
def GotoDeclaration(lspserver: dict<any>, peek: bool): void
sendInitializedNotif: function(SendInitializedNotif, [lspserver]),
getCompletion: function(GetCompletion, [lspserver]),
gotoDefinition: function(GotoDefinition, [lspserver]),
+ switchSourceHeader: function(SwitchSourceHeader, [lspserver]),
gotoDeclaration: function(GotoDeclaration, [lspserver]),
gotoTypeDef: function(GotoTypeDef, [lspserver]),
gotoImplementation: function(GotoImplementation, [lspserver]),
:LspPeekReferences Display the list of references to the keyword under
cursor in a location list associated with the preview
window.
+:LspSwitchSourceHeader Switch between source and header files.
:LspHighlight Highlight all the matches for the keyword under cursor
:LspHighlightClear Clear all the matches highlighted by :LspHighlight
:LspOutline Show the list of symbols defined in the current file
<
Default is false.
+ *:LspSwitchSourceHeader*
+:LspSwitchSourceHeader Switch between source and header files.
+
*:LspDiagShow*
:LspDiagShow Creates a new location list with the diagnostics
messages (if any) from the LSP server for the current
lspf.hover = lsp.Hover
lspf.selectionExpand = lsp.SelectionExpand
lspf.selectionShrink = lsp.SelectionShrink
+ lspf.switchSourceHeader = lsp.SwitchSourceHeader
lspf.foldDocument = lsp.FoldDocument
lspf.listWorkspaceFolders = lsp.ListWorkspaceFolders
lspf.addWorkspaceFolder = lsp.AddWorkspaceFolder
var Thover = lspf.hover
var TselectionExpand = lspf.selectionExpand
var TselectionShrink = lspf.selectionShrink
+var TswitchSourceHeader = lspf.switchSourceHeader
var TfoldDocument = lspf.foldDocument
var TlistWorkspaceFolders = lspf.listWorkspaceFolders
var TaddWorkspaceFolder = lspf.addWorkspaceFolder
command! -nargs=0 -bar LspDiagHighlightDisable call TdiagHighlightDisable()
command! -nargs=0 -bar LspShowReferences call TshowReferences(v:false)
command! -nargs=0 -bar LspPeekReferences call TshowReferences(v:true)
+command! -nargs=0 -bar LspSwitchSourceHeader call TswitchSourceHeader()
command! -nargs=0 -bar LspHighlight call LspDocHighlight()
command! -nargs=0 -bar LspHighlightClear call LspDocHighlightClear()
command! -nargs=0 -bar LspOutline call Toutline()