mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat(blade): update blade parser and queries
This commit is contained in:
parent
4eb12d7a1f
commit
c9e4edc127
5 changed files with 86 additions and 22 deletions
|
|
@ -125,7 +125,7 @@ return {
|
||||||
},
|
},
|
||||||
blade = {
|
blade = {
|
||||||
install_info = {
|
install_info = {
|
||||||
revision = 'fbe5f81b54f0f6153961824ce306ffc805134980',
|
revision = '5dd29dd50fa6c3de0bb5a2d24ec03f99ddb960bf',
|
||||||
url = 'https://github.com/EmranMR/tree-sitter-blade',
|
url = 'https://github.com/EmranMR/tree-sitter-blade',
|
||||||
},
|
},
|
||||||
maintainers = { '@calebdw' },
|
maintainers = { '@calebdw' },
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
; inherits: html
|
||||||
|
|
||||||
[
|
[
|
||||||
(authorization)
|
|
||||||
(conditional)
|
(conditional)
|
||||||
(envoy)
|
(envoy)
|
||||||
(fragment)
|
(fragment)
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
([
|
; inherits: html
|
||||||
|
|
||||||
|
[
|
||||||
(directive)
|
(directive)
|
||||||
(directive_start)
|
(directive_start)
|
||||||
(directive_end)
|
(directive_end)
|
||||||
] @tag
|
] @tag
|
||||||
(#set! priority 101))
|
|
||||||
|
|
||||||
([
|
[
|
||||||
(bracket_start)
|
"{{"
|
||||||
(bracket_end)
|
"}}"
|
||||||
] @tag.delimiter
|
"{!!"
|
||||||
(#set! priority 101))
|
"!!}"
|
||||||
|
"("
|
||||||
((comment) @comment @spell
|
")"
|
||||||
(#set! priority 101))
|
] @punctuation.bracket
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,15 @@
|
||||||
(directive_start) @indent.begin
|
; inherits: html
|
||||||
|
|
||||||
(directive_end) @indent.end
|
[
|
||||||
|
(conditional)
|
||||||
|
(envoy)
|
||||||
|
(fragment)
|
||||||
|
(livewire)
|
||||||
|
(loop)
|
||||||
|
(once)
|
||||||
|
(php_statement)
|
||||||
|
(section)
|
||||||
|
(stack)
|
||||||
|
(switch)
|
||||||
|
(verbatim)
|
||||||
|
] @indent.begin
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,65 @@
|
||||||
((text) @injection.content
|
; inherits: html
|
||||||
(#set! injection.combined)
|
|
||||||
(#set! injection.language html))
|
((php_only) @injection.content
|
||||||
|
(#set! injection.language "php_only"))
|
||||||
|
|
||||||
|
((parameter) @injection.content
|
||||||
|
(#set! injection.include-children)
|
||||||
|
(#set! injection.language "php_only"))
|
||||||
|
|
||||||
((text) @injection.content
|
((text) @injection.content
|
||||||
(#has-ancestor? @injection.content "envoy")
|
(#has-ancestor? @injection.content "envoy")
|
||||||
(#set! injection.combined)
|
(#set! injection.combined)
|
||||||
(#set! injection.language bash))
|
(#set! injection.language bash))
|
||||||
|
|
||||||
((php_only) @injection.content
|
; Livewire attributes
|
||||||
(#set! injection.combined)
|
; <div wire:click="baz++">
|
||||||
(#set! injection.language php_only))
|
(attribute
|
||||||
|
(attribute_name) @_attr
|
||||||
|
(#any-of? @_attr "wire:model" "wire:click" "wire:stream" "wire:text" "wire:show")
|
||||||
|
(quoted_attribute_value
|
||||||
|
(attribute_value) @injection.content)
|
||||||
|
(#set! injection.language "javascript"))
|
||||||
|
|
||||||
((parameter) @injection.content
|
; AlpineJS attributes
|
||||||
(#set! injection.language php_only))
|
; <div x-data="{ foo: 'bar' }" x-init="baz()">
|
||||||
|
(attribute
|
||||||
|
(attribute_name) @_attr
|
||||||
|
(#lua-match? @_attr "^x%-%l+")
|
||||||
|
(#not-any-of? @_attr "x-teleport" "x-ref" "x-transition")
|
||||||
|
(quoted_attribute_value
|
||||||
|
(attribute_value) @injection.content)
|
||||||
|
(#set! injection.language "javascript"))
|
||||||
|
|
||||||
|
(attribute
|
||||||
|
(attribute_name) @_attr
|
||||||
|
(#lua-match? @_attr "^[:@]%l+")
|
||||||
|
(quoted_attribute_value
|
||||||
|
(attribute_value) @injection.content)
|
||||||
|
(#set! injection.language "javascript"))
|
||||||
|
|
||||||
|
; Blade escaped JS attributes
|
||||||
|
; <x-foo ::bar="baz" />
|
||||||
|
(element
|
||||||
|
(_
|
||||||
|
(tag_name) @_tag
|
||||||
|
(#lua-match? @_tag "^x%-%l+")
|
||||||
|
(attribute
|
||||||
|
(attribute_name) @_attr
|
||||||
|
(#lua-match? @_attr "^::%l+")
|
||||||
|
(quoted_attribute_value
|
||||||
|
(attribute_value) @injection.content)
|
||||||
|
(#set! injection.language "javascript"))))
|
||||||
|
|
||||||
|
; Blade PHP attributes
|
||||||
|
; <x-foo :bar="$baz" />
|
||||||
|
(element
|
||||||
|
(_
|
||||||
|
(tag_name) @_tag
|
||||||
|
(#lua-match? @_tag "^x%-%l+")
|
||||||
|
(attribute
|
||||||
|
(attribute_name) @_attr
|
||||||
|
(#lua-match? @_attr "^:%l+")
|
||||||
|
(quoted_attribute_value
|
||||||
|
(attribute_value) @injection.content)
|
||||||
|
(#set! injection.language "php_only"))))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue