if !treeItem->has_key('children')
# First time retrieving the children for the item at index "idx"
- var lspserver = buf.BufLspServerGet(w:LspBufnr)
+ var lspserver = buf.BufLspServerGet(w:LspBufnr, 'callHierarchy')
if lspserver->empty() || !lspserver.running
return
endif
prop_type_add('LspDiagVirtualTextHint',
{highlight: 'LspDiagVirtualTextHint', override: true})
- autocmd_add([{group: 'LspOptionsChanged',
+ autocmd_add([{group: 'LspCmds',
event: 'User',
- pattern: '*',
+ pattern: 'LspOptionsChanged',
cmd: 'LspDiagsOptionsChanged()'}])
# ALE plugin support
prop_type_add('LspInlayHintsType', {highlight: 'LspInlayHintsType'})
prop_type_add('LspInlayHintsParam', {highlight: 'LspInlayHintsParam'})
- autocmd_add([{group: 'LspOptionsChanged',
+ autocmd_add([{group: 'LspCmds',
event: 'User',
- pattern: '*',
+ pattern: 'LspOptionsChanged',
cmd: 'LspInlayHintsOptionsChanged()'}])
enddef
continue
endif
for lspserver in lspservers
- if !lspserver.featureEnabled('inlayHint')
+ if !lspserver.ready
+ || !lspserver.featureEnabled('inlayHint')
|| (!lspserver.isInlayHintProvider &&
!lspserver.isClangdInlayHintsProvider)
continue
lspserver.switchSourceHeader()
enddef
-# Show the signature using "textDocument/signatureHelp" LSP method
-# Invoked from an insert-mode mapping, so return an empty string.
-def g:LspShowSignature(): string
- var lspserver: dict<any> = buf.CurbufGetServerChecked('signatureHelp')
- if lspserver->empty()
- return ''
- endif
-
- # first send all the changes in the current buffer to the LSP server
- listener_flush()
- lspserver.showSignature()
- return ''
-enddef
-
# A buffer is saved. Send the "textDocument/didSave" LSP notification
def LspSavedFile(bnr: number)
var lspservers: list<dict<any>> = buf.BufLspServersGet(bnr)->filter(
AddBufLocalAutocmds(lspserver, bnr)
diag.BufferInit(lspserver, bnr)
- signature.BufferInit(lspserver)
- inlayhints.BufferInit(lspserver, bnr)
var allServersReady = true
var lspservers: list<dict<any>> = buf.BufLspServersGet(bnr)
if allServersReady
for lspsrv in lspservers
- # It's only possible to initialize completion when all server capabilities
+ # It's only possible to initialize the features when the server
+ # capabilities of all the registered language servers for this file type
# are known.
var completionServer = buf.BufLspServerGet(bnr, 'completion')
if !completionServer->empty() && lspsrv.id == completionServer.id
completion.BufferInit(lspsrv, bnr, ftype)
endif
+
+ var signatureServer = buf.BufLspServerGet(bnr, 'signatureHelp')
+ if !signatureServer->empty() && lspsrv.id == signatureServer.id
+ signature.BufferInit(lspsrv)
+ endif
+
+ var inlayHintServer = buf.BufLspServerGet(bnr, 'inlayHint')
+ if !inlayHintServer->empty() && lspsrv.id == inlayHintServer.id
+ inlayhints.BufferInit(lspsrv, bnr)
+ endif
endfor
if exists('#User#LspAttached')
endif
# Apply the changed options
- if exists('#LspOptionsChanged#User')
- :doautocmd <nomodeline> LspOptionsChanged User
+ if exists('LspCmds##User#LspOptionsChanged')
+ :doautocmd <nomodeline> LspCmds User LspOptionsChanged
endif
enddef
CloseSignaturePopup(lspserver)
enddef
+# Show the signature using "textDocument/signatureHelp" LSP method
+# Invoked from an insert-mode mapping, so return an empty string.
+def g:LspShowSignature(): string
+ var lspserver: dict<any> = buf.CurbufGetServerChecked('signatureHelp')
+ if lspserver->empty()
+ return ''
+ endif
+
+ # first send all the changes in the current buffer to the LSP server
+ listener_flush()
+ lspserver.showSignature()
+ return ''
+enddef
+
export def InitOnce()
hlset([{name: 'LspSigActiveParameter', default: true, linksto: 'LineNr'}])
enddef
# map characters that trigger signature help
for ch in lspserver.caps.signatureHelpProvider.triggerCharacters
- exe $"inoremap <buffer> <silent> {ch} {ch}<C-R>=LspShowSignature()<CR>"
+ exe $"inoremap <buffer> <silent> {ch} {ch}<C-R>=g:LspShowSignature()<CR>"
endfor
# close the signature popup when leaving insert mode