feat(go): add workaround to get semantic token highlighting (#815)

This commit is contained in:
Aashish KC
2023-05-25 03:07:40 +05:45
committed by GitHub
parent dc40f02f35
commit 2b5ae7b63c

View File

@ -22,6 +22,28 @@ return {
},
},
},
setup = {
gopls = function()
-- workaround for gopls not supporting semantictokensprovider
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
require("lazyvim.util").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
end
end)
-- end workaround
end,
},
},
},
{