mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-07-08 16:34:26 +02:00
add: php default linter config
This commit is contained in:
parent
ef95246d88
commit
10dfd41f44
5 changed files with 41 additions and 8 deletions
|
@ -156,11 +156,11 @@ pcode.active_javascript_config = {
|
|||
jest_command = "npm test -- ",
|
||||
jest_config = "jest.config.mjs",
|
||||
}
|
||||
pcode.active_php_config = false
|
||||
pcode.active_php_config = true
|
||||
pcode.active_golang_config = false
|
||||
pcode.active_python_config = false
|
||||
pcode.active_cpp_config = false
|
||||
pcode.active_java_config = {
|
||||
active = true,
|
||||
active = false,
|
||||
project = "gradle", -- gradle or maven
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ return {
|
|||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
vim.lsp.buf.format({ bufnr = bufnr, timeout_ms = pcode.format_timeout_ms or 5000 })
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
|
|
@ -106,6 +106,19 @@ if pcode.active_php_config then
|
|||
{ "<Leader>TS", function() require("neotest").run.stop() end, desc = "Stop" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"gbprod/none-ls-php.nvim",
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
opts = function(_, opts)
|
||||
opts.linters_by_ft = opts.linters_by_ft or {}
|
||||
opts.linters_by_ft.php = { "phpcs" }
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("lint").linters_by_ft = opts.linters_by_ft
|
||||
end,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -128,6 +128,24 @@ return {
|
|||
local supported_linters = linter.linter_list_registered(buf_ft)
|
||||
vim.list_extend(buf_client_names, supported_linters)
|
||||
|
||||
-- cek nvimlint
|
||||
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 _, ltr in ipairs(ft_v) do
|
||||
if buf_ft == ft_k then
|
||||
table.insert(buf_client_names, ltr)
|
||||
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue