This commit is contained in:
2026-10-06 12:49:41 +03:00
parent 3fe6ca3d6b
commit a87e5ea4f5
6 changed files with 164 additions and 1 deletions
+41
View File
@@ -0,0 +1,41 @@
return {
{
"neovim/nvim-lspconfig",
opts = {
servers = {
gopls = {
settings = {
gopls = {
buildFlags = { "-tags=unit,integration" },
},
},
},
},
setup = {
-- Override LazyVim's gopls semanticTokens workaround, which crashes on
-- Neovim 0.12 because the gopls client's config.capabilities has no
-- `textDocument` field (go.lua:60). Guard against the nil.
gopls = function(_, _)
Snacks.util.lsp.on({ name = "gopls" }, function(_, client)
if client.server_capabilities.semanticTokensProvider then
return
end
local caps = client.config.capabilities or {}
local semantic = caps.textDocument and caps.textDocument.semanticTokens
if not semantic then
return
end
client.server_capabilities.semanticTokensProvider = {
full = true,
legend = {
tokenTypes = semantic.tokenTypes,
tokenModifiers = semantic.tokenModifiers,
},
range = true,
}
end)
end,
},
},
},
}