enc: config default golang

This commit is contained in:
asep.komarudin 2024-06-29 11:07:33 +07:00
parent a7ae61e8af
commit 0d0de22c7b
4 changed files with 46 additions and 12 deletions

View file

@ -3,6 +3,37 @@
local M = {}
if pcode.active_golang_config then
M = {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "go", "gomod", "gosum", "gotmpl", "gowork" })
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "gopls" })
end,
},
{
"stevearc/conform.nvim",
event = "VeryLazy",
opts = function(_, opts)
local package = "gofumpt"
require("user.utils.masoncfg").try_install(package)
opts.formatters_by_ft.python = { package }
end,
},
{
"mfussenegger/nvim-lint",
opts = function(_, opts)
opts.linters_by_ft = opts.linters_by_ft or {}
require("user.utils.masoncfg").try_install("ast-grep")
opts.linters_by_ft.php = { "ast-grep" }
end,
},
{
"nvim-neotest/neotest",
event = "VeryLazy",

View file

@ -81,15 +81,15 @@ if pcode.active_php_config then
table.insert(pcode.null_ls_ensure_installed, "phpcs")
end
-- run if golang config true
if pcode.active_golang_config then
local lst_ts = { "go", "gomod", "gosum", "gotmpl", "gowork" }
for _, ts in pairs(lst_ts) do
table.insert(pcode.treesitter_ensure_installed, ts)
end
table.insert(pcode.mason_ensure_installed, "gopls")
table.insert(pcode.null_ls_ensure_installed, "ast_grep")
table.insert(pcode.null_ls_ensure_installed, "gofumpt")
end
-- if pcode.active_golang_config then
-- local lst_ts = { "go", "gomod", "gosum", "gotmpl", "gowork" }
-- for _, ts in pairs(lst_ts) do
-- table.insert(pcode.treesitter_ensure_installed, ts)
-- end
-- table.insert(pcode.mason_ensure_installed, "gopls")
-- table.insert(pcode.null_ls_ensure_installed, "ast_grep")
-- table.insert(pcode.null_ls_ensure_installed, "gofumpt")
-- end
-- run if python config true
if pcode.active_python_config then
-- table.insert(pcode.treesitter_ensure_installed, "python")