Better highlight for fixtures

This commit is contained in:
Aleksey Kladov 2021-01-09 16:07:41 +03:00
parent 62b17bac92
commit 4a8d2c098d
2 changed files with 6 additions and 2 deletions

View file

@ -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);

View file

@ -40,9 +40,9 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
<span class="keyword">fn</span> <span class="function declaration">main</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">{</span>
<span class="function">f</span><span class="punctuation">(</span><span class="string_literal">r"</span>
<span class="keyword">fn</span> <span class="function declaration">foo</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">{</span>
<span class="function">foo</span><span class="punctuation">(</span>$0<span class="punctuation">{</span>
<span class="function">foo</span><span class="punctuation">(</span><span class="keyword">$0</span><span class="punctuation">{</span>
<span class="numeric_literal">92</span>
<span class="punctuation">}</span>$0<span class="punctuation">)</span>
<span class="punctuation">}</span><span class="keyword">$0</span><span class="punctuation">)</span>
<span class="punctuation">}</span><span class="string_literal">"</span><span class="punctuation">)</span><span class="punctuation">;</span>
<span class="punctuation">}</span>
</code></pre>