From: Aleksey Kladov Date: Sat, 9 Jan 2021 13:07:41 +0000 (+0300) Subject: Better highlight for fixtures X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=4a8d2c098d88da6f36f3cf95f424b471987c5daa;p=rust.git Better highlight for fixtures --- diff --git a/crates/ide/src/syntax_highlighting/injection.rs b/crates/ide/src/syntax_highlighting/injection.rs index de2180b047c..008d5ce244d 100644 --- a/crates/ide/src/syntax_highlighting/injection.rs +++ b/crates/ide/src/syntax_highlighting/injection.rs @@ -42,6 +42,10 @@ pub(super) fn highlight_injection( offset += TextSize::of(chunk); if let Some(next) = text.strip_prefix(marker) { + if let Some(range) = literal.map_range_up(TextRange::at(offset, TextSize::of(marker))) { + hl.add(HlRange { range, highlight: HlTag::Keyword.into(), binding_hash: None }); + } + text = next; let marker_len = TextSize::of(marker); diff --git a/crates/ide/src/syntax_highlighting/test_data/injection.html b/crates/ide/src/syntax_highlighting/test_data/injection.html index a54d303b464..6703a84e5db 100644 --- a/crates/ide/src/syntax_highlighting/test_data/injection.html +++ b/crates/ide/src/syntax_highlighting/test_data/injection.html @@ -40,9 +40,9 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd fn main() { f(r" fn foo() { - foo($0{ + foo($0{ 92 - }$0) + }$0) }"); } \ No newline at end of file