aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaria José Solano <majosolano99@gmail.com>2025-03-06 21:22:42 -0800
committerMathias Fußenegger <mfussenegger@users.noreply.github.com>2025-03-07 10:23:55 +0100
commit5d08b65ac2f65eecc1e48e0e2007e5fed0d8de86 (patch)
tree451c88cf96136b5823cf6f1854462150a93028e8
parente46f07b1d2942c7b5c08fca9a4cac735ee2c0c71 (diff)
downloadrneovim-5d08b65ac2f65eecc1e48e0e2007e5fed0d8de86.tar.gz
rneovim-5d08b65ac2f65eecc1e48e0e2007e5fed0d8de86.tar.bz2
rneovim-5d08b65ac2f65eecc1e48e0e2007e5fed0d8de86.zip
fix(lsp): use unresolved code action when `codeAction/resolve` fails
-rw-r--r--runtime/lua/vim/lsp/buf.lua3
1 files changed, 2 insertions, 1 deletions
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)