forked from Snoweuph/Dotfiles_nvim
39 lines
1.1 KiB
Lua
39 lines
1.1 KiB
Lua
|
local T = require('toolchain')
|
||
|
local M = {}
|
||
|
|
||
|
M.setup = function()
|
||
|
T.add_highlighter_autoinstalls('go', 'gomod', 'gosum', 'gotmpl')
|
||
|
T.add_null_ls_module(function(null_ls)
|
||
|
return {
|
||
|
-- Actions
|
||
|
null_ls.builtins.code_actions.gomodifytags,
|
||
|
null_ls.builtins.code_actions.impl,
|
||
|
-- Diagnostics
|
||
|
null_ls.builtins.diagnostics.golangci_lint,
|
||
|
null_ls.builtins.diagnostics.staticcheck,
|
||
|
-- Formatter
|
||
|
null_ls.builtins.formatting.gofumpt,
|
||
|
}
|
||
|
end)
|
||
|
T.add_lsp_autoinstalls('gopls')
|
||
|
T.add_lsps(function(lspconfig, capabilities)
|
||
|
lspconfig.gopls.setup({ capabilities = capabilities })
|
||
|
end)
|
||
|
|
||
|
T.add_plugins({
|
||
|
'leoluz/nvim-dap-go',
|
||
|
config = function()
|
||
|
local dir = require('util.finder').find_project_dir(
|
||
|
'go.mod',
|
||
|
3,
|
||
|
{ 'src', 'app', 'pkg' },
|
||
|
{ 'test' },
|
||
|
true
|
||
|
)
|
||
|
require('dap-go').setup({ delve = { cwd = dir } })
|
||
|
end,
|
||
|
})
|
||
|
end
|
||
|
|
||
|
return M
|