From 31bd7289b4f8394f7156e4909a57ea5ae7eae955 Mon Sep 17 00:00:00 2001 From: ray-x Date: Mon, 9 Sep 2024 12:27:03 +1000 Subject: [PATCH] chore: server_capabilities.codeActionProvider can be bool --- lua/navigator/lspclient/attach.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/navigator/lspclient/attach.lua b/lua/navigator/lspclient/attach.lua index abf4ed9..9ece85d 100644 --- a/lua/navigator/lspclient/attach.lua +++ b/lua/navigator/lspclient/attach.lua @@ -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) @@ -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