This commit is contained in:
Ray Elliott 2022-07-06 17:14:39 +01:00
parent 7434003b37
commit 82932b8223
1 changed files with 24 additions and 20 deletions

View File

@ -151,7 +151,8 @@ require'lspconfig'.sumneko_lua.setup {
local null_ls = require("null-ls") local null_ls = require("null-ls")
local sources = { local sources = {
null_ls.builtins.formatting.prettierd, -- phpcs - standards wordpress null_ls.builtins.formatting.prettierd, --
-- phpcs - standards wordpress
-- in project directory must -- in project directory must
-- composer require friendsofphp/php-cs-fixer -- composer require friendsofphp/php-cs-fixer
-- as in https://github.com/FriendsOfPHP/PHP-CS-Fixer -- as in https://github.com/FriendsOfPHP/PHP-CS-Fixer
@ -162,30 +163,33 @@ local sources = {
end, end,
command = "vendor/bin/phpcs", command = "vendor/bin/phpcs",
args = {"--standard=WordPress", "--report=json", "-s", "-"} args = {"--standard=WordPress", "--report=json", "-s", "-"}
}), -- phpcbf - standards wordpress }), --
null_ls.builtins.formatting.phpcbf.with({ -- phpcbf - standards wordpress
condition = function(utils) -- null_ls.builtins.formatting.phpcbf.with({
return utils.root_has_file({"vendor/bin/phpcbf"}) -- condition = function(utils)
end, -- return utils.root_has_file({"vendor/bin/phpcbf"})
command = "vendor/bin/phpcbf", -- end,
args = {"--standard=WordPress", "-"} -- command = "vendor/bin/phpcbf",
}), -- phpcs -- args = {"--standard=WordPress", "-"}
-- }), --
-- phpcs
null_ls.builtins.diagnostics.phpcs.with({ null_ls.builtins.diagnostics.phpcs.with({
condition = function(utils) condition = function(utils)
return not utils.root_has_file({"vendor/bin/phpcs"}) return not utils.root_has_file({"vendor/bin/phpcs"})
end, end,
args = {"--standard=PSR12", "--report=json", "-s", "-"} args = {"--standard=PSR12", "--report=json", "-s", "-"}
}), -- phpcbf }), --
null_ls.builtins.formatting.phpcbf.with({ -- phpcbf
condition = function(utils) -- null_ls.builtins.formatting.phpcbf.with({
return not utils.root_has_file({"vendor/bin/phpcbf"}) -- condition = function(utils)
end, -- return not utils.root_has_file({"vendor/bin/phpcbf"})
args = {"--standard=PSR12", "--report=json", "-s", "-"} -- end,
}), -- black -- args = {"--standard=PSR12", "--report=json", "-s", "-"}
null_ls.builtins.formatting.black, -- shellcheck, -- }),
null_ls.builtins.diagnostics.shellcheck, -- flake8 null_ls.builtins.formatting.black, -- black
null_ls.builtins.diagnostics.flake8, -- luaFormatter null_ls.builtins.diagnostics.shellcheck, -- shellcheck,
null_ls.builtins.formatting.lua_format null_ls.builtins.diagnostics.flake8, -- flake8
null_ls.builtins.formatting.lua_format -- luaFormatter
} }
null_ls.setup({sources = sources, on_attach = on_attach}) null_ls.setup({sources = sources, on_attach = on_attach})