From 5d08b65ac2f65eecc1e48e0e2007e5fed0d8de86 Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Thu, 6 Mar 2025 21:22:42 -0800 Subject: fix(lsp): use unresolved code action when `codeAction/resolve` fails --- runtime/lua/vim/lsp/buf.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 094be17c83..2da591e9bb 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -1155,7 +1155,8 @@ local function on_code_action_results(results, opts) if not action.edit or not action.command and client:supports_method(ms.codeAction_resolve) then client:request(ms.codeAction_resolve, action, function(err, resolved_action) if err then - if action.command then + -- If resolve fails, try to apply the edit/command from the original code action. + if action.edit or action.command then apply_action(action, client, choice.ctx) else vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR) -- cgit