From 3e3775961fd231ab7cf1e8c67bb28249f720333c Mon Sep 17 00:00:00 2001 From: Mathias Fußenegger Date: Sun, 16 Mar 2025 13:58:38 +0100 Subject: refactor(lsp)!: rename lsp.completion.trigger() to get() (#32911) Problem: `trigger` is a custom word not yet used in APIs. Solution: Use `get` instead because the main effect is that the completion candidates will be collected (and shown by default, but follow-up commits are planned to add an `on_result` callback that allows more general handling). --------- Co-authored-by: Christian Clason --- runtime/lua/vim/lsp/completion.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp/completion.lua b/runtime/lua/vim/lsp/completion.lua index 4064e02597..dcb7b5fa9b 100644 --- a/runtime/lua/vim/lsp/completion.lua +++ b/runtime/lua/vim/lsp/completion.lua @@ -536,7 +536,7 @@ local function on_insert_char_pre(handle) local ctx = { triggerKind = protocol.CompletionTriggerKind.TriggerForIncompleteCompletions } if debounce_ms == 0 then vim.schedule(function() - M.trigger({ ctx = ctx }) + M.get({ ctx = ctx }) end) else completion_timer = new_timer() @@ -544,7 +544,7 @@ local function on_insert_char_pre(handle) debounce_ms, 0, vim.schedule_wrap(function() - M.trigger({ ctx = ctx }) + M.get({ ctx = ctx }) end) ) end @@ -791,13 +791,13 @@ function M.enable(enable, client_id, bufnr, opts) end --- @inlinedoc ---- @class vim.lsp.completion.trigger.Opts +--- @class vim.lsp.completion.get.Opts --- @field ctx? lsp.CompletionContext Completion context. Defaults to a trigger kind of `invoked`. --- Triggers LSP completion once in the current buffer. --- ---- @param opts? vim.lsp.completion.trigger.Opts -function M.trigger(opts) +--- @param opts? vim.lsp.completion.get.Opts +function M.get(opts) opts = opts or {} local ctx = opts.ctx or { triggerKind = protocol.CompletionTriggerKind.Invoked } local bufnr = api.nvim_get_current_buf() -- cgit