Skip to content

Commit

Permalink
fix: code actions without kind (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
luckasRanarison committed Oct 26, 2023
1 parent 76e2d4a commit ba8fb2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The default configuration:
quickfix = "🔧",
refactor = "💡",
source = "🔗",
combined = "💡", -- used when combine is set to true
combined = "💡", -- used when combine is set to true or as a fallback when there is no action kind
},
highlights = { -- highlight groups
quickfix = "NonText",
Expand Down
9 changes: 6 additions & 3 deletions lua/clear-action/signs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ local function on_result(results, context)
opts.highlights.combined,
})
else
local actions = { quickfix = 0, refactor = 0, source = 0 }
local actions = { quickfix = 0, refactor = 0, source = 0, combined = 0 }

for _, action in pairs(results) do
for key, value in pairs(actions) do
if vim.startswith(action.kind, key) then actions[key] = value + 1 end
if action.kind and vim.startswith(action.kind, key) then
actions[key] = value + 1
else
actions.combined = actions.combined + 1
end
end
end
for key, _ in pairs(actions) do
Expand Down Expand Up @@ -58,7 +62,6 @@ end

local function code_action_request()
local bufnr = vim.api.nvim_get_current_buf()
local row, _ = unpack(vim.api.nvim_win_get_cursor(0))
local params = vim.lsp.util.make_range_params()

params.context = {
Expand Down

0 comments on commit ba8fb2d

Please sign in to comment.