fix(nvim): code formatting and diagnostics

This commit is contained in:
Oliver Davies 2023-06-21 08:47:05 +01:00
parent 3fa8821d96
commit 13a3c83138

View file

@ -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,