summaryrefslogtreecommitdiff
path: root/web/assets/jsx.scm
diff options
context:
space:
mode:
Diffstat (limited to 'web/assets/jsx.scm')
-rw-r--r--web/assets/jsx.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/web/assets/jsx.scm b/web/assets/jsx.scm
new file mode 100644
index 0000000..708eba2
--- /dev/null
+++ b/web/assets/jsx.scm
@@ -0,0 +1,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][^.]*$"))