refactor: LazyVim.lsp.on_attach

This commit is contained in:
Folke Lemaitre 2024-06-08 08:11:28 +02:00
parent 6098a36d92
commit 8f7ee56dab
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
6 changed files with 32 additions and 42 deletions

View file

@ -61,20 +61,18 @@ return {
-- workaround for gopls not supporting semanticTokensProvider
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
LazyVim.lsp.on_attach(function(client, _)
if client.name == "gopls" then
if not client.server_capabilities.semanticTokensProvider then
local semantic = client.config.capabilities.textDocument.semanticTokens
client.server_capabilities.semanticTokensProvider = {
full = true,
legend = {
tokenTypes = semantic.tokenTypes,
tokenModifiers = semantic.tokenModifiers,
},
range = true,
}
end
if not client.server_capabilities.semanticTokensProvider then
local semantic = client.config.capabilities.textDocument.semanticTokens
client.server_capabilities.semanticTokensProvider = {
full = true,
legend = {
tokenTypes = semantic.tokenTypes,
tokenModifiers = semantic.tokenModifiers,
},
range = true,
}
end
end)
end, "gopls")
-- end workaround
end,
},