Improve Regex syntax highlighting (#25332)
Release Notes: - Improved Regex syntax highlighting | Zed 0.174.6 | With this PR | | --- | --- | |  |  | - `(?P=`, `<`: `punctuation.bracket` - `group_name`: `property` -> `label` - `^`, `$`: `string.escape` -> `operator` - `\b`, `\B`, `\k`: `string.escape` -> `keyword.operator` - added `regex` scope to target regex tokens specifically ```js regex = /^(?<group>[!\.\?])\b[a-z]+word\k<group>$/g ``` --------- Co-authored-by: João Marcos <marcospb19@hotmail.com>
This commit is contained in:
parent
044eb7b990
commit
f4d1e7901c
1 changed files with 16 additions and 10 deletions
|
@ -4,24 +4,22 @@
|
||||||
"(?"
|
"(?"
|
||||||
"(?:"
|
"(?:"
|
||||||
"(?<"
|
"(?<"
|
||||||
|
"(?P="
|
||||||
|
"<"
|
||||||
">"
|
">"
|
||||||
"["
|
"["
|
||||||
"]"
|
"]"
|
||||||
"{"
|
"{"
|
||||||
"}"
|
"}"
|
||||||
] @string
|
] @punctuation.bracket.regex
|
||||||
|
|
||||||
(group_name) @property
|
(group_name) @label.regex
|
||||||
|
|
||||||
[
|
[
|
||||||
(identity_escape)
|
(identity_escape)
|
||||||
(control_letter_escape)
|
(control_letter_escape)
|
||||||
(character_class_escape)
|
(character_class_escape)
|
||||||
(control_escape)
|
(control_escape)
|
||||||
(start_assertion)
|
|
||||||
(end_assertion)
|
|
||||||
(boundary_assertion)
|
|
||||||
(non_boundary_assertion)
|
|
||||||
] @string.escape
|
] @string.escape
|
||||||
|
|
||||||
[
|
[
|
||||||
|
@ -31,17 +29,25 @@
|
||||||
"|"
|
"|"
|
||||||
"="
|
"="
|
||||||
"!"
|
"!"
|
||||||
|
(start_assertion)
|
||||||
|
(end_assertion)
|
||||||
(any_character)
|
(any_character)
|
||||||
] @operator
|
] @operator.regex
|
||||||
|
|
||||||
|
[
|
||||||
|
(boundary_assertion)
|
||||||
|
(non_boundary_assertion)
|
||||||
|
(backreference_escape)
|
||||||
|
] @keyword.operator.regex
|
||||||
|
|
||||||
(count_quantifier
|
(count_quantifier
|
||||||
[
|
[
|
||||||
(decimal_digits) @number
|
(decimal_digits) @number
|
||||||
"," @punctuation.delimiter
|
"," @punctuation.delimiter.regex
|
||||||
])
|
])
|
||||||
|
|
||||||
(character_class
|
(character_class
|
||||||
[
|
[
|
||||||
"^" @operator
|
"^" @operator.regex
|
||||||
(class_range "-" @operator)
|
(class_range "-" @operator.regex)
|
||||||
])
|
])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue