summaryrefslogtreecommitdiff
path: root/web/assets/jsx.scm
blob: 708eba295933af15e22064a154dee2c1ca34d53e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
; JSX highlights, from tree-sitter/tree-sitter-javascript v0.25.0
; queries/highlights-jsx.scm (MIT), verbatim but for the capture rename.
; Loaded last for .jsx and .tsx; the plain typescript grammar has no JSX nodes,
; so .ts must not get this file.

(jsx_opening_element ["<" ">"] @punctuation.bracket)
(jsx_closing_element ["</" ">"] @punctuation.bracket)
(jsx_self_closing_element ["<" "/>"] @punctuation.bracket)

(jsx_attribute (property_identifier) @attribute)

; lowercase names are html elements, capitalized ones are components and keep
; the @constructor javascript.scm gave them
((jsx_opening_element (identifier) @tag) (#match? @tag "^[a-z][^.]*$"))
((jsx_closing_element (identifier) @tag) (#match? @tag "^[a-z][^.]*$"))
((jsx_self_closing_element (identifier) @tag) (#match? @tag "^[a-z][^.]*$"))