mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat(blade): added blade support and few changes in php lang
This commit is contained in:
parent
0bbce1775b
commit
7cff0fc263
4 changed files with 84 additions and 2 deletions
59
lua/lazyvim/plugins/extras/lang/blade.lua
Normal file
59
lua/lazyvim/plugins/extras/lang/blade.lua
Normal file
|
|
@ -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" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -23,6 +23,15 @@ return {
|
||||||
servers = {
|
servers = {
|
||||||
phpactor = {
|
phpactor = {
|
||||||
enabled = lsp == "phpactor",
|
enabled = lsp == "phpactor",
|
||||||
|
init_options = {
|
||||||
|
composerJsonPath = "composer.json",
|
||||||
|
enableCache = true,
|
||||||
|
completionProvider = { addUseDeclaration = true },
|
||||||
|
staticAnalysis = true,
|
||||||
|
diagnostics = {
|
||||||
|
missingDocs = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
intelephense = {
|
intelephense = {
|
||||||
enabled = lsp == "intelephense",
|
enabled = lsp == "intelephense",
|
||||||
|
|
@ -40,6 +49,7 @@ return {
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"phpcs",
|
"phpcs",
|
||||||
"php-cs-fixer",
|
"php-cs-fixer",
|
||||||
|
"phpcbf",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -63,7 +73,7 @@ return {
|
||||||
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.formatting.phpcsfixer)
|
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,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -80,7 +90,7 @@ return {
|
||||||
optional = true,
|
optional = true,
|
||||||
opts = {
|
opts = {
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
php = { "php_cs_fixer" },
|
php = { "php_cs_fixer", "phpcbf", "blade-formatter" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
9
queries/blade/highlights.scm
Normal file
9
queries/blade/highlights.scm
Normal file
|
|
@ -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
|
||||||
4
queries/blade/injections.scm
Normal file
4
queries/blade/injections.scm
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
((text) @injection.content
|
||||||
|
(#not-has-ancestor? @injection.content "envoy")
|
||||||
|
(#set! injection.combined)
|
||||||
|
(#set! injection.language php))
|
||||||
Loading…
Add table
Reference in a new issue