diff options
author | Paul Daniel Faria <[email protected]> | 2020-06-22 15:28:07 +0100 |
---|---|---|
committer | Paul Daniel Faria <[email protected]> | 2020-06-23 17:11:33 +0100 |
commit | d8230acd84dc931f72b9dd32b8fbc2aa887d8b4b (patch) | |
tree | 29b4dea638978cd7043a7d6e5b0dbab3d7d84fdd /crates/ra_ide/src/snapshots/highlighting.html | |
parent | e137d9accb0ad73e1794e55a76c18ed4c8ca85e9 (diff) |
Add punctuation highlighting for highlighting punctuation in doctests, fix highlighting in doctests
Diffstat (limited to 'crates/ra_ide/src/snapshots/highlighting.html')
-rw-r--r-- | crates/ra_ide/src/snapshots/highlighting.html | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/crates/ra_ide/src/snapshots/highlighting.html b/crates/ra_ide/src/snapshots/highlighting.html index c101af8ea..e1852c409 100644 --- a/crates/ra_ide/src/snapshots/highlighting.html +++ b/crates/ra_ide/src/snapshots/highlighting.html | |||
@@ -5,7 +5,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
5 | 5 | ||
6 | .lifetime { color: #DFAF8F; font-style: italic; } | 6 | .lifetime { color: #DFAF8F; font-style: italic; } |
7 | .comment { color: #7F9F7F; } | 7 | .comment { color: #7F9F7F; } |
8 | .documentation { color: #00CC00; } | 8 | .documentation { color: #629755; } |
9 | .injected { opacity: 0.65 ; } | 9 | .injected { opacity: 0.65 ; } |
10 | .struct, .enum { color: #7CB8BB; } | 10 | .struct, .enum { color: #7CB8BB; } |
11 | .enum_variant { color: #BDE0F3; } | 11 | .enum_variant { color: #BDE0F3; } |
@@ -34,84 +34,84 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
34 | .keyword.unsafe { color: #BC8383; font-weight: bold; } | 34 | .keyword.unsafe { color: #BC8383; font-weight: bold; } |
35 | .control { font-style: italic; } | 35 | .control { font-style: italic; } |
36 | </style> | 36 | </style> |
37 | <pre><code><span class="attribute">#[</span><span class="function attribute">derive</span><span class="attribute">(Clone, Debug)]</span> | 37 | <pre><code><span class="punctuation">#</span><span class="punctuation">[</span><span class="function attribute">derive</span><span class="punctuation">(</span><span class="attribute">Clone</span><span class="punctuation">,</span><span class="attribute"> Debug</span><span class="punctuation">)</span><span class="punctuation">]</span> |
38 | <span class="keyword">struct</span> <span class="struct declaration">Foo</span> { | 38 | <span class="keyword">struct</span> <span class="struct declaration">Foo</span> <span class="punctuation">{</span> |
39 | <span class="keyword">pub</span> <span class="field declaration">x</span>: <span class="builtin_type">i32</span>, | 39 | <span class="keyword">pub</span> <span class="field declaration">x</span><span class="punctuation">:</span> <span class="builtin_type">i32</span><span class="punctuation">,</span> |
40 | <span class="keyword">pub</span> <span class="field declaration">y</span>: <span class="builtin_type">i32</span>, | 40 | <span class="keyword">pub</span> <span class="field declaration">y</span><span class="punctuation">:</span> <span class="builtin_type">i32</span><span class="punctuation">,</span> |
41 | } | 41 | <span class="punctuation">}</span> |
42 | 42 | ||
43 | <span class="keyword">trait</span> <span class="trait declaration">Bar</span> { | 43 | <span class="keyword">trait</span> <span class="trait declaration">Bar</span> <span class="punctuation">{</span> |
44 | <span class="keyword">fn</span> <span class="function declaration">bar</span>(&<span class="self_keyword">self</span>) -> <span class="builtin_type">i32</span>; | 44 | <span class="keyword">fn</span> <span class="function declaration">bar</span><span class="punctuation">(</span><span class="punctuation">&</span><span class="self_keyword">self</span><span class="punctuation">)</span> <span class="punctuation">-></span> <span class="builtin_type">i32</span><span class="punctuation">;</span> |
45 | } | 45 | <span class="punctuation">}</span> |
46 | 46 | ||
47 | <span class="keyword">impl</span> <span class="trait">Bar</span> <span class="keyword">for</span> <span class="struct">Foo</span> { | 47 | <span class="keyword">impl</span> <span class="trait">Bar</span> <span class="keyword">for</span> <span class="struct">Foo</span> <span class="punctuation">{</span> |
48 | <span class="keyword">fn</span> <span class="function declaration">bar</span>(&<span class="self_keyword">self</span>) -> <span class="builtin_type">i32</span> { | 48 | <span class="keyword">fn</span> <span class="function declaration">bar</span><span class="punctuation">(</span><span class="punctuation">&</span><span class="self_keyword">self</span><span class="punctuation">)</span> <span class="punctuation">-></span> <span class="builtin_type">i32</span> <span class="punctuation">{</span> |
49 | <span class="self_keyword">self</span>.<span class="field">x</span> | 49 | <span class="self_keyword">self</span><span class="punctuation">.</span><span class="field">x</span> |
50 | } | 50 | <span class="punctuation">}</span> |
51 | } | 51 | <span class="punctuation">}</span> |
52 | 52 | ||
53 | <span class="keyword">static</span> <span class="keyword">mut</span> <span class="static declaration mutable">STATIC_MUT</span>: <span class="builtin_type">i32</span> = <span class="numeric_literal">0</span>; | 53 | <span class="keyword">static</span> <span class="keyword">mut</span> <span class="static declaration mutable">STATIC_MUT</span><span class="punctuation">:</span> <span class="builtin_type">i32</span> <span class="punctuation">=</span> <span class="numeric_literal">0</span><span class="punctuation">;</span> |
54 | 54 | ||
55 | <span class="keyword">fn</span> <span class="function declaration">foo</span><<span class="lifetime declaration">'a</span>, <span class="type_param declaration">T</span>>() -> <span class="type_param">T</span> { | 55 | <span class="keyword">fn</span> <span class="function declaration">foo</span><span class="punctuation"><</span><span class="lifetime declaration">'a</span><span class="punctuation">,</span> <span class="type_param declaration">T</span><span class="punctuation">></span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">-></span> <span class="type_param">T</span> <span class="punctuation">{</span> |
56 | <span class="function">foo</span>::<<span class="lifetime">'a</span>, <span class="builtin_type">i32</span>>() | 56 | <span class="function">foo</span><span class="punctuation">::</span><span class="punctuation"><</span><span class="lifetime">'a</span><span class="punctuation">,</span> <span class="builtin_type">i32</span><span class="punctuation">></span><span class="punctuation">(</span><span class="punctuation">)</span> |
57 | } | 57 | <span class="punctuation">}</span> |
58 | 58 | ||
59 | <span class="macro">macro_rules!</span> <span class="macro declaration">def_fn</span> { | 59 | <span class="macro">macro_rules!</span> <span class="macro declaration">def_fn</span> <span class="punctuation">{</span> |
60 | ($($tt:tt)*) => {$($tt)*} | 60 | <span class="punctuation">(</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>tt<span class="punctuation">:</span>tt<span class="punctuation">)</span>*<span class="punctuation">)</span> <span class="punctuation">=</span><span class="punctuation">></span> <span class="punctuation">{</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>tt<span class="punctuation">)</span>*<span class="punctuation">}</span> |
61 | } | 61 | <span class="punctuation">}</span> |
62 | 62 | ||
63 | <span class="macro">def_fn!</span> { | 63 | <span class="macro">def_fn!</span> <span class="punctuation">{</span> |
64 | <span class="keyword">fn</span> <span class="function declaration">bar</span>() -> <span class="builtin_type">u32</span> { | 64 | <span class="keyword">fn</span> <span class="function declaration">bar</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">-</span><span class="punctuation">></span> <span class="builtin_type">u32</span> <span class="punctuation">{</span> |
65 | <span class="numeric_literal">100</span> | 65 | <span class="numeric_literal">100</span> |
66 | } | 66 | <span class="punctuation">}</span> |
67 | } | 67 | <span class="punctuation">}</span> |
68 | 68 | ||
69 | <span class="macro">macro_rules!</span> <span class="macro declaration">noop</span> { | 69 | <span class="macro">macro_rules!</span> <span class="macro declaration">noop</span> <span class="punctuation">{</span> |
70 | ($expr:expr) => { | 70 | <span class="punctuation">(</span><span class="punctuation">$</span>expr<span class="punctuation">:</span>expr<span class="punctuation">)</span> <span class="punctuation">=</span><span class="punctuation">></span> <span class="punctuation">{</span> |
71 | $expr | 71 | <span class="punctuation">$</span>expr |
72 | } | 72 | <span class="punctuation">}</span> |
73 | } | 73 | <span class="punctuation">}</span> |
74 | 74 | ||
75 | <span class="comment">// comment</span> | 75 | <span class="comment">// comment</span> |
76 | <span class="keyword">fn</span> <span class="function declaration">main</span>() { | 76 | <span class="keyword">fn</span> <span class="function declaration">main</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">{</span> |
77 | <span class="macro">println!</span>(<span class="string_literal">"Hello, {}!"</span>, <span class="numeric_literal">92</span>); | 77 | <span class="macro">println!</span><span class="punctuation">(</span><span class="string_literal">"Hello, {}!"</span><span class="punctuation">,</span> <span class="numeric_literal">92</span><span class="punctuation">)</span><span class="punctuation">;</span> |
78 | 78 | ||
79 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">vec</span> = <span class="unresolved_reference">Vec</span>::<span class="unresolved_reference">new</span>(); | 79 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">vec</span> <span class="punctuation">=</span> <span class="unresolved_reference">Vec</span><span class="punctuation">::</span><span class="unresolved_reference">new</span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span> |
80 | <span class="keyword control">if</span> <span class="bool_literal">true</span> { | 80 | <span class="keyword control">if</span> <span class="bool_literal">true</span> <span class="punctuation">{</span> |
81 | <span class="keyword">let</span> <span class="variable declaration">x</span> = <span class="numeric_literal">92</span>; | 81 | <span class="keyword">let</span> <span class="variable declaration">x</span> <span class="punctuation">=</span> <span class="numeric_literal">92</span><span class="punctuation">;</span> |
82 | <span class="variable mutable">vec</span>.<span class="unresolved_reference">push</span>(<span class="struct">Foo</span> { <span class="field">x</span>, <span class="field">y</span>: <span class="numeric_literal">1</span> }); | 82 | <span class="variable mutable">vec</span><span class="punctuation">.</span><span class="unresolved_reference">push</span><span class="punctuation">(</span><span class="struct">Foo</span> <span class="punctuation">{</span> <span class="field">x</span><span class="punctuation">,</span> <span class="field">y</span><span class="punctuation">:</span> <span class="numeric_literal">1</span> <span class="punctuation">}</span><span class="punctuation">)</span><span class="punctuation">;</span> |
83 | } | 83 | <span class="punctuation">}</span> |
84 | <span class="keyword unsafe">unsafe</span> { | 84 | <span class="keyword unsafe">unsafe</span> <span class="punctuation">{</span> |
85 | <span class="variable mutable">vec</span>.<span class="unresolved_reference">set_len</span>(<span class="numeric_literal">0</span>); | 85 | <span class="variable mutable">vec</span><span class="punctuation">.</span><span class="unresolved_reference">set_len</span><span class="punctuation">(</span><span class="numeric_literal">0</span><span class="punctuation">)</span><span class="punctuation">;</span> |
86 | <span class="static mutable">STATIC_MUT</span> = <span class="numeric_literal">1</span>; | 86 | <span class="static mutable">STATIC_MUT</span> <span class="punctuation">=</span> <span class="numeric_literal">1</span><span class="punctuation">;</span> |
87 | } | 87 | <span class="punctuation">}</span> |
88 | 88 | ||
89 | <span class="keyword control">for</span> <span class="variable declaration">e</span> <span class="keyword control">in</span> <span class="variable mutable">vec</span> { | 89 | <span class="keyword control">for</span> <span class="variable declaration">e</span> <span class="keyword control">in</span> <span class="variable mutable">vec</span> <span class="punctuation">{</span> |
90 | <span class="comment">// Do nothing</span> | 90 | <span class="comment">// Do nothing</span> |
91 | } | 91 | <span class="punctuation">}</span> |
92 | 92 | ||
93 | <span class="macro">noop!</span>(<span class="macro">noop</span><span class="macro">!</span>(<span class="numeric_literal">1</span>)); | 93 | <span class="macro">noop!</span><span class="punctuation">(</span><span class="macro">noop</span><span class="macro">!</span><span class="punctuation">(</span><span class="numeric_literal">1</span><span class="punctuation">)</span><span class="punctuation">)</span><span class="punctuation">;</span> |
94 | 94 | ||
95 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">x</span> = <span class="numeric_literal">42</span>; | 95 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">x</span> <span class="punctuation">=</span> <span class="numeric_literal">42</span><span class="punctuation">;</span> |
96 | <span class="keyword">let</span> <span class="variable declaration mutable">y</span> = &<span class="keyword">mut</span> <span class="variable mutable">x</span>; | 96 | <span class="keyword">let</span> <span class="variable declaration mutable">y</span> <span class="punctuation">=</span> <span class="punctuation">&</span><span class="keyword">mut</span> <span class="variable mutable">x</span><span class="punctuation">;</span> |
97 | <span class="keyword">let</span> <span class="variable declaration">z</span> = &<span class="variable mutable">y</span>; | 97 | <span class="keyword">let</span> <span class="variable declaration">z</span> <span class="punctuation">=</span> <span class="punctuation">&</span><span class="variable mutable">y</span><span class="punctuation">;</span> |
98 | 98 | ||
99 | <span class="keyword">let</span> <span class="struct">Foo</span> { <span class="field">x</span>: <span class="variable declaration">z</span>, <span class="field">y</span> } = <span class="struct">Foo</span> { <span class="field">x</span>: <span class="variable">z</span>, <span class="field">y</span> }; | 99 | <span class="keyword">let</span> <span class="struct">Foo</span> <span class="punctuation">{</span> <span class="field">x</span><span class="punctuation">:</span> <span class="variable declaration">z</span><span class="punctuation">,</span> <span class="field">y</span> <span class="punctuation">}</span> <span class="punctuation">=</span> <span class="struct">Foo</span> <span class="punctuation">{</span> <span class="field">x</span><span class="punctuation">:</span> <span class="variable">z</span><span class="punctuation">,</span> <span class="field">y</span> <span class="punctuation">}</span><span class="punctuation">;</span> |
100 | 100 | ||
101 | <span class="variable">y</span>; | 101 | <span class="variable">y</span><span class="punctuation">;</span> |
102 | } | 102 | <span class="punctuation">}</span> |
103 | 103 | ||
104 | <span class="keyword">enum</span> <span class="enum declaration">Option</span><<span class="type_param declaration">T</span>> { | 104 | <span class="keyword">enum</span> <span class="enum declaration">Option</span><span class="punctuation"><</span><span class="type_param declaration">T</span><span class="punctuation">></span> <span class="punctuation">{</span> |
105 | <span class="enum_variant declaration">Some</span>(<span class="type_param">T</span>), | 105 | <span class="enum_variant declaration">Some</span><span class="punctuation">(</span><span class="type_param">T</span><span class="punctuation">)</span><span class="punctuation">,</span> |
106 | <span class="enum_variant declaration">None</span>, | 106 | <span class="enum_variant declaration">None</span><span class="punctuation">,</span> |
107 | } | 107 | <span class="punctuation">}</span> |
108 | <span class="keyword">use</span> <span class="enum">Option</span>::*; | 108 | <span class="keyword">use</span> <span class="enum">Option</span><span class="punctuation">::</span>*<span class="punctuation">;</span> |
109 | 109 | ||
110 | <span class="keyword">impl</span><<span class="type_param declaration">T</span>> <span class="enum">Option</span><<span class="type_param">T</span>> { | 110 | <span class="keyword">impl</span><span class="punctuation"><</span><span class="type_param declaration">T</span><span class="punctuation">></span> <span class="enum">Option</span><span class="punctuation"><</span><span class="type_param">T</span><span class="punctuation">></span> <span class="punctuation">{</span> |
111 | <span class="keyword">fn</span> <span class="function declaration">and</span><<span class="type_param declaration">U</span>>(<span class="self_keyword">self</span>, <span class="variable declaration">other</span>: <span class="enum">Option</span><<span class="type_param">U</span>>) -> <span class="enum">Option</span><(<span class="type_param">T</span>, <span class="type_param">U</span>)> { | 111 | <span class="keyword">fn</span> <span class="function declaration">and</span><span class="punctuation"><</span><span class="type_param declaration">U</span><span class="punctuation">></span><span class="punctuation">(</span><span class="self_keyword">self</span><span class="punctuation">,</span> <span class="variable declaration">other</span><span class="punctuation">:</span> <span class="enum">Option</span><span class="punctuation"><</span><span class="type_param">U</span><span class="punctuation">></span><span class="punctuation">)</span> <span class="punctuation">-></span> <span class="enum">Option</span><span class="punctuation"><</span><span class="punctuation">(</span><span class="type_param">T</span><span class="punctuation">,</span> <span class="type_param">U</span><span class="punctuation">)</span><span class="punctuation">></span> <span class="punctuation">{</span> |
112 | <span class="keyword control">match</span> <span class="variable">other</span> { | 112 | <span class="keyword control">match</span> <span class="variable">other</span> <span class="punctuation">{</span> |
113 | <span class="enum_variant">None</span> => <span class="macro">unimplemented!</span>(), | 113 | <span class="enum_variant">None</span> <span class="punctuation">=></span> <span class="macro">unimplemented!</span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">,</span> |
114 | <span class="variable declaration">Nope</span> => <span class="variable">Nope</span>, | 114 | <span class="variable declaration">Nope</span> <span class="punctuation">=></span> <span class="variable">Nope</span><span class="punctuation">,</span> |
115 | } | 115 | <span class="punctuation">}</span> |
116 | } | 116 | <span class="punctuation">}</span> |
117 | }</code></pre> \ No newline at end of file | 117 | <span class="punctuation">}</span></code></pre> \ No newline at end of file |