refactor(lsp): check supported methods instead of tbl_get

This commit is contained in:
Yi Ming
2025-07-21 12:52:20 +08:00
parent 7e450aa383
commit a7fef170b7

View File

@@ -1089,11 +1089,11 @@ function Client:on_attach(bufnr)
-- on_attach and LspAttach callbacks the ability to schedule wrap the -- on_attach and LspAttach callbacks the ability to schedule wrap the
-- opt-out (deleting the semanticTokensProvider from capabilities) -- opt-out (deleting the semanticTokensProvider from capabilities)
vim.schedule(function() vim.schedule(function()
if vim.tbl_get(self.server_capabilities, 'semanticTokensProvider', 'full') then if self:supports_method(ms.textDocument_semanticTokens_full) then
lsp.semantic_tokens._start(bufnr, self.id) lsp.semantic_tokens._start(bufnr, self.id)
end end
if vim.tbl_get(self.server_capabilities, 'foldingRangeProvider') then if self:supports_method(ms.textDocument_foldingRange) then
lsp._folding_range._setup(bufnr) lsp._folding_range._setup(bufnr, self.id)
end end
end) end)