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(
227227 k if k. is_keyword ( ) => {
228228 let h = Highlight :: new ( HlTag :: Keyword ) ;
229229 match k {
230- T ! [ await ]
231- | T ! [ break ]
230+ T ! [ await ] => h | HlMod :: Async | HlMod :: ControlFlow ,
231+ T ! [ break ]
232232 | T ! [ continue ]
233233 | T ! [ else]
234234 | T ! [ if ]
@@ -255,7 +255,7 @@ pub(super) fn element(
255255 } )
256256 . map ( |modifier| h | modifier)
257257 . unwrap_or ( h) ,
258- T ! [ async ] | T ! [ await ] => h | HlMod :: Async ,
258+ T ! [ async ] => h | HlMod :: Async ,
259259 _ => h,
260260 }
261261 }
Original file line number Diff line number Diff line change 234234 < span class ="variable declaration "> Nope</ span > < span class ="operator "> =></ span > < span class ="variable "> Nope</ span > < span class ="comma "> ,</ span >
235235 < span class ="brace "> }</ span >
236236 < 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 >
237248< span class ="brace "> }</ span > </ code > </ pre >
Original file line number Diff line number Diff line change @@ -208,6 +208,17 @@ impl<T> Option<T> {
208208 }
209209 }
210210}
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+ }
211222"#
212223 . trim ( ) ,
213224 expect_file ! [ "./test_data/highlighting.html" ] ,
You can’t perform that action at this time.
0 commit comments