Skip to content

Commit

Permalink
chore: server_capabilities.codeActionProvider can be bool
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-x committed Sep 9, 2024
1 parent 53efe4b commit 31bd728
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lua/navigator/lspclient/attach.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ M.on_attach = function(client, bufnr)

if _NgConfigValues.lsp.code_action.enable then
if client.server_capabilities.codeActionProvider and client.name ~= 'null-ls' then

local kinds = {}
if client.server_capabilities.codeActionProvider.codeActionKinds then
if
type(client.server_capabilities.codeActionProvider) == 'table'
and client.server_capabilities.codeActionProvider.codeActionKinds
then
for _, kind in ipairs(client.server_capabilities.codeActionProvider.codeActionKinds) do
if not vim.tbl_contains(_NgConfigValues.lsp.code_action.exclude, kind) then
table.insert(kinds, kind)
Expand All @@ -89,7 +91,7 @@ M.on_attach = function(client, bufnr)
group = api.nvim_create_augroup('NGCodeActGroup_' .. tostring(bufnr), {}),
buffer = bufnr,
callback = function()
require('navigator.codeAction').code_action_prompt(bufnr, kinds)
require('navigator.codeAction').code_action_prompt(bufnr, kinds)
end,
})
end
Expand Down

0 comments on commit 31bd728

Please sign in to comment.