generated from LazyVim/starter
-
Notifications
You must be signed in to change notification settings - Fork 69
/
treesitter.lua
50 lines (49 loc) · 1.33 KB
/
treesitter.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-- add more treesitter parsers
return {
"nvim-treesitter/nvim-treesitter",
build = function()
require("nvim-treesitter.install").update({ with_sync = true })
end,
dependencies = {
{
"JoosepAlviste/nvim-ts-context-commentstring",
opts = {
custom_calculation = function(_, language_tree)
if vim.bo.filetype == "blade" and language_tree._lang ~= "javascript" and language_tree._lang ~= "php" then
return "{{-- %s --}}"
end
end,
},
},
"nvim-treesitter/nvim-treesitter-textobjects",
},
opts = {
ensure_installed = "all",
auto_install = true,
highlight = {
enable = true,
},
-- Needed because treesitter highlight turns off autoindent for php files
indent = {
enable = true,
},
},
config = function(_, opts)
---@class ParserInfo[]
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",
-- 'src/scanner.cc',
},
branch = "main",
generate_requires_npm = true,
requires_generate_from_grammar = true,
},
filetype = "blade",
}
require("nvim-treesitter.configs").setup(opts)
end,
}