Skip to content

Commit 0fa6ba7

Browse files
authored
fix: adapt to LSP capability mapping change (#248)
Addresses recent breaking change introduced in PR #32503, where the internal mapping table `_request_name_to_capability` was moved from `vim.lsp` to `vim.lsp.protocol`. See [PR #32503](neovim/neovim#32503) This change ensures compatibility with both older and newer versions by checking both locations for the mapping table. It uses a fallback mechanism for locating the mapping, accommodating the API change.
1 parent f41624e commit 0fa6ba7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lua/null-ls/client.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ end
7474
local on_init = function(new_client, initialize_result)
7575
local capability_is_disabled = function(method)
7676
-- TODO: extract map to prevent future issues
77-
local required_capability = lsp._request_name_to_capability[method]
77+
local method_to_required_capability_map = lsp.protocol._request_name_to_capability
78+
or lsp._request_name_to_capability
79+
local required_capability = method_to_required_capability_map[method]
7880
return not required_capability
7981
or vim.tbl_get(new_client.server_capabilities, unpack(required_capability)) == false
8082
end

0 commit comments

Comments
 (0)