diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-18 14:23:14 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-18 14:23:14 +0100 |
commit | f7f627d342e89585350e9c8b42764d207eb33352 (patch) | |
tree | 800d91a03a1ea7d1678c95a48f2888327f952122 /crates/ra_ide/src/snapshots/highlight_doctest.html | |
parent | 0262dba97ef114bd7664a4e32be21caef2d63f0a (diff) | |
parent | 66fc084a86e8f5d207d63e33173d1e203cb5ce5e (diff) |
Merge #4903
4903: Add highlighting support for doc comments r=matklad a=Nashenas88
The language server protocol includes a semantic modifier for documentation. This change exports that modifier for doc comments so users can choose to highlight them differently compared to regular comments.
Example:
<img width="375" alt="Screen Shot 2020-06-16 at 10 34 14 AM" src="https://user-images.githubusercontent.com/1673130/84788271-f6599580-afbc-11ea-96e5-7a0215da620b.png">
CC @woody77
Co-authored-by: Paul Daniel Faria <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/snapshots/highlight_doctest.html')
-rw-r--r-- | crates/ra_ide/src/snapshots/highlight_doctest.html | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/crates/ra_ide/src/snapshots/highlight_doctest.html b/crates/ra_ide/src/snapshots/highlight_doctest.html index f92a0aba5..f61c0daa5 100644 --- a/crates/ra_ide/src/snapshots/highlight_doctest.html +++ b/crates/ra_ide/src/snapshots/highlight_doctest.html | |||
@@ -39,48 +39,48 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
39 | <span class="keyword">impl</span> <span class="struct">Foo</span> { | 39 | <span class="keyword">impl</span> <span class="struct">Foo</span> { |
40 | <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 | <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>; |
41 | 41 | ||
42 | <span class="comment">/// Constructs a new `Foo`.</span> | 42 | <span class="comment documentation">/// Constructs a new `Foo`.</span> |
43 | <span class="comment">///</span> | 43 | <span class="comment documentation">///</span> |
44 | <span class="comment">/// # Examples</span> | 44 | <span class="comment documentation">/// # Examples</span> |
45 | <span class="comment">///</span> | 45 | <span class="comment documentation">///</span> |
46 | <span class="comment">/// ```</span> | 46 | <span class="comment documentation">/// ```</span> |
47 | <span class="comment">/// #</span> <span class="attribute">#![</span><span class="function attribute">allow</span><span class="attribute">(unused_mut)]</span> | 47 | <span class="comment documentation">/// #</span> <span class="attribute">#![</span><span class="function attribute">allow</span><span class="attribute">(unused_mut)]</span> |
48 | <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>(); | 48 | <span class="comment documentation">/// </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>(); |
49 | <span class="comment">/// ```</span> | 49 | <span class="comment documentation">/// ```</span> |
50 | <span class="keyword">pub</span> <span class="keyword">const</span> <span class="keyword">fn</span> <span class="function declaration">new</span>() -> <span class="struct">Foo</span> { | 50 | <span class="keyword">pub</span> <span class="keyword">const</span> <span class="keyword">fn</span> <span class="function declaration">new</span>() -> <span class="struct">Foo</span> { |
51 | <span class="struct">Foo</span> { <span class="field">bar</span>: <span class="bool_literal">true</span> } | 51 | <span class="struct">Foo</span> { <span class="field">bar</span>: <span class="bool_literal">true</span> } |
52 | } | 52 | } |
53 | 53 | ||
54 | <span class="comment">/// `bar` method on `Foo`.</span> | 54 | <span class="comment documentation">/// `bar` method on `Foo`.</span> |
55 | <span class="comment">///</span> | 55 | <span class="comment documentation">///</span> |
56 | <span class="comment">/// # Examples</span> | 56 | <span class="comment documentation">/// # Examples</span> |
57 | <span class="comment">///</span> | 57 | <span class="comment documentation">///</span> |
58 | <span class="comment">/// ```</span> | 58 | <span class="comment documentation">/// ```</span> |
59 | <span class="comment">/// </span><span class="keyword">use</span> <span class="module">x</span>::<span class="module">y</span>; | 59 | <span class="comment documentation">/// </span><span class="keyword">use</span> <span class="module">x</span>::<span class="module">y</span>; |
60 | <span class="comment">///</span> | 60 | <span class="comment documentation">///</span> |
61 | <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>(); | 61 | <span class="comment documentation">/// </span><span class="keyword">let</span> <span class="variable declaration">foo</span> = <span class="struct">Foo</span>::<span class="function">new</span>(); |
62 | <span class="comment">///</span> | 62 | <span class="comment documentation">///</span> |
63 | <span class="comment">/// </span><span class="comment">// calls bar on foo</span> | 63 | <span class="comment documentation">/// </span><span class="comment">// calls bar on foo</span> |
64 | <span class="comment">/// </span><span class="macro">assert!</span>(foo.bar()); | 64 | <span class="comment documentation">/// </span><span class="macro">assert!</span>(foo.bar()); |
65 | <span class="comment">///</span> | 65 | <span class="comment documentation">///</span> |
66 | <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 documentation">/// </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>; |
67 | <span class="comment">///</span> | 67 | <span class="comment documentation">///</span> |
68 | <span class="comment">/// </span><span class="comment">/* multi-line | 68 | <span class="comment documentation">/// </span><span class="comment">/* multi-line |
69 | </span><span class="comment">/// </span><span class="comment"> comment */</span> | 69 | </span><span class="comment documentation">/// </span><span class="comment"> comment */</span> |
70 | <span class="comment">///</span> | 70 | <span class="comment documentation">///</span> |
71 | <span class="comment">/// </span><span class="keyword">let</span> <span class="variable declaration">multi_line_string</span> = <span class="string_literal">"Foo | 71 | <span class="comment documentation">/// </span><span class="keyword">let</span> <span class="variable declaration">multi_line_string</span> = <span class="string_literal">"Foo |
72 | </span><span class="comment">/// </span><span class="string_literal"> bar | 72 | </span><span class="comment documentation">/// </span><span class="string_literal"> bar |
73 | </span><span class="comment">/// </span><span class="string_literal"> "</span>; | 73 | </span><span class="comment documentation">/// </span><span class="string_literal"> "</span>; |
74 | <span class="comment">///</span> | 74 | <span class="comment documentation">///</span> |
75 | <span class="comment">/// ```</span> | 75 | <span class="comment documentation">/// ```</span> |
76 | <span class="comment">///</span> | 76 | <span class="comment documentation">///</span> |
77 | <span class="comment">/// ```rust,no_run</span> | 77 | <span class="comment documentation">/// ```rust,no_run</span> |
78 | <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>(); | 78 | <span class="comment documentation">/// </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>(); |
79 | <span class="comment">/// ```</span> | 79 | <span class="comment documentation">/// ```</span> |
80 | <span class="comment">///</span> | 80 | <span class="comment documentation">///</span> |
81 | <span class="comment">/// ```sh</span> | 81 | <span class="comment documentation">/// ```sh</span> |
82 | <span class="comment">/// echo 1</span> | 82 | <span class="comment documentation">/// echo 1</span> |
83 | <span class="comment">/// ```</span> | 83 | <span class="comment documentation">/// ```</span> |
84 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function declaration">foo</span>(&<span class="self_keyword">self</span>) -> <span class="builtin_type">bool</span> { | 84 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function declaration">foo</span>(&<span class="self_keyword">self</span>) -> <span class="builtin_type">bool</span> { |
85 | <span class="bool_literal">true</span> | 85 | <span class="bool_literal">true</span> |
86 | } | 86 | } |