Skip to content

Commit

Permalink
fix(nvim): nvim 0.10, update nvim-ts-autotag, add blade TS parser
Browse files Browse the repository at this point in the history
  • Loading branch information
codepuncher committed May 20, 2024
1 parent 8609beb commit 7e75253
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 12 deletions.
9 changes: 9 additions & 0 deletions nvim/after/queries/blade/highlights.scm
Original file line number Diff line number Diff line change
@@ -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 changes: 4 additions & 0 deletions nvim/after/queries/blade/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
((text) @injection.content
(#not-has-ancestor? @injection.content "envoy")
(#set! injection.combined)
(#set! injection.language php))
4 changes: 3 additions & 1 deletion nvim/ftdetect/blade.vim
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
au BufRead,BufNewFile *.blade.php set filetype=blade
augroup BladeFiltypeRelated
au BufRead,BufNewFile *.blade.php set filetype=blade
augroup END
6 changes: 5 additions & 1 deletion nvim/lua/plugins/configs/nvim-ts-autotag.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ if not _plugin then
end

plugin.setup({
enable = true,
opts = {
enable_close = true,
enable_rename = true,
enable_close_on_slash = true,
},
filetypes = {
'blade', --Not working
'html',
Expand Down
30 changes: 20 additions & 10 deletions nvim/lua/plugins/configs/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ if not _plugin then
end

plugin.setup({
autotag = {
enable = true,
},
highlight = {
enable = true,
disable = {},
Expand Down Expand Up @@ -36,10 +33,12 @@ plugin.setup({
},
ensure_installed = {
'bash',
'blade',
'css',
'go',
'html',
'hurl',
'hurl',
'javascript',
'jsdoc',
'json',
Expand All @@ -60,19 +59,30 @@ plugin.setup({
},
})

local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
parser_config.hurl = {
install_info = {
url = "~/Code/misc/tree-sitter-hurl", -- or your own path, i.e. where you cloned the repository
files = { "src/parser.c" },
branch = "main",
url = '~/Code/misc/tree-sitter-hurl', -- or your own path, i.e. where you cloned the repository
files = { 'src/parser.c' },
branch = 'main',
generate_requires_npm = false,
requires_generate_from_grammar = false,
},
filetype = "hurl",
filetype = 'hurl',
}

parser_config.blade = {
install_info = {
url = 'https://github.com/EmranMR/tree-sitter-blade',
files = { 'src/parser.c' },
branch = 'main',
},
filetype = 'blade',
}

vim.filetype.add({
extension = {
hurl = "hurl"
}
hurl = 'hurl',
blade = 'blade',
},
})

0 comments on commit 7e75253

Please sign in to comment.