From 4a8d2c098d88da6f36f3cf95f424b471987c5daa Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 9 Jan 2021 16:07:41 +0300 Subject: Better highlight for fixtures --- crates/ide/src/syntax_highlighting/injection.rs | 4 ++++ crates/ide/src/syntax_highlighting/test_data/injection.html | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'crates/ide/src') diff --git a/crates/ide/src/syntax_highlighting/injection.rs b/crates/ide/src/syntax_highlighting/injection.rs index de2180b04..008d5ce24 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 a54d303b4..6703a84e5 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 -- cgit v1.2.3