on master help sign in
feat: Categorize Rust's keywords using more specific scopes (#4510)
2935e9dPoliorcetics
runtime/queries/rust/highlights.scm+24−12
@@ -111,23 +111,31 @@
111; -------
111; -------
112
112
113(for_expression
113(for_expression
114− "for" @keyword.control)
114+ "for" @keyword.control.repeat)
115((identifier) @keyword.control
115((identifier) @keyword.control
116 (#match? @keyword.control "^yield$"))
116 (#match? @keyword.control "^yield$"))
117+
118+"in" @keyword.control
119+
120+[
121+ "match"
122+ "if"
123+ "else"
124+] @keyword.control.conditional
125+
117[
126[
118 "while"
127 "while"
119 "loop"
128 "loop"
120− "in"
129+] @keyword.control.repeat
130+
131+[
121 "break"
132 "break"
122 "continue"
133 "continue"
123
134
124− "match"
125− "if"
126− "else"
127 "return"
135 "return"
128
136
129 "await"
137 "await"
130−] @keyword.control
138+] @keyword.control.return
131
139
132"use" @keyword.control.import
140"use" @keyword.control.import
133(mod_item "mod" @keyword.control.import !body)
141(mod_item "mod" @keyword.control.import !body)
@@ -143,24 +151,28 @@
143 "mod"
151 "mod"
144 "extern"
152 "extern"
145
153
146− "struct"
147− "enum"
148 "impl"
154 "impl"
149 "where"
155 "where"
150 "trait"
156 "trait"
151 "for"
157 "for"
152
158
153− "type"
154− "union"
155 "unsafe"
159 "unsafe"
156 "default"
160 "default"
157 "macro_rules!"
161 "macro_rules!"
158
162
159− "let"
160−
161 "async"
163 "async"
162] @keyword
164] @keyword
163
165
166+[
167+ "struct"
168+ "enum"
169+ "union"
170+
171+ "type"
172+] @keyword.storage.type
173+
174+"let" @keyword.storage
175+
164"fn" @keyword.function
176"fn" @keyword.function
165
177
166(mutable_specifier) @keyword.storage.modifier.mut
178(mutable_specifier) @keyword.storage.modifier.mut