From 607b426e269b17f4ad32dca9c612c4a9f8541766 Mon Sep 17 00:00:00 2001 From: Gammut Date: Sun, 9 Jul 2023 11:35:32 -0500 Subject: Refactor queries for ecma based languages (#7207) --- runtime/queries/_jsx/highlights.scm | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 runtime/queries/_jsx/highlights.scm (limited to 'runtime/queries/_jsx/highlights.scm') diff --git a/runtime/queries/_jsx/highlights.scm b/runtime/queries/_jsx/highlights.scm new file mode 100644 index 00000000..00641cde --- /dev/null +++ b/runtime/queries/_jsx/highlights.scm @@ -0,0 +1,55 @@ +; Opening elements +; ---------------- + +(jsx_opening_element ((identifier) @constructor + (#match? @constructor "^[A-Z]"))) + +; Handle the dot operator effectively - +(jsx_opening_element ((nested_identifier (identifier) @tag (identifier) @constructor))) + +(jsx_opening_element (identifier) @tag) + +; Closing elements +; ---------------- + +(jsx_closing_element ((identifier) @constructor + (#match? @constructor "^[A-Z]"))) + +; Handle the dot operator effectively - +(jsx_closing_element ((nested_identifier (identifier) @tag (identifier) @constructor))) + +(jsx_closing_element (identifier) @tag) + +; Self-closing elements +; --------------------- + +(jsx_self_closing_element ((identifier) @constructor + (#match? @constructor "^[A-Z]"))) + +; Handle the dot operator effectively - +(jsx_self_closing_element ((nested_identifier (identifier) @tag (identifier) @constructor))) + +(jsx_self_closing_element (identifier) @tag) + +; Attributes +; ---------- + +(jsx_attribute (property_identifier) @variable.other.member) + +; Punctuation +; ----------- + +; Handle attribute delimiter +(jsx_attribute "=" @punctuation.delimiter) + +; +(jsx_opening_element ["<" ">"] @punctuation.bracket) + +; +(jsx_closing_element ["<" "/" ">"] @punctuation.bracket) + +; +(jsx_self_closing_element ["<" "/" ">"] @punctuation.bracket) + +; <> ... +(jsx_fragment ["<" "/" ">"] @punctuation.bracket) -- cgit v1.2.3-70-g09d2