fix(go): make settings configurable for go
This commit is contained in:
@ -16,33 +16,6 @@ return {
|
|||||||
servers = {
|
servers = {
|
||||||
gopls = {
|
gopls = {
|
||||||
settings = {
|
settings = {
|
||||||
gopls = {
|
|
||||||
semanticTokens = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
setup = {
|
|
||||||
gopls = function(_, opts)
|
|
||||||
-- 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
|
|
||||||
opts.settings = {
|
|
||||||
gopls = {
|
gopls = {
|
||||||
gofumpt = true,
|
gofumpt = true,
|
||||||
codelenses = {
|
codelenses = {
|
||||||
@ -77,7 +50,29 @@ return {
|
|||||||
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
|
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
|
||||||
semanticTokens = true,
|
semanticTokens = true,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
gopls = function(_, opts)
|
||||||
|
-- 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,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user