summaryrefslogtreecommitdiff
path: root/runtime/queries/jsx/highlights.scm
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/queries/jsx/highlights.scm')
-rw-r--r--runtime/queries/jsx/highlights.scm27
1 files changed, 27 insertions, 0 deletions
diff --git a/runtime/queries/jsx/highlights.scm b/runtime/queries/jsx/highlights.scm
new file mode 100644
index 00000000..9be5f517
--- /dev/null
+++ b/runtime/queries/jsx/highlights.scm
@@ -0,0 +1,27 @@
+; inherits: javascript
+
+; Highlight component names differently
+(jsx_opening_element ((identifier) @constructor
+ (#match? @constructor "^[A-Z]")))
+
+; Handle the dot operator effectively - <My.Component>
+(jsx_opening_element ((nested_identifier (identifier) @tag (identifier) @constructor)))
+
+(jsx_closing_element ((identifier) @constructor
+ (#match? @constructor "^[A-Z]")))
+
+; Handle the dot operator effectively - </My.Component>
+(jsx_closing_element ((nested_identifier (identifier) @tag (identifier) @constructor)))
+
+(jsx_self_closing_element ((identifier) @constructor
+ (#match? @constructor "^[A-Z]")))
+
+; Handle the dot operator effectively - <My.Component />
+(jsx_self_closing_element ((nested_identifier (identifier) @tag (identifier) @constructor)))
+
+; TODO: also tag @punctuation.delimiter?
+
+(jsx_opening_element (identifier) @tag)
+(jsx_closing_element (identifier) @tag)
+(jsx_self_closing_element (identifier) @tag)
+(jsx_attribute (property_identifier) @variable.other.member)