Skip to content

Commit 60ec723

Browse files
poliorceticspathwave
authored andcommitted
feat: Categorize Rust's keywords using more specific scopes (helix-editor#4510)
1 parent fc64ffc commit 60ec723

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

runtime/queries/rust/highlights.scm

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,31 @@
111111
; -------
112112

113113
(for_expression
114-
"for" @keyword.control)
114+
"for" @keyword.control.repeat)
115115
((identifier) @keyword.control
116116
(#match? @keyword.control "^yield$"))
117+
118+
"in" @keyword.control
119+
120+
[
121+
"match"
122+
"if"
123+
"else"
124+
] @keyword.control.conditional
125+
117126
[
118127
"while"
119128
"loop"
120-
"in"
129+
] @keyword.control.repeat
130+
131+
[
121132
"break"
122133
"continue"
123134

124-
"match"
125-
"if"
126-
"else"
127135
"return"
128136

129137
"await"
130-
] @keyword.control
138+
] @keyword.control.return
131139

132140
"use" @keyword.control.import
133141
(mod_item "mod" @keyword.control.import !body)
@@ -143,24 +151,28 @@
143151
"mod"
144152
"extern"
145153

146-
"struct"
147-
"enum"
148154
"impl"
149155
"where"
150156
"trait"
151157
"for"
152158

153-
"type"
154-
"union"
155159
"unsafe"
156160
"default"
157161
"macro_rules!"
158162

159-
"let"
160-
161163
"async"
162164
] @keyword
163165

166+
[
167+
"struct"
168+
"enum"
169+
"union"
170+
171+
"type"
172+
] @keyword.storage.type
173+
174+
"let" @keyword.storage
175+
164176
"fn" @keyword.function
165177

166178
(mutable_specifier) @keyword.storage.modifier.mut

0 commit comments

Comments
 (0)