diff --git a/lua/lazyvim/plugins/extras/lang/blade.lua b/lua/lazyvim/plugins/extras/lang/blade.lua new file mode 100644 index 00000000..8ad7dd4b --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/blade.lua @@ -0,0 +1,59 @@ +return { + recommended = { + ft = "blade", + root = { "composer.json", "artisan" }, + }, + { + "nvim-tressiter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "blade", "php" }) + end + + local parser_config = require("nvim-treesitter.parsers").get_parser_configs() + parser_config.blade = { + install_info = { + url = "https://github.com/EmranMR/tree-sitter-blade", + files = { "src/parser.c" }, + branch = "main", + }, + filetype = "blade", + } + + vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, { + pattern = { "*.blade.php" }, + callback = function() + vim.treesitter.start(nil, "blade") + vim.opt.filetype = "blade" + end, + }) + end, + }, + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "tlint", + "blade-formatter", + }, + }, + }, + { + "mfussenegger/nvim-lint", + optional = true, + opts = { + linters_by_ft = { + blade = { "tlint" }, + }, + }, + }, + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + blade = { "blade-formatter" }, + }, + }, + }, +} diff --git a/lua/lazyvim/plugins/extras/lang/php.lua b/lua/lazyvim/plugins/extras/lang/php.lua index 70814eae..6ee78f87 100644 --- a/lua/lazyvim/plugins/extras/lang/php.lua +++ b/lua/lazyvim/plugins/extras/lang/php.lua @@ -23,6 +23,15 @@ return { servers = { phpactor = { enabled = lsp == "phpactor", + init_options = { + composerJsonPath = "composer.json", + enableCache = true, + completionProvider = { addUseDeclaration = true }, + staticAnalysis = true, + diagnostics = { + missingDocs = false, + }, + }, }, intelephense = { enabled = lsp == "intelephense", @@ -40,6 +49,7 @@ return { ensure_installed = { "phpcs", "php-cs-fixer", + "phpcbf", }, }, }, @@ -63,7 +73,7 @@ return { 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) + table.insert(opts.sources, nls.builtins.formatting.phpcbf) end, }, { @@ -80,7 +90,7 @@ return { optional = true, opts = { formatters_by_ft = { - php = { "php_cs_fixer" }, + php = { "php_cs_fixer", "phpcbf", "blade-formatter" }, }, }, }, diff --git a/queries/blade/highlights.scm b/queries/blade/highlights.scm new file mode 100644 index 00000000..9edc25f6 --- /dev/null +++ b/queries/blade/highlights.scm @@ -0,0 +1,9 @@ +(directive) @function +(directive_start) @function +(directive_end) @function +(comment) @comment +((parameter) @include (#set! "priority" 110)) +((php_only) @include (#set! "priority" 110)) +((bracket_start) @function (#set! "priority" 120)) +((bracket_end) @function (#set! "priority" 120)) +(keyword) @function diff --git a/queries/blade/injections.scm b/queries/blade/injections.scm new file mode 100644 index 00000000..8f7af786 --- /dev/null +++ b/queries/blade/injections.scm @@ -0,0 +1,4 @@ +((text) @injection.content + (#not-has-ancestor? @injection.content "envoy") + (#set! injection.combined) + (#set! injection.language php))