From 765ccf2eca2c21af4e2d76b006809446d0034bc7 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Fri, 14 May 2021 17:30:00 +0800 Subject: Address comments --- crates/ide/src/syntax_highlighting/highlight.rs | 6 +++--- .../ide/src/syntax_highlighting/test_data/highlighting.html | 11 +++++++++++ crates/ide/src/syntax_highlighting/tests.rs | 11 +++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index bea506544..baed8e217 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs @@ -227,8 +227,8 @@ pub(super) fn element( k if k.is_keyword() => { let h = Highlight::new(HlTag::Keyword); match k { - T![await] - | T![break] + T![await] => h | HlMod::Async | HlMod::ControlFlow, + T![break] | T![continue] | T![else] | T![if] @@ -255,7 +255,7 @@ pub(super) fn element( }) .map(|modifier| h | modifier) .unwrap_or(h), - T![async] | T![await] => h | HlMod::Async, + T![async] => h | HlMod::Async, _ => h, } } diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index df4192194..33bc6b0f3 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html @@ -234,4 +234,15 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd Nope => Nope, } } +} + +async fn learn_and_sing() { + let song = learn_song().await; + sing_song(song).await; +} + +async fn async_main() { + let f1 = learn_and_sing(); + let f2 = dance(); + futures::join!(f1, f2); } \ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs index b6e952b08..32f2d9038 100644 --- a/crates/ide/src/syntax_highlighting/tests.rs +++ b/crates/ide/src/syntax_highlighting/tests.rs @@ -208,6 +208,17 @@ impl Option { } } } + +async fn learn_and_sing() { + let song = learn_song().await; + sing_song(song).await; +} + +async fn async_main() { + let f1 = learn_and_sing(); + let f2 = dance(); + futures::join!(f1, f2); +} "# .trim(), expect_file!["./test_data/highlighting.html"], -- cgit v1.2.3