fix(twig): respect stylua standards, add recommended section, setup lspconfig

This commit is contained in:
tw 2025-01-24 14:37:58 +01:00
parent f7905adec6
commit 31f2bfd0d1

View file

@ -1,43 +1,60 @@
return { return {
{ recommended = {
'nvim-treesitter/nvim-treesitter', ft = "twig",
opts = { ensure_installed = { 'twig' } }, root = { "composer.json", ".phpactor.json", ".phpactor.yml" },
}, },
{ {
'williamboman/mason.nvim', "nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "twig" } },
},
{
"williamboman/mason.nvim",
opts = { opts = {
ensure_installed = { ensure_installed = {
'twiggy-language-server', "twiggy-language-server",
'twigcs', "twigcs",
'twig-cs-fixer', "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, optional = true,
opts = function(_, opts) opts = function(_, opts)
local nls = require('null-ls') local nls = require("null-ls")
opts.sources = opts.sources or {} opts.sources = opts.sources or {}
table.insert(opts.sources, nls.builtins.diagnostics.twigcs) table.insert(opts.sources, nls.builtins.diagnostics.twigcs)
-- Twig-CS-Fixer builtin not available in none-ls -- Twig-CS-Fixer builtin not available in none-ls
end, end,
}, },
{ {
'mfussenegger/nvim-lint', "mfussenegger/nvim-lint",
optional = true, optional = true,
opts = { opts = {
linters_by_ft = { linters_by_ft = {
twig = { 'twigcs' }, twig = { "twigcs" },
}, },
}, },
}, },
{ {
'stevearc/conform.nvim', "stevearc/conform.nvim",
optional = true, optional = true,
opts = { opts = {
formatters_by_ft = { formatters_by_ft = {
twig = { 'twig-cs-fixer' }, twig = { "twig-cs-fixer" },
}, },
}, },
}, },