Add experimental support for blade treesitter.

This commit is contained in:
aleidk 2023-11-10 15:59:14 -03:00
parent 6141e5a31f
commit 0404494c8a
5 changed files with 28 additions and 2 deletions

View 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

View file

@ -0,0 +1,3 @@
((php) @injection.content
(#set! injection.combined)
(#set! injection.language php))

View file

@ -70,5 +70,6 @@ vim.filetype.add({
pattern = {
-- INFO: Match filenames like - ".env.example", ".env.local" and so on
["%.env%.[%w_.-]+"] = "dotenv",
[".*%.blade%.php"] = "blade",
},
})

View file

@ -9,6 +9,7 @@ return {
lua = { "stylua" },
python = { "blue" },
-- Use a sub-list to run only the first available formatter
json = { { "prettierd", "prettier" } },
javascript = { { "prettierd", "prettier" } },
typescript = { { "prettierd", "prettier" } },
javascriptreact = { { "prettierd", "prettier" } },
@ -24,7 +25,7 @@ return {
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { timeout_ms = 500, lsp_fallback = true }
return { timeout_ms = 2000, lsp_fallback = true }
end,
},
config = function(_, opts)

View file

@ -93,6 +93,18 @@ return {
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
-- Uncoment this line to disable auto folding on file open
-- vim.cmd("set nofoldenable")
vim.cmd("set nofoldenable")
-- TODO: remove this when blade treesitter is added to nvim-treesitter repo
-- Also remove the "config/nvim/after/queries/blade" folder.
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",
}
end,
}