vim.lsp.inline_completion
Methods4
function M.is_enabled(filter: vim.lsp.capability.enable.Filter | nil) -> any
Query whether inline completion is enabled in the {filter}ed scope
function M.enable(enable: nil | boolean, filter: vim.lsp.capability.enable.Filter | nil) -> nil
Enables or disables inline completion for the {filter}ed scope, inline completion will automatically be refreshed when you are in insert mode.
To "toggle", pass the inverse of is_enabled():
vim.lsp.inline_completion.enable(not vim.lsp.inline_completion.is_enabled())
Parameters
enablenil | booleantrue/nil to enable, false to disable
filtervim.lsp.capability.enable.Filter | nil
Returns
- nil
function M.select(opts: vim.lsp.inline_completion.select.Opts | nil) -> nil
Switch between available inline completion candidates.
function M.get(opts: vim.lsp.inline_completion.get.Opts | nil) -> boolean
Accept the currently displayed completion candidate to the buffer.
It returns false when no candidate can be accepted, so you can use the return value to implement a fallback:
vim.keymap.set('i', '<Tab>', function()
if not vim.lsp.inline_completion.get() then
return '<Tab>'
end
end, { expr = true, desc = 'Accept the current inline completion' })
Parameters
optsvim.lsp.inline_completion.get.Opts | nil
Returns
- boolean
trueif a completion was applied, elsefalse.