2023-07-09 18:35:32 +02:00
|
|
|
; Opening elements
|
|
|
|
; ----------------
|
|
|
|
|
|
|
|
(jsx_opening_element ((identifier) @constructor
|
|
|
|
(#match? @constructor "^[A-Z]")))
|
|
|
|
|
|
|
|
(jsx_opening_element (identifier) @tag)
|
|
|
|
|
|
|
|
; Closing elements
|
|
|
|
; ----------------
|
|
|
|
|
|
|
|
(jsx_closing_element ((identifier) @constructor
|
|
|
|
(#match? @constructor "^[A-Z]")))
|
|
|
|
|
|
|
|
(jsx_closing_element (identifier) @tag)
|
|
|
|
|
|
|
|
; Self-closing elements
|
|
|
|
; ---------------------
|
|
|
|
|
|
|
|
(jsx_self_closing_element ((identifier) @constructor
|
|
|
|
(#match? @constructor "^[A-Z]")))
|
|
|
|
|
|
|
|
(jsx_self_closing_element (identifier) @tag)
|
|
|
|
|
|
|
|
; Attributes
|
|
|
|
; ----------
|
|
|
|
|
|
|
|
(jsx_attribute (property_identifier) @variable.other.member)
|
|
|
|
|
|
|
|
; Punctuation
|
|
|
|
; -----------
|
|
|
|
|
2023-08-07 21:07:56 +02:00
|
|
|
; Handle attribute delimiter (<Component color="red"/>)
|
2023-07-09 18:35:32 +02:00
|
|
|
(jsx_attribute "=" @punctuation.delimiter)
|
|
|
|
|
|
|
|
; <Component>
|
|
|
|
(jsx_opening_element ["<" ">"] @punctuation.bracket)
|
|
|
|
|
|
|
|
; </Component>
|
2023-08-07 21:07:56 +02:00
|
|
|
(jsx_closing_element ["</" ">"] @punctuation.bracket)
|
2023-07-09 18:35:32 +02:00
|
|
|
|
|
|
|
; <Component />
|
2023-08-07 21:07:56 +02:00
|
|
|
(jsx_self_closing_element ["<" "/>"] @punctuation.braket)
|