mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-21 16:39:04 +02:00
enc: add formattrer & linter for php config
This commit is contained in:
parent
b28f354786
commit
13e2e75069
5 changed files with 63 additions and 3 deletions
|
@ -30,6 +30,7 @@
|
||||||
"neotest": { "branch": "master", "commit": "f30bab1faef13d47f3905e065215c96a42d075ad" },
|
"neotest": { "branch": "master", "commit": "f30bab1faef13d47f3905e065215c96a42d075ad" },
|
||||||
"neotest-gtest": { "branch": "main", "commit": "b44c8afc26cea75ffc80617ce07b4e745a56e589" },
|
"neotest-gtest": { "branch": "main", "commit": "b44c8afc26cea75ffc80617ce07b4e745a56e589" },
|
||||||
"neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" },
|
"neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" },
|
||||||
|
"neotest-phpunit": { "branch": "main", "commit": "baae8dfa0a3aaacd9f0bb6845d6348f5bcdc48bb" },
|
||||||
"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" },
|
||||||
|
@ -37,7 +38,10 @@
|
||||||
"nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
|
"nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
|
||||||
"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-ui": { "branch": "master", "commit": "f7d75cca202b52a60c520ec7b1ec3414d6e77b0f" },
|
||||||
"nvim-jdtls": { "branch": "master", "commit": "a5c6f38f8151d7b4f5b32c005a95022fa66f4c9d" },
|
"nvim-jdtls": { "branch": "master", "commit": "a5c6f38f8151d7b4f5b32c005a95022fa66f4c9d" },
|
||||||
|
"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" },
|
||||||
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
|
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
|
||||||
|
@ -62,6 +66,7 @@
|
||||||
"vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" },
|
"vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" },
|
||||||
"vim-visual-multi": { "branch": "master", "commit": "b84a6d42c1c10678928b0bf8327f378c8bc8af5a" },
|
"vim-visual-multi": { "branch": "master", "commit": "b84a6d42c1c10678928b0bf8327f378c8bc8af5a" },
|
||||||
"virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" },
|
"virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" },
|
||||||
|
"vscode-php-debug": { "branch": "main", "commit": "3025d1f01b5b7725e7c1c213d63f3de45f0534b3" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "0539da005b98b02cf730c1d9da82b8e8edb1c2d2" },
|
"which-key.nvim": { "branch": "main", "commit": "0539da005b98b02cf730c1d9da82b8e8edb1c2d2" },
|
||||||
"yanky.nvim": { "branch": "main", "commit": "9268018e92d02650a94e39dd5f5903c542f7ea11" }
|
"yanky.nvim": { "branch": "main", "commit": "9268018e92d02650a94e39dd5f5903c542f7ea11" }
|
||||||
}
|
}
|
|
@ -156,7 +156,7 @@ pcode.active_javascript_config = {
|
||||||
jest_command = "npm test -- ",
|
jest_command = "npm test -- ",
|
||||||
jest_config = "jest.config.mjs",
|
jest_config = "jest.config.mjs",
|
||||||
}
|
}
|
||||||
pcode.active_php_config = false
|
pcode.active_php_config = true
|
||||||
pcode.active_golang_config = false
|
pcode.active_golang_config = false
|
||||||
pcode.active_python_config = false
|
pcode.active_python_config = false
|
||||||
pcode.active_cpp_config = true
|
pcode.active_cpp_config = true
|
||||||
|
|
|
@ -106,6 +106,45 @@ if pcode.active_php_config then
|
||||||
{ "<Leader>TS", function() require("neotest").run.stop() end, desc = "Stop" },
|
{ "<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 = 500,
|
||||||
|
})
|
||||||
|
end, { desc = "Format file or range (in visual mode)" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
|
||||||
|
opts = {
|
||||||
|
linters_by_ft = {
|
||||||
|
php = { "phpcs" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("lint").linters_by_ft = opts.linters_by_ft
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,6 @@ if pcode.active_php_config then
|
||||||
table.insert(pcode.treesitter_ensure_installed, ts)
|
table.insert(pcode.treesitter_ensure_installed, ts)
|
||||||
end
|
end
|
||||||
table.insert(pcode.mason_ensure_installed, "intelephense")
|
table.insert(pcode.mason_ensure_installed, "intelephense")
|
||||||
table.insert(pcode.null_ls_ensure_installed, "phpcbf")
|
|
||||||
table.insert(pcode.null_ls_ensure_installed, "phpcs")
|
|
||||||
end
|
end
|
||||||
-- run if golang config true
|
-- run if golang config true
|
||||||
if pcode.active_golang_config then
|
if pcode.active_golang_config then
|
||||||
|
|
|
@ -128,6 +128,24 @@ return {
|
||||||
local supported_linters = linter.linter_list_registered(buf_ft)
|
local supported_linters = linter.linter_list_registered(buf_ft)
|
||||||
vim.list_extend(buf_client_names, supported_linters)
|
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
|
-- decomple
|
||||||
-- local unique_client_names = vim.fn.uniq(buf_client_names)
|
-- local unique_client_names = vim.fn.uniq(buf_client_names)
|
||||||
local unique_client_names = unique_list(buf_client_names)
|
local unique_client_names = unique_list(buf_client_names)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue