aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/snapshots/highlight_doctest.html
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-06-16 12:40:51 +0100
committerGitHub <[email protected]>2020-06-16 12:40:51 +0100
commit4342b717158eeb9aff20d1958229ffcbca17f1c7 (patch)
treeddcbbfe6fcaaac83449fe612c971044e19680365 /crates/ra_ide/src/snapshots/highlight_doctest.html
parent83a16e825da2767aaee1d62447eb94f4d7de8881 (diff)
parentc4b3db0c2f307d1d782af88ded260e4c6593cae0 (diff)
Merge #4876
4876: Syntactic highlighting of NAME_REF for injections r=matklad a=ltentrup This commit adds a function that tries to determine the syntax highlighting class of NAME_REFs based on the usage. It is used for highlighting injections (such as highlighting of doctests) as the semantic logic will most of the time result in unresolved references. It also adds a color to unresolved references in HTML encoding. Follow up of #4683. Fixes #4809. Co-authored-by: Leander Tentrup <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/snapshots/highlight_doctest.html')
-rw-r--r--crates/ra_ide/src/snapshots/highlight_doctest.html23
1 files changed, 17 insertions, 6 deletions
diff --git a/crates/ra_ide/src/snapshots/highlight_doctest.html b/crates/ra_ide/src/snapshots/highlight_doctest.html
index 0ae8c7efc..5228df267 100644
--- a/crates/ra_ide/src/snapshots/highlight_doctest.html
+++ b/crates/ra_ide/src/snapshots/highlight_doctest.html
@@ -25,22 +25,29 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
25.variable { color: #DCDCCC; } 25.variable { color: #DCDCCC; }
26.format_specifier { color: #CC696B; } 26.format_specifier { color: #CC696B; }
27.mutable { text-decoration: underline; } 27.mutable { text-decoration: underline; }
28.unresolved_reference { color: #FC5555; }
28 29
29.keyword { color: #F0DFAF; font-weight: bold; } 30.keyword { color: #F0DFAF; font-weight: bold; }
30.keyword.unsafe { color: #BC8383; font-weight: bold; } 31.keyword.unsafe { color: #BC8383; font-weight: bold; }
31.control { font-style: italic; } 32.control { font-style: italic; }
32</style> 33</style>
33<pre><code><span class="keyword">impl</span> <span class="unresolved_reference">Foo</span> { 34<pre><code><span class="keyword">struct</span> <span class="struct declaration">Foo</span> {
35 <span class="field declaration">bar</span>: <span class="builtin_type">bool</span>,
36}
37
38<span class="keyword">impl</span> <span class="struct">Foo</span> {
39 <span class="keyword">pub</span> <span class="keyword">const</span> <span class="constant declaration">bar</span>: <span class="builtin_type">bool</span> = <span class="bool_literal">true</span>;
40
34 <span class="comment">/// Constructs a new `Foo`.</span> 41 <span class="comment">/// Constructs a new `Foo`.</span>
35 <span class="comment">///</span> 42 <span class="comment">///</span>
36 <span class="comment">/// # Examples</span> 43 <span class="comment">/// # Examples</span>
37 <span class="comment">///</span> 44 <span class="comment">///</span>
38 <span class="comment">/// ```</span> 45 <span class="comment">/// ```</span>
39 <span class="comment">/// #</span> <span class="attribute">#![</span><span class="function attribute">allow</span><span class="attribute">(unused_mut)]</span> 46 <span class="comment">/// #</span> <span class="attribute">#![</span><span class="function attribute">allow</span><span class="attribute">(unused_mut)]</span>
40 <span class="comment">/// </span><span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">foo</span>: <span class="unresolved_reference">Foo</span> = <span class="unresolved_reference">Foo</span>::<span class="unresolved_reference">new</span>(); 47 <span class="comment">/// </span><span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">foo</span>: <span class="struct">Foo</span> = <span class="struct">Foo</span>::<span class="function">new</span>();
41 <span class="comment">/// ```</span> 48 <span class="comment">/// ```</span>
42 <span class="keyword">pub</span> <span class="keyword">const</span> <span class="keyword">fn</span> <span class="function declaration">new</span>() -&gt; <span class="unresolved_reference">Foo</span> { 49 <span class="keyword">pub</span> <span class="keyword">const</span> <span class="keyword">fn</span> <span class="function declaration">new</span>() -&gt; <span class="struct">Foo</span> {
43 <span class="unresolved_reference">Foo</span> { } 50 <span class="struct">Foo</span> { <span class="field">bar</span>: <span class="bool_literal">true</span> }
44 } 51 }
45 52
46 <span class="comment">/// `bar` method on `Foo`.</span> 53 <span class="comment">/// `bar` method on `Foo`.</span>
@@ -48,11 +55,15 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
48 <span class="comment">/// # Examples</span> 55 <span class="comment">/// # Examples</span>
49 <span class="comment">///</span> 56 <span class="comment">///</span>
50 <span class="comment">/// ```</span> 57 <span class="comment">/// ```</span>
51 <span class="comment">/// </span><span class="keyword">let</span> <span class="variable declaration">foo</span> = <span class="unresolved_reference">Foo</span>::<span class="unresolved_reference">new</span>(); 58 <span class="comment">/// </span><span class="keyword">use</span> <span class="module">x</span>::<span class="module">y</span>;
59 <span class="comment">///</span>
60 <span class="comment">/// </span><span class="keyword">let</span> <span class="variable declaration">foo</span> = <span class="struct">Foo</span>::<span class="function">new</span>();
52 <span class="comment">///</span> 61 <span class="comment">///</span>
53 <span class="comment">/// </span><span class="comment">// calls bar on foo</span> 62 <span class="comment">/// </span><span class="comment">// calls bar on foo</span>
54 <span class="comment">/// </span><span class="macro">assert!</span>(foo.bar()); 63 <span class="comment">/// </span><span class="macro">assert!</span>(foo.bar());
55 <span class="comment">///</span> 64 <span class="comment">///</span>
65 <span class="comment">/// </span><span class="keyword">let</span> <span class="variable declaration">bar</span> = <span class="variable">foo</span>.<span class="field">bar</span> || <span class="struct">Foo</span>::<span class="constant">bar</span>;
66 <span class="comment">///</span>
56 <span class="comment">/// </span><span class="comment">/* multi-line 67 <span class="comment">/// </span><span class="comment">/* multi-line
57 </span><span class="comment">/// </span><span class="comment"> comment */</span> 68 </span><span class="comment">/// </span><span class="comment"> comment */</span>
58 <span class="comment">///</span> 69 <span class="comment">///</span>
@@ -63,7 +74,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
63 <span class="comment">/// ```</span> 74 <span class="comment">/// ```</span>
64 <span class="comment">///</span> 75 <span class="comment">///</span>
65 <span class="comment">/// ```</span> 76 <span class="comment">/// ```</span>
66 <span class="comment">/// </span><span class="keyword">let</span> <span class="variable declaration">foobar</span> = <span class="unresolved_reference">Foo</span>::<span class="unresolved_reference">new</span>().<span class="unresolved_reference">bar</span>(); 77 <span class="comment">/// </span><span class="keyword">let</span> <span class="variable declaration">foobar</span> = <span class="struct">Foo</span>::<span class="function">new</span>().<span class="function">bar</span>();
67 <span class="comment">/// ```</span> 78 <span class="comment">/// ```</span>
68 <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function declaration">foo</span>(&<span class="self_keyword">self</span>) -&gt; <span class="builtin_type">bool</span> { 79 <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function declaration">foo</span>(&<span class="self_keyword">self</span>) -&gt; <span class="builtin_type">bool</span> {
69 <span class="bool_literal">true</span> 80 <span class="bool_literal">true</span>