File tree Expand file tree Collapse file tree 3 files changed +25
-3
lines changed
crates/ide/src/syntax_highlighting Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -227,8 +227,8 @@ pub(super) fn element(
227
227
k if k. is_keyword ( ) => {
228
228
let h = Highlight :: new ( HlTag :: Keyword ) ;
229
229
match k {
230
- T ! [ await ]
231
- | T ! [ break ]
230
+ T ! [ await ] => h | HlMod :: Async | HlMod :: ControlFlow ,
231
+ T ! [ break ]
232
232
| T ! [ continue ]
233
233
| T ! [ else]
234
234
| T ! [ if ]
@@ -255,7 +255,7 @@ pub(super) fn element(
255
255
} )
256
256
. map ( |modifier| h | modifier)
257
257
. unwrap_or ( h) ,
258
- T ! [ async ] | T ! [ await ] => h | HlMod :: Async ,
258
+ T ! [ async ] => h | HlMod :: Async ,
259
259
_ => h,
260
260
}
261
261
}
Original file line number Diff line number Diff line change 234
234
< span class ="variable declaration "> Nope</ span > < span class ="operator "> =></ span > < span class ="variable "> Nope</ span > < span class ="comma "> ,</ span >
235
235
< span class ="brace "> }</ span >
236
236
< span class ="brace "> }</ span >
237
+ < span class ="brace "> }</ span >
238
+
239
+ < span class ="keyword async "> async</ span > < span class ="keyword "> fn</ span > < span class ="function declaration async "> learn_and_sing</ span > < span class ="parenthesis "> (</ span > < span class ="parenthesis "> )</ span > < span class ="brace "> {</ span >
240
+ < span class ="keyword "> let</ span > < span class ="variable declaration "> song</ span > < span class ="operator "> =</ span > < span class ="unresolved_reference "> learn_song</ span > < span class ="parenthesis "> (</ span > < span class ="parenthesis "> )</ span > < span class ="operator "> .</ span > < span class ="keyword control async "> await</ span > < span class ="semicolon "> ;</ span >
241
+ < span class ="unresolved_reference "> sing_song</ span > < span class ="parenthesis "> (</ span > < span class ="variable consuming "> song</ span > < span class ="parenthesis "> )</ span > < span class ="operator "> .</ span > < span class ="keyword control async "> await</ span > < span class ="semicolon "> ;</ span >
242
+ < span class ="brace "> }</ span >
243
+
244
+ < span class ="keyword async "> async</ span > < span class ="keyword "> fn</ span > < span class ="function declaration async "> async_main</ span > < span class ="parenthesis "> (</ span > < span class ="parenthesis "> )</ span > < span class ="brace "> {</ span >
245
+ < span class ="keyword "> let</ span > < span class ="variable declaration "> f1</ span > < span class ="operator "> =</ span > < span class ="function async "> learn_and_sing</ span > < span class ="parenthesis "> (</ span > < span class ="parenthesis "> )</ span > < span class ="semicolon "> ;</ span >
246
+ < span class ="keyword "> let</ span > < span class ="variable declaration "> f2</ span > < span class ="operator "> =</ span > < span class ="unresolved_reference "> dance</ span > < span class ="parenthesis "> (</ span > < span class ="parenthesis "> )</ span > < span class ="semicolon "> ;</ span >
247
+ futures::< span class ="macro "> join!</ span > < span class ="parenthesis "> (</ span > f1< span class ="comma "> ,</ span > f2< span class ="parenthesis "> )</ span > < span class ="semicolon "> ;</ span >
237
248
< span class ="brace "> }</ span > </ code > </ pre >
Original file line number Diff line number Diff line change @@ -208,6 +208,17 @@ impl<T> Option<T> {
208
208
}
209
209
}
210
210
}
211
+
212
+ async fn learn_and_sing() {
213
+ let song = learn_song().await;
214
+ sing_song(song).await;
215
+ }
216
+
217
+ async fn async_main() {
218
+ let f1 = learn_and_sing();
219
+ let f2 = dance();
220
+ futures::join!(f1, f2);
221
+ }
211
222
"#
212
223
. trim ( ) ,
213
224
expect_file ! [ "./test_data/highlighting.html" ] ,
You can’t perform that action at this time.
0 commit comments