AutoYADM commit: 2024-12-31 20:45:02
This commit is contained in:
parent
96168d78b7
commit
59340e713d
3 changed files with 161 additions and 36 deletions
126
.config/nvim/lua/plugins/go.lua
Normal file
126
.config/nvim/lua/plugins/go.lua
Normal file
|
@ -0,0 +1,126 @@
|
|||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = { ensure_installed = { "go", "gomod", "gowork", "gosum" } },
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
gopls = {
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
gopls = function(_, opts)
|
||||
-- workaround for gopls not supporting semanticTokensProvider
|
||||
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
|
||||
LazyVim.lsp.on_attach(function(client, _)
|
||||
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, "gopls")
|
||||
-- end workaround
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = { ensure_installed = { "goimports", "gofumpt", "gomodifytags", "impl" } },
|
||||
},
|
||||
{
|
||||
"fredrikaverpil/neotest-golang",
|
||||
},
|
||||
{
|
||||
"echasnovski/mini.icons",
|
||||
opts = {
|
||||
file = {
|
||||
[".go-version"] = { glyph = "", hl = "MiniIconsBlue" },
|
||||
},
|
||||
filetype = {
|
||||
gotmpl = { glyph = "", hl = "MiniIconsGrey" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
go = { "goimports", "gofumpt" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = { ensure_installed = { "delve" } },
|
||||
},
|
||||
{
|
||||
"leoluz/nvim-dap-go",
|
||||
opts = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
dependencies = {
|
||||
"fredrikaverpil/neotest-golang",
|
||||
},
|
||||
opts = {
|
||||
adapters = {
|
||||
["neotest-golang"] = {
|
||||
-- Here we can set options for neotest-golang, e.g.
|
||||
-- go_test_args = { "-v", "-race", "-count=1", "-timeout=60s" },
|
||||
dap_go_enabled = true, -- requires leoluz/nvim-dap-go
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue