aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/snapshots/highlighting.html54
-rw-r--r--crates/ra_ide/src/snapshots/rainbow_highlighting.html26
-rw-r--r--crates/ra_ide/src/syntax_highlighting/html.rs20
-rw-r--r--crates/ra_ide/src/syntax_highlighting/tags.rs2
-rw-r--r--crates/ra_ide/src/syntax_highlighting/tests.rs2
5 files changed, 55 insertions, 49 deletions
diff --git a/crates/ra_ide/src/snapshots/highlighting.html b/crates/ra_ide/src/snapshots/highlighting.html
index 51851763e..8c372ad27 100644
--- a/crates/ra_ide/src/snapshots/highlighting.html
+++ b/crates/ra_ide/src/snapshots/highlighting.html
@@ -3,70 +3,72 @@
3body { margin: 0; } 3body { margin: 0; }
4pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } 4pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; }
5 5
6
6.comment { color: #7F9F7F; } 7.comment { color: #7F9F7F; }
7.string { color: #CC9393; } 8.struct, .enum { color: #7CB8BB; }
9.enum_variant { color: #BDE0F3; }
10.string_literal { color: #CC9393; }
8.field { color: #94BFF3; } 11.field { color: #94BFF3; }
9.function { color: #93E0E3; } 12.function { color: #93E0E3; }
10.parameter { color: #94BFF3; } 13.parameter { color: #94BFF3; }
11.text { color: #DCDCCC; } 14.text { color: #DCDCCC; }
12.type { color: #7CB8BB; } 15.type { color: #7CB8BB; }
13.type.builtin { color: #8CD0D3; } 16.builtin_type { color: #8CD0D3; }
14.type.param { color: #20999D; } 17.type_param { color: #DFAF8F; }
15.attribute { color: #94BFF3; } 18.attribute { color: #94BFF3; }
16.literal { color: #BFEBBF; } 19.numeric_literal { color: #BFEBBF; }
17.literal.numeric { color: #6A8759; }
18.macro { color: #94BFF3; } 20.macro { color: #94BFF3; }
19.module { color: #AFD8AF; } 21.module { color: #AFD8AF; }
20.variable { color: #DCDCCC; } 22.variable { color: #DCDCCC; }
21.variable.mut { color: #DCDCCC; text-decoration: underline; } 23.mutable { text-decoration: underline; }
22 24
23.keyword { color: #F0DFAF; } 25.keyword { color: #F0DFAF; font-weight: bold; }
24.keyword.unsafe { color: #DFAF8F; } 26.keyword.unsafe { color: #BC8383; font-weight: bold; }
25.keyword.control { color: #F0DFAF; font-weight: bold; } 27.control { font-style: italic; }
26</style> 28</style>
27<pre><code><span class="attribute">#</span><span class="attribute">[</span><span class="attribute">derive</span><span class="attribute">(</span><span class="attribute">Clone</span><span class="attribute">,</span><span class="attribute"> </span><span class="attribute">Debug</span><span class="attribute">)</span><span class="attribute">]</span> 29<pre><code><span class="attribute">#</span><span class="attribute">[</span><span class="attribute">derive</span><span class="attribute">(</span><span class="attribute">Clone</span><span class="attribute">,</span><span class="attribute"> </span><span class="attribute">Debug</span><span class="attribute">)</span><span class="attribute">]</span>
28<span class="keyword">struct</span> <span class="type">Foo</span> { 30<span class="keyword">struct</span> <span class="struct">Foo</span> {
29 <span class="keyword">pub</span> <span class="field">x</span>: <span class="type builtin">i32</span>, 31 <span class="keyword">pub</span> <span class="field">x</span>: <span class="builtin_type">i32</span>,
30 <span class="keyword">pub</span> <span class="field">y</span>: <span class="type builtin">i32</span>, 32 <span class="keyword">pub</span> <span class="field">y</span>: <span class="builtin_type">i32</span>,
31} 33}
32 34
33<span class="keyword">fn</span> <span class="function">foo</span>&lt;<span class="type param">T</span>&gt;() -&gt; <span class="type param">T</span> { 35<span class="keyword">fn</span> <span class="function">foo</span>&lt;<span class="type_param">T</span>&gt;() -&gt; <span class="type_param">T</span> {
34 <span class="macro">unimplemented</span><span class="macro">!</span>(); 36 <span class="macro">unimplemented</span><span class="macro">!</span>();
35 <span class="function">foo</span>::&lt;<span class="type builtin">i32</span>&gt;(); 37 <span class="function">foo</span>::&lt;<span class="builtin_type">i32</span>&gt;();
36} 38}
37 39
38<span class="macro">macro_rules</span><span class="macro">!</span> def_fn { 40<span class="macro">macro_rules</span><span class="macro">!</span> def_fn {
39 ($($tt:tt)*) =&gt; {$($tt)*} 41 ($($tt:tt)*) =&gt; {$($tt)*}
40} 42}
41 43
42<span class="macro">def_fn</span><span class="macro">!</span>{ 44<span class="macro">def_fn</span><span class="macro">!</span> {
43 <span class="keyword">fn</span> <span class="function">bar</span>() -&gt; <span class="type builtin">u32</span> { 45 <span class="keyword">fn</span> <span class="function">bar</span>() -&gt; <span class="builtin_type">u32</span> {
44 <span class="literal numeric">100</span> 46 <span class="numeric_literal">100</span>
45 } 47 }
46} 48}
47 49
48<span class="comment">// comment</span> 50<span class="comment">// comment</span>
49<span class="keyword">fn</span> <span class="function">main</span>() { 51<span class="keyword">fn</span> <span class="function">main</span>() {
50 <span class="macro">println</span><span class="macro">!</span>(<span class="string">"Hello, {}!"</span>, <span class="literal numeric">92</span>); 52 <span class="macro">println</span><span class="macro">!</span>(<span class="string_literal">"Hello, {}!"</span>, <span class="numeric_literal">92</span>);
51 53
52 <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable mutable">vec</span> = Vec::new(); 54 <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable mutable">vec</span> = Vec::new();
53 <span class="keyword control">if</span> <span class="keyword">true</span> { 55 <span class="keyword control">if</span> <span class="keyword">true</span> {
54 <span class="keyword">let</span> <span class="variable">x</span> = <span class="literal numeric">92</span>; 56 <span class="keyword">let</span> <span class="variable">x</span> = <span class="numeric_literal">92</span>;
55 <span class="variable mutable">vec</span>.push(<span class="type">Foo</span> { <span class="field">x</span>, <span class="field">y</span>: <span class="literal numeric">1</span> }); 57 <span class="variable mutable">vec</span>.push(<span class="struct">Foo</span> { <span class="field">x</span>, <span class="field">y</span>: <span class="numeric_literal">1</span> });
56 } 58 }
57 <span class="keyword unsafe">unsafe</span> { <span class="variable mutable">vec</span>.set_len(<span class="literal numeric">0</span>); } 59 <span class="keyword unsafe">unsafe</span> { <span class="variable mutable">vec</span>.set_len(<span class="numeric_literal">0</span>); }
58 60
59 <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable mutable">x</span> = <span class="literal numeric">42</span>; 61 <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable mutable">x</span> = <span class="numeric_literal">42</span>;
60 <span class="keyword">let</span> <span class="variable mutable">y</span> = &<span class="keyword">mut</span> <span class="variable mutable">x</span>; 62 <span class="keyword">let</span> <span class="variable mutable">y</span> = &<span class="keyword">mut</span> <span class="variable mutable">x</span>;
61 <span class="keyword">let</span> <span class="variable">z</span> = &<span class="variable mutable">y</span>; 63 <span class="keyword">let</span> <span class="variable">z</span> = &<span class="variable mutable">y</span>;
62 64
63 <span class="variable mutable">y</span>; 65 <span class="variable mutable">y</span>;
64} 66}
65 67
66<span class="keyword">enum</span> <span class="type">E</span>&lt;<span class="type param">X</span>&gt; { 68<span class="keyword">enum</span> <span class="enum">E</span>&lt;<span class="type_param">X</span>&gt; {
67 <span class="constant">V</span>(<span class="type param">X</span>) 69 <span class="enum_variant">V</span>(<span class="type_param">X</span>)
68} 70}
69 71
70<span class="keyword">impl</span>&lt;<span class="type param">X</span>&gt; <span class="type">E</span>&lt;<span class="type param">X</span>&gt; { 72<span class="keyword">impl</span>&lt;<span class="type_param">X</span>&gt; <span class="enum">E</span>&lt;<span class="type_param">X</span>&gt; {
71 <span class="keyword">fn</span> <span class="function">new</span>&lt;<span class="type param">T</span>&gt;() -&gt; <span class="type">E</span>&lt;<span class="type param">T</span>&gt; {} 73 <span class="keyword">fn</span> <span class="function">new</span>&lt;<span class="type_param">T</span>&gt;() -&gt; <span class="enum">E</span>&lt;<span class="type_param">T</span>&gt; {}
72}</code></pre> \ No newline at end of file 74}</code></pre> \ No newline at end of file
diff --git a/crates/ra_ide/src/snapshots/rainbow_highlighting.html b/crates/ra_ide/src/snapshots/rainbow_highlighting.html
index 1f869867f..f63e64b6d 100644
--- a/crates/ra_ide/src/snapshots/rainbow_highlighting.html
+++ b/crates/ra_ide/src/snapshots/rainbow_highlighting.html
@@ -3,36 +3,38 @@
3body { margin: 0; } 3body { margin: 0; }
4pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } 4pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; }
5 5
6
6.comment { color: #7F9F7F; } 7.comment { color: #7F9F7F; }
7.string { color: #CC9393; } 8.struct, .enum { color: #7CB8BB; }
9.enum_variant { color: #BDE0F3; }
10.string_literal { color: #CC9393; }
8.field { color: #94BFF3; } 11.field { color: #94BFF3; }
9.function { color: #93E0E3; } 12.function { color: #93E0E3; }
10.parameter { color: #94BFF3; } 13.parameter { color: #94BFF3; }
11.text { color: #DCDCCC; } 14.text { color: #DCDCCC; }
12.type { color: #7CB8BB; } 15.type { color: #7CB8BB; }
13.type.builtin { color: #8CD0D3; } 16.builtin_type { color: #8CD0D3; }
14.type.param { color: #20999D; } 17.type_param { color: #DFAF8F; }
15.attribute { color: #94BFF3; } 18.attribute { color: #94BFF3; }
16.literal { color: #BFEBBF; } 19.numeric_literal { color: #BFEBBF; }
17.literal.numeric { color: #6A8759; }
18.macro { color: #94BFF3; } 20.macro { color: #94BFF3; }
19.module { color: #AFD8AF; } 21.module { color: #AFD8AF; }
20.variable { color: #DCDCCC; } 22.variable { color: #DCDCCC; }
21.variable.mut { color: #DCDCCC; text-decoration: underline; } 23.mutable { text-decoration: underline; }
22 24
23.keyword { color: #F0DFAF; } 25.keyword { color: #F0DFAF; font-weight: bold; }
24.keyword.unsafe { color: #DFAF8F; } 26.keyword.unsafe { color: #BC8383; font-weight: bold; }
25.keyword.control { color: #F0DFAF; font-weight: bold; } 27.control { font-style: italic; }
26</style> 28</style>
27<pre><code><span class="keyword">fn</span> <span class="function">main</span>() { 29<pre><code><span class="keyword">fn</span> <span class="function">main</span>() {
28 <span class="keyword">let</span> <span class="variable" data-binding-hash="8121853618659664005" style="color: hsl(261,57%,61%);">hello</span> = <span class="string">"hello"</span>; 30 <span class="keyword">let</span> <span class="variable" data-binding-hash="8121853618659664005" style="color: hsl(261,57%,61%);">hello</span> = <span class="string_literal">"hello"</span>;
29 <span class="keyword">let</span> <span class="variable" data-binding-hash="2705725358298919760" style="color: hsl(17,51%,74%);">x</span> = <span class="variable" data-binding-hash="8121853618659664005" style="color: hsl(261,57%,61%);">hello</span>.to_string(); 31 <span class="keyword">let</span> <span class="variable" data-binding-hash="2705725358298919760" style="color: hsl(17,51%,74%);">x</span> = <span class="variable" data-binding-hash="8121853618659664005" style="color: hsl(261,57%,61%);">hello</span>.to_string();
30 <span class="keyword">let</span> <span class="variable" data-binding-hash="3365759661443752373" style="color: hsl(127,76%,66%);">y</span> = <span class="variable" data-binding-hash="8121853618659664005" style="color: hsl(261,57%,61%);">hello</span>.to_string(); 32 <span class="keyword">let</span> <span class="variable" data-binding-hash="3365759661443752373" style="color: hsl(127,76%,66%);">y</span> = <span class="variable" data-binding-hash="8121853618659664005" style="color: hsl(261,57%,61%);">hello</span>.to_string();
31 33
32 <span class="keyword">let</span> <span class="variable" data-binding-hash="794745962933817518" style="color: hsl(19,74%,76%);">x</span> = <span class="string">"other color please!"</span>; 34 <span class="keyword">let</span> <span class="variable" data-binding-hash="794745962933817518" style="color: hsl(19,74%,76%);">x</span> = <span class="string_literal">"other color please!"</span>;
33 <span class="keyword">let</span> <span class="variable" data-binding-hash="6717528807933952652" style="color: hsl(85,49%,84%);">y</span> = <span class="variable" data-binding-hash="794745962933817518" style="color: hsl(19,74%,76%);">x</span>.to_string(); 35 <span class="keyword">let</span> <span class="variable" data-binding-hash="6717528807933952652" style="color: hsl(85,49%,84%);">y</span> = <span class="variable" data-binding-hash="794745962933817518" style="color: hsl(19,74%,76%);">x</span>.to_string();
34} 36}
35 37
36<span class="keyword">fn</span> <span class="function">bar</span>() { 38<span class="keyword">fn</span> <span class="function">bar</span>() {
37 <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable mutable" data-binding-hash="8121853618659664005" style="color: hsl(261,57%,61%);">hello</span> = <span class="string">"hello"</span>; 39 <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable mutable" data-binding-hash="8121853618659664005" style="color: hsl(261,57%,61%);">hello</span> = <span class="string_literal">"hello"</span>;
38}</code></pre> \ No newline at end of file 40}</code></pre> \ No newline at end of file
diff --git a/crates/ra_ide/src/syntax_highlighting/html.rs b/crates/ra_ide/src/syntax_highlighting/html.rs
index 210d9a57b..54678c278 100644
--- a/crates/ra_ide/src/syntax_highlighting/html.rs
+++ b/crates/ra_ide/src/syntax_highlighting/html.rs
@@ -80,25 +80,27 @@ const STYLE: &str = "
80body { margin: 0; } 80body { margin: 0; }
81pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } 81pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; }
82 82
83
83.comment { color: #7F9F7F; } 84.comment { color: #7F9F7F; }
84.string { color: #CC9393; } 85.struct, .enum { color: #7CB8BB; }
86.enum_variant { color: #BDE0F3; }
87.string_literal { color: #CC9393; }
85.field { color: #94BFF3; } 88.field { color: #94BFF3; }
86.function { color: #93E0E3; } 89.function { color: #93E0E3; }
87.parameter { color: #94BFF3; } 90.parameter { color: #94BFF3; }
88.text { color: #DCDCCC; } 91.text { color: #DCDCCC; }
89.type { color: #7CB8BB; } 92.type { color: #7CB8BB; }
90.type.builtin { color: #8CD0D3; } 93.builtin_type { color: #8CD0D3; }
91.type.param { color: #20999D; } 94.type_param { color: #DFAF8F; }
92.attribute { color: #94BFF3; } 95.attribute { color: #94BFF3; }
93.literal { color: #BFEBBF; } 96.numeric_literal { color: #BFEBBF; }
94.literal.numeric { color: #6A8759; }
95.macro { color: #94BFF3; } 97.macro { color: #94BFF3; }
96.module { color: #AFD8AF; } 98.module { color: #AFD8AF; }
97.variable { color: #DCDCCC; } 99.variable { color: #DCDCCC; }
98.variable.mut { color: #DCDCCC; text-decoration: underline; } 100.mutable { text-decoration: underline; }
99 101
100.keyword { color: #F0DFAF; } 102.keyword { color: #F0DFAF; font-weight: bold; }
101.keyword.unsafe { color: #DFAF8F; } 103.keyword.unsafe { color: #BC8383; font-weight: bold; }
102.keyword.control { color: #F0DFAF; font-weight: bold; } 104.control { font-style: italic; }
103</style> 105</style>
104"; 106";
diff --git a/crates/ra_ide/src/syntax_highlighting/tags.rs b/crates/ra_ide/src/syntax_highlighting/tags.rs
index 0b12bdef5..9da80823c 100644
--- a/crates/ra_ide/src/syntax_highlighting/tags.rs
+++ b/crates/ra_ide/src/syntax_highlighting/tags.rs
@@ -72,7 +72,7 @@ impl HighlightTag {
72 HighlightTag::NumericLiteral => "numeric_literal", 72 HighlightTag::NumericLiteral => "numeric_literal",
73 HighlightTag::SelfType => "self_type", 73 HighlightTag::SelfType => "self_type",
74 HighlightTag::Static => "static", 74 HighlightTag::Static => "static",
75 HighlightTag::StringLiteral => "string", 75 HighlightTag::StringLiteral => "string_literal",
76 HighlightTag::Struct => "struct", 76 HighlightTag::Struct => "struct",
77 HighlightTag::Trait => "trait", 77 HighlightTag::Trait => "trait",
78 HighlightTag::TypeAlias => "type_alias", 78 HighlightTag::TypeAlias => "type_alias",
diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs
index ff23d4ac5..2d90a072f 100644
--- a/crates/ra_ide/src/syntax_highlighting/tests.rs
+++ b/crates/ra_ide/src/syntax_highlighting/tests.rs
@@ -26,7 +26,7 @@ macro_rules! def_fn {
26 ($($tt:tt)*) => {$($tt)*} 26 ($($tt:tt)*) => {$($tt)*}
27} 27}
28 28
29def_fn!{ 29def_fn! {
30 fn bar() -> u32 { 30 fn bar() -> u32 {
31 100 31 100
32 } 32 }