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.

Highlight control flow in Rust/C/C++ (#39683)

Hayashi Mikihiro9a72453a2b54
diff --git a/crates/languages/src/c/highlights.scm b/crates/languages/src/c/highlights.scm
index b80c462ae6d..40e0d7147e9 100644
--- a/crates/languages/src/c/highlights.scm
+++ b/crates/languages/src/c/highlights.scm
@@ -1,27 +1,30 @@
+[
+ "const"
+ "enum"
+ "extern"
+ "inline"
+ "sizeof"
+ "static"
+ "struct"
+ "typedef"
+ "union"
+ "volatile"
+] @keyword
+
[
"break"
"case"
- "const"
"continue"
"default"
"do"
"else"
- "enum"
- "extern"
"for"
"goto"
"if"
- "inline"
"return"
- "sizeof"
- "static"
- "struct"
"switch"
- "typedef"
- "union"
- "volatile"
"while"
-] @keyword
+] @keyword.control
[
"#define"
diff --git a/crates/languages/src/cpp/highlights.scm b/crates/languages/src/cpp/highlights.scm
index bd988445bb1..af906e67122 100644
--- a/crates/languages/src/cpp/highlights.scm
+++ b/crates/languages/src/cpp/highlights.scm
@@ -106,32 +106,19 @@ type: (primitive_type) @type.builtin
[
"alignas"
"alignof"
- "break"
- "case"
- "catch"
"class"
- "co_await"
- "co_return"
- "co_yield"
"concept"
"consteval"
"constexpr"
"constinit"
- "continue"
"decltype"
- "default"
"delete"
- "do"
- "else"
"enum"
"explicit"
"export"
"extern"
"final"
- "for"
"friend"
- "goto"
- "if"
"import"
"inline"
"module"
@@ -144,24 +131,40 @@ type: (primitive_type) @type.builtin
"protected"
"public"
"requires"
- "return"
"sizeof"
"struct"
- "switch"
"template"
"thread_local"
- "throw"
- "try"
"typedef"
"typename"
"union"
"using"
"virtual"
- "while"
(storage_class_specifier)
(type_qualifier)
] @keyword
+[
+ "break"
+ "case"
+ "catch"
+ "co_await"
+ "co_return"
+ "co_yield"
+ "continue"
+ "default"
+ "do"
+ "else"
+ "for"
+ "goto"
+ "if"
+ "return"
+ "switch"
+ "throw"
+ "try"
+ "while"
+] @keyword.control
+
[
"#define"
"#elif"
diff --git a/crates/languages/src/rust/highlights.scm b/crates/languages/src/rust/highlights.scm
index b0daac71a09..36f638e825b 100644
--- a/crates/languages/src/rust/highlights.scm
+++ b/crates/languages/src/rust/highlights.scm
@@ -83,29 +83,20 @@
"as"
"async"
"await"
- "break"
"const"
- "continue"
"default"
"dyn"
- "else"
"enum"
"extern"
"fn"
- "for"
- "if"
"impl"
- "in"
"let"
- "loop"
"macro_rules!"
- "match"
"mod"
"move"
"pub"
"raw"
"ref"
- "return"
"static"
"struct"
"trait"
@@ -114,13 +105,25 @@
"unsafe"
"use"
"where"
- "while"
- "yield"
(crate)
(mutable_specifier)
(super)
] @keyword
+[
+ "break"
+ "continue"
+ "else"
+ "for"
+ "if"
+ "in"
+ "loop"
+ "match"
+ "return"
+ "while"
+ "yield"
+] @keyword.control
+
[
(string_literal)
(raw_string_literal)