From f20335a54ce7f240902d4ee14d726620a38f95bc Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Fri, 14 Feb 2025 14:06:47 +0100 Subject: feat(lsp): add support for completionItem.command resolving `command` was already resolved via a `completionItem/resolve` request but only if `additionalTextEdits` were also present, and the `resolveSupport` capability wasn't listed. Closes https://github.com/neovim/neovim/issues/32406 --- runtime/lua/vim/lsp/completion.lua | 7 ++++--- runtime/lua/vim/lsp/protocol.lua | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp/completion.lua b/runtime/lua/vim/lsp/completion.lua index f287304508..d99b1ffd0d 100644 --- a/runtime/lua/vim/lsp/completion.lua +++ b/runtime/lua/vim/lsp/completion.lua @@ -610,13 +610,14 @@ local function on_complete_done() clear_word() if err then vim.notify_once(err.message, vim.log.levels.WARN) - elseif result and result.additionalTextEdits then - lsp.util.apply_text_edits(result.additionalTextEdits, bufnr, position_encoding) + elseif result then + if result.additionalTextEdits then + lsp.util.apply_text_edits(result.additionalTextEdits, bufnr, position_encoding) + end if result.command then completion_item.command = result.command end end - apply_snippet_and_command() end, bufnr) else diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index fbfd0cd6b0..33d029420b 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -458,6 +458,7 @@ function protocol.make_client_capabilities() resolveSupport = { properties = { 'additionalTextEdits', + 'command', }, }, tagSupport = { -- cgit