mirror of
https://github.com/neovim/neovim.git
synced 2025-11-17 15:51:32 +00:00
feat(lsp): fallback to code-action command on resolve failure
This commit is contained in:
@@ -679,7 +679,7 @@ local function on_code_action_results(results, ctx, options)
|
||||
-- command: string
|
||||
-- arguments?: any[]
|
||||
--
|
||||
local client = vim.lsp.get_client_by_id(action_tuple[1])
|
||||
local client = assert(vim.lsp.get_client_by_id(action_tuple[1]))
|
||||
local action = action_tuple[2]
|
||||
if
|
||||
not action.edit
|
||||
@@ -688,10 +688,14 @@ local function on_code_action_results(results, ctx, options)
|
||||
then
|
||||
client.request('codeAction/resolve', action, function(err, resolved_action)
|
||||
if err then
|
||||
vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR)
|
||||
return
|
||||
if action.command then
|
||||
apply_action(action, client)
|
||||
else
|
||||
vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR)
|
||||
end
|
||||
else
|
||||
apply_action(resolved_action, client)
|
||||
end
|
||||
apply_action(resolved_action, client)
|
||||
end)
|
||||
else
|
||||
apply_action(action, client)
|
||||
|
||||
Reference in New Issue
Block a user