mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-01 21:14:38 +02:00
feat(go): add fine-tuned LSP options, add some null-ls sources (#1024)
This commit is contained in:
parent
089606b48d
commit
4ba5086b3d
1 changed files with 53 additions and 2 deletions
|
@ -23,8 +23,8 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup = {
|
setup = {
|
||||||
gopls = function()
|
gopls = function(_, opts)
|
||||||
-- workaround for gopls not supporting semantictokensprovider
|
-- workaround for gopls not supporting semanticTokensProvider
|
||||||
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
|
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
|
||||||
require("lazyvim.util").on_attach(function(client, _)
|
require("lazyvim.util").on_attach(function(client, _)
|
||||||
if client.name == "gopls" then
|
if client.name == "gopls" then
|
||||||
|
@ -42,10 +42,61 @@ return {
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
-- end workaround
|
-- end workaround
|
||||||
|
opts.settings = {
|
||||||
|
gopls = {
|
||||||
|
gofumpt = true,
|
||||||
|
codelenses = {
|
||||||
|
gc_details = false,
|
||||||
|
generate = true,
|
||||||
|
regenerate_cgo = true,
|
||||||
|
run_govulncheck = true,
|
||||||
|
test = true,
|
||||||
|
tidy = true,
|
||||||
|
upgrade_dependency = true,
|
||||||
|
vendor = true,
|
||||||
|
},
|
||||||
|
hints = {
|
||||||
|
assignVariableTypes = true,
|
||||||
|
compositeLiteralFields = true,
|
||||||
|
compositeLiteralTypes = true,
|
||||||
|
constantValues = true,
|
||||||
|
functionTypeParameters = true,
|
||||||
|
parameterNames = true,
|
||||||
|
rangeVariableTypes = true,
|
||||||
|
},
|
||||||
|
analyses = {
|
||||||
|
fieldalignment = true,
|
||||||
|
nilness = true,
|
||||||
|
unusedparams = true,
|
||||||
|
unusedwrite = true,
|
||||||
|
useany = true,
|
||||||
|
},
|
||||||
|
usePlaceholders = true,
|
||||||
|
completeUnimported = true,
|
||||||
|
staticcheck = true,
|
||||||
|
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
|
||||||
|
semanticTokens = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
-- Ensure Go tools are installed
|
||||||
|
{
|
||||||
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.sources) == "table" then
|
||||||
|
local nls = require("null-ls")
|
||||||
|
vim.list_extend(opts.sources, {
|
||||||
|
nls.builtins.code_actions.gomodifytags,
|
||||||
|
nls.builtins.code_actions.impl,
|
||||||
|
nls.builtins.formatting.gofumpt,
|
||||||
|
nls.builtins.formatting.goimports_reviser,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"mfussenegger/nvim-dap",
|
"mfussenegger/nvim-dap",
|
||||||
optional = true,
|
optional = true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue