Add regex syntax highlighting for JS and TS (#7851)
<img width="544" alt="SCR-20240215-pvzy" src="https://github.com/zed-industries/zed/assets/67913738/e4d463a6-1795-4728-ac24-6c8e03e7ea5b"> Release Notes: - Added support for regex syntax highlighting in `JS` and `TS`.
This commit is contained in:
@@ -1,2 +1,5 @@
|
||||
((comment) @content
|
||||
(#set! "language" "jsdoc"))
|
||||
|
||||
((regex) @content
|
||||
(#set! "language" "regex"))
|
||||
@@ -109,6 +109,7 @@ pub fn init(
|
||||
("purescript", tree_sitter_purescript::language()),
|
||||
("python", tree_sitter_python::language()),
|
||||
("racket", tree_sitter_racket::language()),
|
||||
("regex", tree_sitter_regex::language()),
|
||||
("ruby", tree_sitter_ruby::language()),
|
||||
("rust", tree_sitter_rust::language()),
|
||||
("scheme", tree_sitter_scheme::language()),
|
||||
@@ -318,6 +319,7 @@ pub fn init(
|
||||
);
|
||||
language!("scheme");
|
||||
language!("racket");
|
||||
language!("regex");
|
||||
language!("lua", vec![Arc::new(lua::LuaLspAdapter)]);
|
||||
language!(
|
||||
"yaml",
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
("(" @open ")" @close)
|
||||
("[" @open "]" @close)
|
||||
("{" @open "}" @close)
|
||||
@@ -0,0 +1,8 @@
|
||||
name = "Regex"
|
||||
grammar = "regex"
|
||||
autoclose_before = ")]}"
|
||||
brackets = [
|
||||
{ start = "(", end = ")", close = true, newline = false },
|
||||
{ start = "{", end = "}", close = true, newline = false },
|
||||
{ start = "[", end = "]", close = true, newline = false },
|
||||
]
|
||||
@@ -0,0 +1,50 @@
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"(?"
|
||||
"(?:"
|
||||
"(?<"
|
||||
">"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
(group_name) @property
|
||||
|
||||
[
|
||||
(identity_escape)
|
||||
(control_letter_escape)
|
||||
(character_class_escape)
|
||||
(control_escape)
|
||||
(start_assertion)
|
||||
(end_assertion)
|
||||
(boundary_assertion)
|
||||
(non_boundary_assertion)
|
||||
] @escape
|
||||
|
||||
[
|
||||
"*"
|
||||
"+"
|
||||
"?"
|
||||
"|"
|
||||
"="
|
||||
"!"
|
||||
] @operator
|
||||
|
||||
(count_quantifier
|
||||
[
|
||||
(decimal_digits) @number
|
||||
"," @punctuation.delimiter
|
||||
])
|
||||
|
||||
(character_class
|
||||
[
|
||||
"^" @operator
|
||||
(class_range "-" @operator)
|
||||
])
|
||||
|
||||
(class_character) @constant.character
|
||||
|
||||
(pattern_character) @string
|
||||
@@ -1,2 +1,5 @@
|
||||
((comment) @content
|
||||
(#set! "language" "jsdoc"))
|
||||
|
||||
((regex) @content
|
||||
(#set! "language" "regex"))
|
||||
@@ -1,2 +1,5 @@
|
||||
((comment) @content
|
||||
(#set! "language" "jsdoc"))
|
||||
|
||||
((regex) @content
|
||||
(#set! "language" "regex"))
|
||||
Reference in New Issue
Block a user