mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-22 08:53:31 +02:00
add: migrate go format & lint
This commit is contained in:
parent
39b6c22356
commit
33fe8d43df
5 changed files with 49 additions and 9 deletions
|
@ -24,13 +24,15 @@
|
||||||
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" },
|
||||||
"mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" },
|
"mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" },
|
||||||
|
"mason-nvim-dap.nvim": { "branch": "main", "commit": "f5425eb1d0d794f0305d5eeebddabb74614683ff" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
|
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
|
||||||
"mini.indentscope": { "branch": "main", "commit": "56d42be090e8fcc68eda69cfe55af8c5e562300e" },
|
"mini.indentscope": { "branch": "main", "commit": "56d42be090e8fcc68eda69cfe55af8c5e562300e" },
|
||||||
"neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" },
|
"neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" },
|
||||||
"neotest": { "branch": "master", "commit": "f30bab1faef13d47f3905e065215c96a42d075ad" },
|
"neotest": { "branch": "master", "commit": "f30bab1faef13d47f3905e065215c96a42d075ad" },
|
||||||
"neotest-gtest": { "branch": "main", "commit": "b44c8afc26cea75ffc80617ce07b4e745a56e589" },
|
"neotest-golang": { "branch": "main", "commit": "7d0c75265cbd4567f4a41795c263913c354c7a91" },
|
||||||
"neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" },
|
|
||||||
"neotest-phpunit": { "branch": "main", "commit": "baae8dfa0a3aaacd9f0bb6845d6348f5bcdc48bb" },
|
"neotest-phpunit": { "branch": "main", "commit": "baae8dfa0a3aaacd9f0bb6845d6348f5bcdc48bb" },
|
||||||
|
"neotest-plenary": { "branch": "master", "commit": "dcaf5ed67a9e28a246e9783319e5aa6c9ea1c584" },
|
||||||
|
"neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" },
|
||||||
"noice.nvim": { "branch": "main", "commit": "8f1d9966762e62fa8788e5fb1a5f6a86784221d9" },
|
"noice.nvim": { "branch": "main", "commit": "8f1d9966762e62fa8788e5fb1a5f6a86784221d9" },
|
||||||
"none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" },
|
"none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" },
|
||||||
"none-ls.nvim": { "branch": "main", "commit": "f1b438ab1709cf9d8875843559d20265013ac755" },
|
"none-ls.nvim": { "branch": "main", "commit": "f1b438ab1709cf9d8875843559d20265013ac755" },
|
||||||
|
@ -39,8 +41,9 @@
|
||||||
"nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" },
|
"nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" },
|
||||||
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
|
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
|
||||||
"nvim-dap": { "branch": "master", "commit": "5ba8ceace596360321cf33fa4b56d9d46e057ce9" },
|
"nvim-dap": { "branch": "master", "commit": "5ba8ceace596360321cf33fa4b56d9d46e057ce9" },
|
||||||
|
"nvim-dap-go": { "branch": "main", "commit": "a0c5a2b991d7e9304a9a032cf177e22a4b0acda1" },
|
||||||
"nvim-dap-ui": { "branch": "master", "commit": "f7d75cca202b52a60c520ec7b1ec3414d6e77b0f" },
|
"nvim-dap-ui": { "branch": "master", "commit": "f7d75cca202b52a60c520ec7b1ec3414d6e77b0f" },
|
||||||
"nvim-jdtls": { "branch": "master", "commit": "a5c6f38f8151d7b4f5b32c005a95022fa66f4c9d" },
|
"nvim-dap-virtual-text": { "branch": "master", "commit": "d7c695ea39542f6da94ee4d66176f5d660ab0a77" },
|
||||||
"nvim-lint": { "branch": "master", "commit": "941fa1220a61797a51f3af9ec6b7d74c8c7367ce" },
|
"nvim-lint": { "branch": "master", "commit": "941fa1220a61797a51f3af9ec6b7d74c8c7367ce" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "0b8165cf95806bc4bb8f745bb0c92021b2ed4b98" },
|
"nvim-lspconfig": { "branch": "master", "commit": "0b8165cf95806bc4bb8f745bb0c92021b2ed4b98" },
|
||||||
"nvim-material-icon": { "branch": "main", "commit": "2f1d6333bbec2e787774193c9fc7b447b878069a" },
|
"nvim-material-icon": { "branch": "main", "commit": "2f1d6333bbec2e787774193c9fc7b447b878069a" },
|
||||||
|
|
|
@ -157,10 +157,10 @@ pcode.active_javascript_config = {
|
||||||
jest_config = "jest.config.mjs",
|
jest_config = "jest.config.mjs",
|
||||||
}
|
}
|
||||||
pcode.active_php_config = true
|
pcode.active_php_config = true
|
||||||
pcode.active_golang_config = false
|
pcode.active_golang_config = true
|
||||||
pcode.active_python_config = false
|
pcode.active_python_config = false
|
||||||
pcode.active_cpp_config = true
|
pcode.active_cpp_config = false
|
||||||
pcode.active_java_config = {
|
pcode.active_java_config = {
|
||||||
active = true,
|
active = false,
|
||||||
project = "gradle", -- gradle or maven
|
project = "gradle", -- gradle or maven
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,45 @@ if pcode.active_golang_config then
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.linters_by_ft = opts.linters_by_ft or {}
|
||||||
|
opts.linters_by_ft.go = { "golangcilint" }
|
||||||
|
return opts
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
require("lint").linters_by_ft = opts.linters_by_ft
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
opts = function(_, opts)
|
||||||
|
local psave = pcode.format_on_save or 0
|
||||||
|
opts.formatters_by_ft = opts.formatters_by_ft or {}
|
||||||
|
opts.formatters_by_ft.go = { "gofmt" }
|
||||||
|
if psave == 1 then
|
||||||
|
opts.format_on_save = {
|
||||||
|
timeout_ms = pcode.format_timeout_ms or 500,
|
||||||
|
lsp_fallback = true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
return opts
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
local conform = require("conform")
|
||||||
|
conform.setup(opts)
|
||||||
|
vim.keymap.set({ "n", "v" }, "<leader>lF", function()
|
||||||
|
conform.format({
|
||||||
|
lsp_fallback = true,
|
||||||
|
async = false,
|
||||||
|
timeout_ms = pcode.format_timeout_ms or 500,
|
||||||
|
})
|
||||||
|
end, { desc = "Format file or range (in visual mode)" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ if pcode.active_php_config then
|
||||||
conform.format({
|
conform.format({
|
||||||
lsp_fallback = true,
|
lsp_fallback = true,
|
||||||
async = false,
|
async = false,
|
||||||
timeout_ms = 500,
|
timeout_ms = pcode.format_timeout_ms or 500,
|
||||||
})
|
})
|
||||||
end, { desc = "Format file or range (in visual mode)" })
|
end, { desc = "Format file or range (in visual mode)" })
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -59,8 +59,6 @@ if pcode.active_golang_config then
|
||||||
table.insert(pcode.treesitter_ensure_installed, ts)
|
table.insert(pcode.treesitter_ensure_installed, ts)
|
||||||
end
|
end
|
||||||
table.insert(pcode.mason_ensure_installed, "gopls")
|
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
|
end
|
||||||
-- run if python config true
|
-- run if python config true
|
||||||
if pcode.active_python_config then
|
if pcode.active_python_config then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue