# process the 'textDocument/signatureHelp' reply from the LSP server
# Result: SignatureHelp | null
def s:processSignaturehelpReply(lspserver: dict<any>, req: dict<any>, reply: dict<any>): void
+ if reply.result->empty()
+ return
+ endif
+
var result: dict<any> = reply.result
if result.signatures->len() <= 0
WarnMsg('No signature help available')
# process the 'textDocument/completion' reply from the LSP server
# Result: CompletionItem[] | CompletionList | null
def s:processCompletionReply(lspserver: dict<any>, req: dict<any>, reply: dict<any>): void
+ if reply.result->empty()
+ return
+ endif
var items: list<dict<any>>
if type(reply.result) == v:t_list
# process the 'textDocument/hover' reply from the LSP server
# Result: Hover | null
def s:processHoverReply(lspserver: dict<any>, req: dict<any>, reply: dict<any>): void
- if type(reply.result) == v:t_none
+ if reply.result->empty()
return
endif
# process the 'textDocument/references' reply from the LSP server
# Result: Location[] | null
def s:processReferencesReply(lspserver: dict<any>, req: dict<any>, reply: dict<any>): void
- if type(reply.result) == v:t_none || reply.result->empty()
+ if reply.result->empty()
WarnMsg('Error: No references found')
return
endif
for foldRange in reply.result
end_lnum = foldRange.endLine + 1
if end_lnum < foldRange.startLine + 2
- end_lnum = foldRange.startLine + 2
+ end_lnum = foldRange.startLine + 2
endif
exe ':' .. (foldRange.startLine + 2) .. ',' .. end_lnum .. 'fold'
- :foldopen!
+ # Open all the folds, otherwise the subsequently created folds are not
+ # correct.
+ :silent! foldopen!
endfor
if &foldcolumn == 0
endfor
symbols->setwinvar(lspserver.workspaceSymbolPopup, 'LspSymbolTable')
lspserver.workspaceSymbolPopup->popup_settext(
- symbols->copy()->map('v:val.name'))
+ symbols->copy()->mapnew('v:val.name'))
enddef
# Process various reply messages from the LSP server
# sort the diaganostics messages for a buffer by line number
def s:getSortedDiagLines(lspserver: dict<any>, bnr: number): list<number>
var lnums: list<number> =
- lspserver.diagsMap[bnr]->keys()->map((_, v) => str2nr(v))
+ lspserver.diagsMap[bnr]->keys()->mapnew((_, v) => str2nr(v))
return lnums->sort((a, b) => a - b)
enddef