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
|
||||
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 diagnostics = null_ls.builtins.diagnostics
|
||||
local formatting = null_ls.builtins.formatting
|
||||
|
||||
null_ls.setup {
|
||||
sources = {
|
||||
formatting.phpcbf,
|
||||
code_actions.gitsigns,
|
||||
|
||||
formatting.black,
|
||||
formatting.markdownlint,
|
||||
formatting.phpcbf.with({
|
||||
command = "./vendor/bin/phpcbf",
|
||||
condition = function(utils)
|
||||
return utils.root_has_file({ 'phpcs.xml.dist' })
|
||||
end,
|
||||
}),
|
||||
formatting.prettier,
|
||||
formatting.rustywind,
|
||||
formatting.stylua,
|
||||
|
@ -37,6 +31,7 @@ null_ls.setup {
|
|||
diagnostics.markdownlint,
|
||||
diagnostics.php,
|
||||
diagnostics.phpcs.with({
|
||||
command = "./vendor/bin/phpcs",
|
||||
condition = function(utils)
|
||||
return utils.root_has_file({ 'phpcs.xml.dist' })
|
||||
end,
|
||||
|
|
Reference in a new issue