return
enddef
-# process the 'textDocument/switchSourceHeader' reply from the LSP server
-# Clangd specific extension
-# Result: URI | null
-def ProcessSwitchHeaderReply(lspserver: dict<any>, req: dict<any>, reply: dict<any>): void
- if reply.result->empty()
- return
- endif
- 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
{
'initialize': ProcessInitializeReply,
'shutdown': ProcessShutdownReply,
- 'textDocument/switchSourceHeader': ProcessSwitchHeaderReply,
'textDocument/signatureHelp': ProcessSignaturehelpReply,
'textDocument/completion': ProcessCompletionReply,
'textDocument/hover': ProcessHoverReply,
# Param: TextDocumentIdentifier
# Clangd specific extension
def SwitchSourceHeader(lspserver: dict<any>)
- var req = lspserver.createRequest('textDocument/switchSourceHeader')
- req.params->extend({uri: util.LspFileToUri(@%)})
- lspserver.sendMessage(req)
+ var param = {}
+ param.uri = util.LspFileToUri(@%)
+ var resp = lspserver.rpc('textDocument/switchSourceHeader', param)
+ if resp->empty() || resp.result->empty()
+ return
+ endif
- lspserver.waitForResponse(req)
+ # process the 'textDocument/switchSourceHeader' reply from the LSP server
+ # Result: URI | null
+ var fname = util.LspUriToFile(resp.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
# get symbol signature help.