Skip to content

Commit

Permalink
fix(lsp_code_actions): extra sanity check for resolve (#949)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed Dec 12, 2023
1 parent adc3dc2 commit 372b643
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lua/fzf-lua/previewer/codeaction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,13 @@ local function preview_action_tuple(tuple, diff_opts, callback)
return { string.format("Resolving action (%s)...", action.kind) }
else
local res = client.request_sync("codeAction/resolve", action)
local err, resolved_action = res.err, res.result
return on_result(diff_tuple, err, resolved_action)
local err, resolved_action = res and res.err, res and res.result
if type(err) == "table" or type(resolved_action) == "table" then
return on_result(diff_tuple, err, resolved_action)
else
-- display the default "unsupported" message
return diff_tuple(nil, tuple, diff_opts)
end
end
else
return diff_tuple(nil, tuple, diff_opts)
Expand Down

0 comments on commit 372b643

Please sign in to comment.