rollback: config with conform

This commit is contained in:
asep.komarudin 2024-06-24 08:03:25 +07:00
parent 33fe8d43df
commit 22fef75144
6 changed files with 11 additions and 111 deletions

View file

@ -24,15 +24,12 @@
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" },
"mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "f5425eb1d0d794f0305d5eeebddabb74614683ff" },
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
"mini.indentscope": { "branch": "main", "commit": "56d42be090e8fcc68eda69cfe55af8c5e562300e" },
"neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" },
"neotest": { "branch": "master", "commit": "f30bab1faef13d47f3905e065215c96a42d075ad" },
"neotest-golang": { "branch": "main", "commit": "7d0c75265cbd4567f4a41795c263913c354c7a91" },
"neotest-phpunit": { "branch": "main", "commit": "baae8dfa0a3aaacd9f0bb6845d6348f5bcdc48bb" },
"neotest-plenary": { "branch": "master", "commit": "dcaf5ed67a9e28a246e9783319e5aa6c9ea1c584" },
"neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" },
"neotest-gtest": { "branch": "main", "commit": "b44c8afc26cea75ffc80617ce07b4e745a56e589" },
"neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" },
"noice.nvim": { "branch": "main", "commit": "8f1d9966762e62fa8788e5fb1a5f6a86784221d9" },
"none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" },
"none-ls.nvim": { "branch": "main", "commit": "f1b438ab1709cf9d8875843559d20265013ac755" },
@ -40,11 +37,7 @@
"nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
"nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" },
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
"nvim-dap": { "branch": "master", "commit": "5ba8ceace596360321cf33fa4b56d9d46e057ce9" },
"nvim-dap-go": { "branch": "main", "commit": "a0c5a2b991d7e9304a9a032cf177e22a4b0acda1" },
"nvim-dap-ui": { "branch": "master", "commit": "f7d75cca202b52a60c520ec7b1ec3414d6e77b0f" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "d7c695ea39542f6da94ee4d66176f5d660ab0a77" },
"nvim-lint": { "branch": "master", "commit": "941fa1220a61797a51f3af9ec6b7d74c8c7367ce" },
"nvim-jdtls": { "branch": "master", "commit": "a5c6f38f8151d7b4f5b32c005a95022fa66f4c9d" },
"nvim-lspconfig": { "branch": "master", "commit": "0b8165cf95806bc4bb8f745bb0c92021b2ed4b98" },
"nvim-material-icon": { "branch": "main", "commit": "2f1d6333bbec2e787774193c9fc7b447b878069a" },
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
@ -69,7 +62,6 @@
"vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" },
"vim-visual-multi": { "branch": "master", "commit": "b84a6d42c1c10678928b0bf8327f378c8bc8af5a" },
"virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" },
"vscode-php-debug": { "branch": "main", "commit": "3025d1f01b5b7725e7c1c213d63f3de45f0534b3" },
"which-key.nvim": { "branch": "main", "commit": "0539da005b98b02cf730c1d9da82b8e8edb1c2d2" },
"yanky.nvim": { "branch": "main", "commit": "9268018e92d02650a94e39dd5f5903c542f7ea11" }
}

View file

@ -156,11 +156,11 @@ pcode.active_javascript_config = {
jest_command = "npm test -- ",
jest_config = "jest.config.mjs",
}
pcode.active_php_config = true
pcode.active_golang_config = true
pcode.active_php_config = false
pcode.active_golang_config = false
pcode.active_python_config = false
pcode.active_cpp_config = false
pcode.active_cpp_config = true
pcode.active_java_config = {
active = false,
active = true,
project = "gradle", -- gradle or maven
}

View file

@ -134,45 +134,6 @@ if pcode.active_golang_config then
})
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

View file

@ -106,45 +106,6 @@ if pcode.active_php_config then
{ "<Leader>TS", function() require("neotest").run.stop() end, desc = "Stop" },
},
},
{
"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.php = { "php-cs-fixer" }
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,
},
{
"mfussenegger/nvim-lint",
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
opts = function(_, opts)
opts.linters_by_ft = opts.linters_by_ft or {}
opts.linters_by_ft.php = { "phpcs" }
return opts
end,
config = function(_, opts)
require("lint").linters_by_ft = opts.linters_by_ft
end,
},
}
end

View file

@ -51,6 +51,8 @@ if pcode.active_php_config then
table.insert(pcode.treesitter_ensure_installed, ts)
end
table.insert(pcode.mason_ensure_installed, "intelephense")
table.insert(pcode.null_ls_ensure_installed, "phpcbf")
table.insert(pcode.null_ls_ensure_installed, "phpcs")
end
-- run if golang config true
if pcode.active_golang_config then
@ -59,6 +61,8 @@ if pcode.active_golang_config then
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

View file

@ -128,24 +128,6 @@ return {
local supported_linters = linter.linter_list_registered(buf_ft)
vim.list_extend(buf_client_names, supported_linters)
-- add nvim-lint
local lint_s, lint = pcall(require, "lint")
if lint_s then
for ft_k, ft_v in pairs(lint.linters_by_ft) do
if type(ft_v) == "table" then
for _, lntr in ipairs(ft_v) do
if buf_ft == ft_k then
table.insert(buf_client_names, lntr)
end
end
elseif type(ft_v) == "string" then
if buf_ft == ft_k then
table.insert(buf_client_names, ft_v)
end
end
end
end
-- decomple
-- local unique_client_names = vim.fn.uniq(buf_client_names)
local unique_client_names = unique_list(buf_client_names)