Skip to content

Commit

Permalink
feat(go): add workaround to get semantic token highlighting (#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
kcaashish committed May 24, 2023
1 parent dc40f02 commit 2b5ae7b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lua/lazyvim/plugins/extras/lang/go.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
},
{
Expand Down

0 comments on commit 2b5ae7b

Please sign in to comment.