From f5dc867ac29e31f833442006ebe3daf7540d1f69 Mon Sep 17 00:00:00 2001 From: Muneeb Usmani Date: Tue, 11 Jun 2024 01:01:24 +0500 Subject: [PATCH] fix(php): formatting and linting (#3540) Fixed the issue of php formatting not working in extras.lang.php --- lua/lazyvim/plugins/extras/lang/php.lua | 41 ++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/php.lua b/lua/lazyvim/plugins/extras/lang/php.lua index 334091bb..0cb3a840 100644 --- a/lua/lazyvim/plugins/extras/lang/php.lua +++ b/lua/lazyvim/plugins/extras/lang/php.lua @@ -18,12 +18,23 @@ return { }, }, + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "phpcs", + "php-cs-fixer", + }, + }, + }, { "mfussenegger/nvim-dap", optional = true, dependencies = { "williamboman/mason.nvim", - opts = { ensure_installed = { "php-debug-adapter" } }, + opts = { ensure_installed = { + "php-debug-adapter", + } }, }, opts = function() local dap = require("dap") @@ -35,4 +46,32 @@ return { } end, }, + { + "nvimtools/none-ls.nvim", + optional = true, + opts = function(_, opts) + local nls = require("null-ls") + opts.sources = opts.sources or {} + table.insert(opts.sources, nls.builtins.formatting.phpcsfixer) + table.insert(opts.sources, nls.builtins.diagnostics.phpcs) + end, + }, + { + "mfussenegger/nvim-lint", + optional = true, + opts = { + linters_by_ft = { + php = { "phpcs" }, + }, + }, + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + php = { "php-cs-fixer" }, + }, + }, + }, + }, }