Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Improve Regex syntax highlighting (#25332)

chbkf4d1e7901cbf
diff --git a/crates/languages/src/regex/highlights.scm b/crates/languages/src/regex/highlights.scm
index 2504dab79ea..3829c3834bc 100644
--- a/crates/languages/src/regex/highlights.scm
+++ b/crates/languages/src/regex/highlights.scm
@@ -4,24 +4,22 @@
"(?"
"(?:"
"(?<"
+ "(?P="
+ "<"
">"
"["
"]"
"{"
"}"
-] @string
+] @punctuation.bracket.regex
-(group_name) @property
+(group_name) @label.regex
[
(identity_escape)
(control_letter_escape)
(character_class_escape)
(control_escape)
- (start_assertion)
- (end_assertion)
- (boundary_assertion)
- (non_boundary_assertion)
] @string.escape
[
@@ -31,17 +29,25 @@
"|"
"="
"!"
+ (start_assertion)
+ (end_assertion)
(any_character)
-] @operator
+] @operator.regex
+
+[
+ (boundary_assertion)
+ (non_boundary_assertion)
+ (backreference_escape)
+] @keyword.operator.regex
(count_quantifier
[
(decimal_digits) @number
- "," @punctuation.delimiter
+ "," @punctuation.delimiter.regex
])
(character_class
[
- "^" @operator
- (class_range "-" @operator)
+ "^" @operator.regex
+ (class_range "-" @operator.regex)
])