enddef
# Update all the inlay hints. A timer is used to throttle the updates.
-def InlayHintsUpdate()
+def LspInlayHintsUpdate()
if !get(b:, 'LspInlayHintsNeedsUpdate', true)
return
endif
enddef
# Text is modified. Need to update the inlay hints.
-def InlayHintsChanged()
+def LspInlayHintsChanged()
b:LspInlayHintsNeedsUpdate = true
enddef
+# Trigger an update of the inlay hints in the current buffer.
+export def LspInlayHintsUpdateNow()
+ b:LspInlayHintsNeedsUpdate = true
+ LspInlayHintsUpdate()
+enddef
+
# Stop updating the inlay hints.
-def InlayHintsUpdateStop()
+def LspInlayHintsUpdateStop()
var timerid = get(b:, 'LspInlayHintsTimer', -1)
if timerid != -1
timerid->timer_stop()
export def BufferInit(bnr: number)
var acmds: list<dict<any>> = []
+ # Update the inlay hints (if needed) when the cursor is not moved for some
+ # time.
acmds->add({bufnr: bnr,
event: ['CursorHold'],
group: 'LSPBufferAutocmds',
- cmd: 'InlayHintsUpdate()'})
+ cmd: 'LspInlayHintsUpdate()'})
+ # After the text in the current buffer is modified, the inlay hints need to
+ # be updated.
acmds->add({bufnr: bnr,
event: ['TextChanged'],
group: 'LSPBufferAutocmds',
- cmd: 'InlayHintsChanged()'})
+ cmd: 'LspInlayHintsChanged()'})
+ # Editing a file should trigger an inlay hint update.
+ acmds->add({bufnr: bnr,
+ event: ['BufReadPost'],
+ group: 'LSPBufferAutocmds',
+ cmd: 'LspInlayHintsUpdateNow()'})
+ # Inlay hints need not be updated if a buffer is no longer active.
acmds->add({bufnr: bnr,
event: ['BufLeave'],
group: 'LSPBufferAutocmds',
- cmd: 'InlayHintsUpdateStop()'})
+ cmd: 'LspInlayHintsUpdateStop()'})
autocmd_add(acmds)
enddef
By default this is set to false.
showInlayHints Show inlay hints from the language server. By default
this is set to false. The inlay hint text is
- displayed as a virtual text.
+ displayed as a virtual text. Needs Vim version
+ 9.0.0178 or later.
showSignature In insert mode, automatically show the current symbol
signature in a popup. By default this is set to true.
snippetSupport Enable snippet completion support. Need a snippet