fix(nvim): code formatting and diagnostics
This commit is contained in:
parent
3fa8821d96
commit
13a3c83138
|
@ -3,28 +3,22 @@ if not status_ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local lsp_formatting = function(bufnr)
|
|
||||||
vim.lsp.buf.format {
|
|
||||||
filter = function(client)
|
|
||||||
return client.name == "null-ls"
|
|
||||||
end,
|
|
||||||
bufnr = bufnr,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
|
||||||
|
|
||||||
local code_actions = null_ls.builtins.code_actions
|
local code_actions = null_ls.builtins.code_actions
|
||||||
local diagnostics = null_ls.builtins.diagnostics
|
local diagnostics = null_ls.builtins.diagnostics
|
||||||
local formatting = null_ls.builtins.formatting
|
local formatting = null_ls.builtins.formatting
|
||||||
|
|
||||||
null_ls.setup {
|
null_ls.setup {
|
||||||
sources = {
|
sources = {
|
||||||
formatting.phpcbf,
|
|
||||||
code_actions.gitsigns,
|
code_actions.gitsigns,
|
||||||
|
|
||||||
formatting.black,
|
formatting.black,
|
||||||
formatting.markdownlint,
|
formatting.markdownlint,
|
||||||
|
formatting.phpcbf.with({
|
||||||
|
command = "./vendor/bin/phpcbf",
|
||||||
|
condition = function(utils)
|
||||||
|
return utils.root_has_file({ 'phpcs.xml.dist' })
|
||||||
|
end,
|
||||||
|
}),
|
||||||
formatting.prettier,
|
formatting.prettier,
|
||||||
formatting.rustywind,
|
formatting.rustywind,
|
||||||
formatting.stylua,
|
formatting.stylua,
|
||||||
|
@ -37,6 +31,7 @@ null_ls.setup {
|
||||||
diagnostics.markdownlint,
|
diagnostics.markdownlint,
|
||||||
diagnostics.php,
|
diagnostics.php,
|
||||||
diagnostics.phpcs.with({
|
diagnostics.phpcs.with({
|
||||||
|
command = "./vendor/bin/phpcs",
|
||||||
condition = function(utils)
|
condition = function(utils)
|
||||||
return utils.root_has_file({ 'phpcs.xml.dist' })
|
return utils.root_has_file({ 'phpcs.xml.dist' })
|
||||||
end,
|
end,
|
||||||
|
|
Reference in a new issue