diff --git a/lua/lazyvim/plugins/extras/lang/twig.lua b/lua/lazyvim/plugins/extras/lang/twig.lua index 16d1e215..bed7873e 100644 --- a/lua/lazyvim/plugins/extras/lang/twig.lua +++ b/lua/lazyvim/plugins/extras/lang/twig.lua @@ -1,43 +1,60 @@ return { - { - 'nvim-treesitter/nvim-treesitter', - opts = { ensure_installed = { 'twig' } }, + recommended = { + ft = "twig", + root = { "composer.json", ".phpactor.json", ".phpactor.yml" }, }, { - 'williamboman/mason.nvim', + "nvim-treesitter/nvim-treesitter", + opts = { ensure_installed = { "twig" } }, + }, + { + "williamboman/mason.nvim", opts = { ensure_installed = { - 'twiggy-language-server', - 'twigcs', - 'twig-cs-fixer', + "twiggy-language-server", + "twigcs", + "twig-cs-fixer", }, }, }, { - 'nvimtools/none-ls.nvim', + "neovim/nvim-lspconfig", + opts = { + servers = { + ["twiggy-language-server"] = { + enabled = true, + }, + lsp = { + enabled = true, + }, + }, + }, + }, + { + "nvimtools/none-ls.nvim", optional = true, opts = function(_, opts) - local nls = require('null-ls') + local nls = require("null-ls") opts.sources = opts.sources or {} table.insert(opts.sources, nls.builtins.diagnostics.twigcs) -- Twig-CS-Fixer builtin not available in none-ls end, }, { - 'mfussenegger/nvim-lint', + "mfussenegger/nvim-lint", optional = true, opts = { linters_by_ft = { - twig = { 'twigcs' }, + twig = { "twigcs" }, }, }, }, { - 'stevearc/conform.nvim', + "stevearc/conform.nvim", optional = true, opts = { formatters_by_ft = { - twig = { 'twig-cs-fixer' }, + twig = { "twig-cs-fixer" }, }, }, },