diff options
Diffstat (limited to 'crates/ide/src/syntax_highlighting')
-rw-r--r-- | crates/ide/src/syntax_highlighting/injection.rs | 4 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting/test_data/injection.html | 4 |
2 files changed, 6 insertions, 2 deletions
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( | |||
42 | offset += TextSize::of(chunk); | 42 | offset += TextSize::of(chunk); |
43 | 43 | ||
44 | if let Some(next) = text.strip_prefix(marker) { | 44 | if let Some(next) = text.strip_prefix(marker) { |
45 | if let Some(range) = literal.map_range_up(TextRange::at(offset, TextSize::of(marker))) { | ||
46 | hl.add(HlRange { range, highlight: HlTag::Keyword.into(), binding_hash: None }); | ||
47 | } | ||
48 | |||
45 | text = next; | 49 | text = next; |
46 | 50 | ||
47 | let marker_len = TextSize::of(marker); | 51 | 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 | |||
40 | <span class="keyword">fn</span> <span class="function declaration">main</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">{</span> | 40 | <span class="keyword">fn</span> <span class="function declaration">main</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">{</span> |
41 | <span class="function">f</span><span class="punctuation">(</span><span class="string_literal">r"</span> | 41 | <span class="function">f</span><span class="punctuation">(</span><span class="string_literal">r"</span> |
42 | <span class="keyword">fn</span> <span class="function declaration">foo</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">{</span> | 42 | <span class="keyword">fn</span> <span class="function declaration">foo</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">{</span> |
43 | <span class="function">foo</span><span class="punctuation">(</span>$0<span class="punctuation">{</span> | 43 | <span class="function">foo</span><span class="punctuation">(</span><span class="keyword">$0</span><span class="punctuation">{</span> |
44 | <span class="numeric_literal">92</span> | 44 | <span class="numeric_literal">92</span> |
45 | <span class="punctuation">}</span>$0<span class="punctuation">)</span> | 45 | <span class="punctuation">}</span><span class="keyword">$0</span><span class="punctuation">)</span> |
46 | <span class="punctuation">}</span><span class="string_literal">"</span><span class="punctuation">)</span><span class="punctuation">;</span> | 46 | <span class="punctuation">}</span><span class="string_literal">"</span><span class="punctuation">)</span><span class="punctuation">;</span> |
47 | <span class="punctuation">}</span> | 47 | <span class="punctuation">}</span> |
48 | </code></pre> \ No newline at end of file | 48 | </code></pre> \ No newline at end of file |