Add experimental support for blade treesitter.
This commit is contained in:
parent
6141e5a31f
commit
0404494c8a
5 changed files with 28 additions and 2 deletions
9
config/nvim/after/queries/blade/highlights.scm
Normal file
9
config/nvim/after/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
|
||||||
3
config/nvim/after/queries/blade/injections.scm
Normal file
3
config/nvim/after/queries/blade/injections.scm
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
((php) @injection.content
|
||||||
|
(#set! injection.combined)
|
||||||
|
(#set! injection.language php))
|
||||||
|
|
@ -70,5 +70,6 @@ vim.filetype.add({
|
||||||
pattern = {
|
pattern = {
|
||||||
-- INFO: Match filenames like - ".env.example", ".env.local" and so on
|
-- INFO: Match filenames like - ".env.example", ".env.local" and so on
|
||||||
["%.env%.[%w_.-]+"] = "dotenv",
|
["%.env%.[%w_.-]+"] = "dotenv",
|
||||||
|
[".*%.blade%.php"] = "blade",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ return {
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
python = { "blue" },
|
python = { "blue" },
|
||||||
-- Use a sub-list to run only the first available formatter
|
-- Use a sub-list to run only the first available formatter
|
||||||
|
json = { { "prettierd", "prettier" } },
|
||||||
javascript = { { "prettierd", "prettier" } },
|
javascript = { { "prettierd", "prettier" } },
|
||||||
typescript = { { "prettierd", "prettier" } },
|
typescript = { { "prettierd", "prettier" } },
|
||||||
javascriptreact = { { "prettierd", "prettier" } },
|
javascriptreact = { { "prettierd", "prettier" } },
|
||||||
|
|
@ -24,7 +25,7 @@ return {
|
||||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
return { timeout_ms = 500, lsp_fallback = true }
|
return { timeout_ms = 2000, lsp_fallback = true }
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,18 @@ return {
|
||||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||||
|
|
||||||
-- Uncoment this line to disable auto folding on file open
|
-- 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,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue