aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/lua/vim/lsp/handlers.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index c2f2b870f7..624f8b5462 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -143,12 +143,14 @@ M['textDocument/codeAction'] = function(_, result, ctx)
if action.edit then
util.apply_workspace_edit(action.edit)
end
- local command = type(action.command) == 'table' and action.command or action
- local fn = vim.lsp.commands[command.command]
- if fn then
- fn(command, ctx)
- else
- buf.execute_command(command)
+ if action.command then
+ local command = type(action.command) == 'table' and action.command or action
+ local fn = vim.lsp.commands[command.command]
+ if fn then
+ fn(command, ctx)
+ else
+ buf.execute_command(command)
+ end
end
end