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

part of https://github.com/zed-industries/zed/issues/9461


Release Notes:
- Added the ability to seperately highlight control flow keywords for
Rust, C and C++ for users and theme authors via the `keyword.control`
syntax property
<img width="805" height="475" alt="スクリーンショット 2025-10-07 22 21 59"
src="https://github.com/user-attachments/assets/40ed03ea-a129-44ce-b6d8-284656b9f3ba"
/>
This commit is contained in:
Hayashi Mikihiro
2025-10-20 13:28:54 +02:00
committed by GitHub
parent 43a9368dff
commit 9a72453a2b
3 changed files with 49 additions and 40 deletions
+14 -11
View File
@@ -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"
+21 -18
View File
@@ -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"
+14 -11
View File
@@ -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)