Debian Codegraph @

runtime/queries/blade/injections.scm

raw symbols SCIP
1 ; inherits: html
2
3 ; tree-sitter-comment injection
4 ; if available
5 ((comment) @injection.content
6 (#set! injection.language "comment"))
7
8 ((php_only) @injection.content
9 (#set! injection.language "php-only"))
10
11 ((parameter) @injection.content
12 (#set! injection.include-children) ; You may need this, depending on your editor e.g Helix
13 (#set! injection.language "php-only"))
14
15 ; ; Livewire attributes
16 (attribute
17 (attribute_name) @_attr
18 (#any-of? @_attr
19 "wire:click"
20 "wire:submit"
21 "wire:model"
22 "wire:loading"
23 "wire:navigate"
24 "wire:current"
25 "wire:cloak"
26 "wire:dirty"
27 "wire:confirm"
28 "wire:transition"
29 "wire:init"
30 "wire:poll"
31 "wire:offline"
32 "wire:ignore"
33 "wire:replace"
34 "wire:show"
35 "wire:stream"
36 "wire:text"
37 )
38 (quoted_attribute_value
39 (attribute_value) @injection.content)
40 (#set! injection.language "javascript"))
41
42 ; ; See #33
43 ; ; AlpineJS attributes
44 (attribute
45 (attribute_name) @_attr
46 (#match? @_attr "^x-[a-z]+")
47 (quoted_attribute_value
48 (attribute_value) @injection.content)
49 (#set! injection.language "javascript"))
50
51 ; ; Apline Events
52 (attribute
53 (attribute_name) @_attr
54 (#match? @_attr "^@[a-z]+")
55 (quoted_attribute_value
56 (attribute_value) @injection.content)
57 (#set! injection.language "javascript"))
58
59 ; ; normal HTML element alpine attributes
60 (element
61 (_
62 (tag_name) @_tag
63 (#match? @_tag "[^x][^-]")
64 (attribute
65 (attribute_name) @_attr
66 (#match? @_attr "^:[a-z]+")
67 (quoted_attribute_value
68 (attribute_value) @injection.content)
69 (#set! injection.combined)
70 (#set! injection.language "javascript"))))
71
72 ; ; ; Blade escaped JS attributes
73 ; ; <x-foo ::bar="baz" />
74 (element
75 (_
76 (tag_name) @_tag
77 (#match? @_tag "^x-[a-z]+")
78 (attribute
79 (attribute_name) @_attr
80 (#match? @_attr "^::[a-z]+")
81 (quoted_attribute_value
82 (attribute_value) @injection.content)
83 (#set! injection.language "javascript"))))
84
85
86 ; ; ; Blade escaped JS attributes
87 ; ; <htmlTag :class="baz" />
88 (element
89 (_
90 (attribute_name) @_attr
91 (#match? @_attr "^:[a-z]+")
92 (quoted_attribute_value
93 (attribute_value) @injection.content)
94 (#set! injection.language "javascript")))
95
96
97 ; Blade PHP attributes
98 (element
99 (_
100 (tag_name) @_tag
101 (#match? @_tag "^x-[a-z]+")
102 (attribute
103 (attribute_name) @_attr
104 (#match? @_attr "^:[a-z]+")
105 (quoted_attribute_value
106 (attribute_value) @injection.content)
107 (#set! injection.language "php-only"))))
108