diff options
author | Pascal Hertleif <[email protected]> | 2019-05-25 15:23:58 +0100 |
---|---|---|
committer | Pascal Hertleif <[email protected]> | 2019-05-27 10:26:35 +0100 |
commit | 43d5a4965308ec4b594725c0bd02cb046bdb730c (patch) | |
tree | 3a6e2965b065e61310deaa4186a8cec6535fd244 /crates/ra_ide_api/src/snapshots | |
parent | ed89b0638b1dbf8f9a33d9a95e829e602142bb05 (diff) |
More clever highlighting, incl draft for structs
Diffstat (limited to 'crates/ra_ide_api/src/snapshots')
4 files changed, 36 insertions, 335 deletions
diff --git a/crates/ra_ide_api/src/snapshots/highlighting.html b/crates/ra_ide_api/src/snapshots/highlighting.html index bfc0a67b1..4f4ed62a1 100644 --- a/crates/ra_ide_api/src/snapshots/highlighting.html +++ b/crates/ra_ide_api/src/snapshots/highlighting.html | |||
@@ -1,10 +1,7 @@ | |||
1 | 1 | ||
2 | <style> | 2 | <style> |
3 | pre { | 3 | body { margin: 0; } |
4 | color: #DCDCCC; | 4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } |
5 | background-color: #3F3F3F; | ||
6 | font-size: 22px; | ||
7 | } | ||
8 | 5 | ||
9 | .comment { color: #7F9F7F; } | 6 | .comment { color: #7F9F7F; } |
10 | .string { color: #CC9393; } | 7 | .string { color: #CC9393; } |
@@ -19,13 +16,11 @@ pre { | |||
19 | .keyword { color: #F0DFAF; } | 16 | .keyword { color: #F0DFAF; } |
20 | .keyword\.unsafe { color: #F0DFAF; font-weight: bold; } | 17 | .keyword\.unsafe { color: #F0DFAF; font-weight: bold; } |
21 | .keyword\.control { color: #DC8CC3; } | 18 | .keyword\.control { color: #DC8CC3; } |
22 | |||
23 | </style> | 19 | </style> |
24 | <pre><code> | 20 | <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> |
25 | <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> | ||
26 | <span class="keyword">struct</span> <span class="function">Foo</span> { | 21 | <span class="keyword">struct</span> <span class="function">Foo</span> { |
27 | <span class="keyword">pub</span> <span class="function">x</span>: <span class="text">i32</span>, | 22 | <span class="keyword">pub</span> <span class="variable" data-binding-hash="12067179602561426350" style="color: hsl(78,84%,47%);">x</span>: <span class="text">i32</span>, |
28 | <span class="keyword">pub</span> <span class="function">y</span>: <span class="text">i32</span>, | 23 | <span class="keyword">pub</span> <span class="variable" data-binding-hash="15562018766631452210" style="color: hsl(318,95%,78%);">y</span>: <span class="text">i32</span>, |
29 | } | 24 | } |
30 | 25 | ||
31 | <span class="keyword">fn</span> <span class="function">foo</span><<span class="type function">T</span>>() -> <span class="type">T</span> { | 26 | <span class="keyword">fn</span> <span class="function">foo</span><<span class="type function">T</span>>() -> <span class="type">T</span> { |
@@ -36,10 +31,9 @@ pre { | |||
36 | <span class="keyword">fn</span> <span class="function">main</span>() { | 31 | <span class="keyword">fn</span> <span class="function">main</span>() { |
37 | <span class="macro">println</span><span class="macro">!</span>(<span class="string">"Hello, {}!"</span>, <span class="literal">92</span>); | 32 | <span class="macro">println</span><span class="macro">!</span>(<span class="string">"Hello, {}!"</span>, <span class="literal">92</span>); |
38 | 33 | ||
39 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="function">vec</span> = <span class="text">Vec</span>::<span class="text">new</span>(); | 34 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable" data-binding-hash="9636295041291189729" style="color: hsl(51,57%,74%);">vec</span> = <span class="text">Vec</span>::<span class="text">new</span>(); |
40 | <span class="keyword.control">if</span> <span class="keyword">true</span> { | 35 | <span class="keyword.control">if</span> <span class="keyword">true</span> { |
41 | <span class="text">vec</span>.<span class="text">push</span>(<span class="type">Foo</span> { <span class="field">x</span>: <span class="literal">0</span>, <span class="field">y</span>: <span class="literal">1</span> }); | 36 | <span class="variable" data-binding-hash="8496027264380925433" style="color: hsl(18,48%,55%);">vec</span>.<span class="text">push</span>(<span class="type">Foo</span> { <span class="field" data-binding-hash="17368948500121423555" style="color: hsl(49,97%,70%);">x</span>: <span class="literal">0</span>, <span class="field" data-binding-hash="13663097548341495469" style="color: hsl(26,51%,46%);">y</span>: <span class="literal">1</span> }); |
42 | } | 37 | } |
43 | <span class="keyword.unsafe">unsafe</span> { <span class="text">vec</span>.<span class="text">set_len</span>(<span class="literal">0</span>); } | 38 | <span class="keyword.unsafe">unsafe</span> { <span class="variable" data-binding-hash="8496027264380925433" style="color: hsl(18,48%,55%);">vec</span>.<span class="text">set_len</span>(<span class="literal">0</span>); } |
44 | } | 39 | }</code></pre> \ No newline at end of file |
45 | </code></pre> \ No newline at end of file | ||
diff --git a/crates/ra_ide_api/src/snapshots/rainbow_highlighting.html b/crates/ra_ide_api/src/snapshots/rainbow_highlighting.html new file mode 100644 index 000000000..729d129d0 --- /dev/null +++ b/crates/ra_ide_api/src/snapshots/rainbow_highlighting.html | |||
@@ -0,0 +1,27 @@ | |||
1 | |||
2 | <style> | ||
3 | body { margin: 0; } | ||
4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } | ||
5 | |||
6 | .comment { color: #7F9F7F; } | ||
7 | .string { color: #CC9393; } | ||
8 | .function { color: #93E0E3; } | ||
9 | .parameter { color: #94BFF3; } | ||
10 | .builtin { color: #DD6718; } | ||
11 | .text { color: #DCDCCC; } | ||
12 | .attribute { color: #BFEBBF; } | ||
13 | .literal { color: #DFAF8F; } | ||
14 | .macro { color: #DFAF8F; } | ||
15 | |||
16 | .keyword { color: #F0DFAF; } | ||
17 | .keyword\.unsafe { color: #F0DFAF; font-weight: bold; } | ||
18 | .keyword\.control { color: #DC8CC3; } | ||
19 | </style> | ||
20 | <pre><code><span class="keyword">fn</span> <span class="function">main</span>() { | ||
21 | <span class="keyword">let</span> <span class="variable" data-binding-hash="3888301305669440875" style="color: hsl(242,59%,59%);">hello</span> = <span class="string">"hello"</span>; | ||
22 | <span class="keyword">let</span> <span class="variable" data-binding-hash="5695551762718493399" style="color: hsl(272,48%,45%);">x</span> = <span class="variable" data-binding-hash="3888301305669440875" style="color: hsl(242,59%,59%);">hello</span>.<span class="text">to_string</span>(); | ||
23 | <span class="keyword">let</span> <span class="variable" data-binding-hash="5435401749617022797" style="color: hsl(353,77%,74%);">y</span> = <span class="variable" data-binding-hash="3888301305669440875" style="color: hsl(242,59%,59%);">hello</span>.<span class="text">to_string</span>(); | ||
24 | |||
25 | <span class="keyword">let</span> <span class="variable" data-binding-hash="1903207544374197704" style="color: hsl(58,61%,61%);">x</span> = <span class="string">"other color please!"</span>; | ||
26 | <span class="keyword">let</span> <span class="variable" data-binding-hash="14878783531007968800" style="color: hsl(265,73%,83%);">y</span> = <span class="variable" data-binding-hash="1903207544374197704" style="color: hsl(58,61%,61%);">x</span>.<span class="text">to_string</span>(); | ||
27 | }</code></pre> \ No newline at end of file | ||
diff --git a/crates/ra_ide_api/src/snapshots/tests__highlighting.snap b/crates/ra_ide_api/src/snapshots/tests__highlighting.snap deleted file mode 100644 index e50003b3c..000000000 --- a/crates/ra_ide_api/src/snapshots/tests__highlighting.snap +++ /dev/null | |||
@@ -1,192 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-25T11:24:53.486036Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/syntax_highlighting.rs | ||
5 | expression: result | ||
6 | --- | ||
7 | Ok( | ||
8 | [ | ||
9 | HighlightedRange { | ||
10 | range: [1; 24), | ||
11 | tag: "attribute", | ||
12 | id: None, | ||
13 | }, | ||
14 | HighlightedRange { | ||
15 | range: [25; 31), | ||
16 | tag: "keyword", | ||
17 | id: None, | ||
18 | }, | ||
19 | HighlightedRange { | ||
20 | range: [32; 35), | ||
21 | tag: "variable", | ||
22 | id: Some( | ||
23 | 8465336196764640996, | ||
24 | ), | ||
25 | }, | ||
26 | HighlightedRange { | ||
27 | range: [42; 45), | ||
28 | tag: "keyword", | ||
29 | id: None, | ||
30 | }, | ||
31 | HighlightedRange { | ||
32 | range: [46; 47), | ||
33 | tag: "variable", | ||
34 | id: Some( | ||
35 | 176272420896316891, | ||
36 | ), | ||
37 | }, | ||
38 | HighlightedRange { | ||
39 | range: [49; 52), | ||
40 | tag: "text", | ||
41 | id: None, | ||
42 | }, | ||
43 | HighlightedRange { | ||
44 | range: [58; 61), | ||
45 | tag: "keyword", | ||
46 | id: None, | ||
47 | }, | ||
48 | HighlightedRange { | ||
49 | range: [62; 63), | ||
50 | tag: "variable", | ||
51 | id: Some( | ||
52 | 15061637676198917049, | ||
53 | ), | ||
54 | }, | ||
55 | HighlightedRange { | ||
56 | range: [65; 68), | ||
57 | tag: "text", | ||
58 | id: None, | ||
59 | }, | ||
60 | HighlightedRange { | ||
61 | range: [73; 75), | ||
62 | tag: "keyword", | ||
63 | id: None, | ||
64 | }, | ||
65 | HighlightedRange { | ||
66 | range: [76; 79), | ||
67 | tag: "variable", | ||
68 | id: Some( | ||
69 | 14077410872302487760, | ||
70 | ), | ||
71 | }, | ||
72 | HighlightedRange { | ||
73 | range: [80; 81), | ||
74 | tag: "type", | ||
75 | id: None, | ||
76 | }, | ||
77 | HighlightedRange { | ||
78 | range: [80; 81), | ||
79 | tag: "variable", | ||
80 | id: Some( | ||
81 | 8379786015941272633, | ||
82 | ), | ||
83 | }, | ||
84 | HighlightedRange { | ||
85 | range: [88; 89), | ||
86 | tag: "type", | ||
87 | id: None, | ||
88 | }, | ||
89 | HighlightedRange { | ||
90 | range: [96; 110), | ||
91 | tag: "macro", | ||
92 | id: None, | ||
93 | }, | ||
94 | HighlightedRange { | ||
95 | range: [117; 127), | ||
96 | tag: "comment", | ||
97 | id: None, | ||
98 | }, | ||
99 | HighlightedRange { | ||
100 | range: [128; 130), | ||
101 | tag: "keyword", | ||
102 | id: None, | ||
103 | }, | ||
104 | HighlightedRange { | ||
105 | range: [131; 135), | ||
106 | tag: "variable", | ||
107 | id: Some( | ||
108 | 5766414492220109266, | ||
109 | ), | ||
110 | }, | ||
111 | HighlightedRange { | ||
112 | range: [145; 153), | ||
113 | tag: "macro", | ||
114 | id: None, | ||
115 | }, | ||
116 | HighlightedRange { | ||
117 | range: [154; 166), | ||
118 | tag: "string", | ||
119 | id: None, | ||
120 | }, | ||
121 | HighlightedRange { | ||
122 | range: [168; 170), | ||
123 | tag: "literal", | ||
124 | id: None, | ||
125 | }, | ||
126 | HighlightedRange { | ||
127 | range: [178; 181), | ||
128 | tag: "keyword", | ||
129 | id: None, | ||
130 | }, | ||
131 | HighlightedRange { | ||
132 | range: [182; 185), | ||
133 | tag: "keyword", | ||
134 | id: None, | ||
135 | }, | ||
136 | HighlightedRange { | ||
137 | range: [186; 189), | ||
138 | tag: "macro", | ||
139 | id: None, | ||
140 | }, | ||
141 | HighlightedRange { | ||
142 | range: [197; 200), | ||
143 | tag: "macro", | ||
144 | id: None, | ||
145 | }, | ||
146 | HighlightedRange { | ||
147 | range: [192; 195), | ||
148 | tag: "text", | ||
149 | id: None, | ||
150 | }, | ||
151 | HighlightedRange { | ||
152 | range: [208; 211), | ||
153 | tag: "macro", | ||
154 | id: None, | ||
155 | }, | ||
156 | HighlightedRange { | ||
157 | range: [212; 216), | ||
158 | tag: "macro", | ||
159 | id: None, | ||
160 | }, | ||
161 | HighlightedRange { | ||
162 | range: [226; 227), | ||
163 | tag: "literal", | ||
164 | id: None, | ||
165 | }, | ||
166 | HighlightedRange { | ||
167 | range: [232; 233), | ||
168 | tag: "literal", | ||
169 | id: None, | ||
170 | }, | ||
171 | HighlightedRange { | ||
172 | range: [242; 248), | ||
173 | tag: "keyword.unsafe", | ||
174 | id: None, | ||
175 | }, | ||
176 | HighlightedRange { | ||
177 | range: [251; 254), | ||
178 | tag: "text", | ||
179 | id: None, | ||
180 | }, | ||
181 | HighlightedRange { | ||
182 | range: [255; 262), | ||
183 | tag: "text", | ||
184 | id: None, | ||
185 | }, | ||
186 | HighlightedRange { | ||
187 | range: [263; 264), | ||
188 | tag: "literal", | ||
189 | id: None, | ||
190 | }, | ||
191 | ], | ||
192 | ) | ||
diff --git a/crates/ra_ide_api/src/snapshots/tests__rainbow_highlighting.snap b/crates/ra_ide_api/src/snapshots/tests__rainbow_highlighting.snap deleted file mode 100644 index 84cd521a2..000000000 --- a/crates/ra_ide_api/src/snapshots/tests__rainbow_highlighting.snap +++ /dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-25T11:21:56.117898Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/syntax_highlighting.rs | ||
5 | expression: result | ||
6 | --- | ||
7 | Ok( | ||
8 | [ | ||
9 | HighlightedRange { | ||
10 | range: [1; 3), | ||
11 | tag: "keyword", | ||
12 | id: None, | ||
13 | }, | ||
14 | HighlightedRange { | ||
15 | range: [4; 8), | ||
16 | tag: "variable", | ||
17 | id: Some( | ||
18 | 5766414492220109266, | ||
19 | ), | ||
20 | }, | ||
21 | HighlightedRange { | ||
22 | range: [17; 20), | ||
23 | tag: "keyword", | ||
24 | id: None, | ||
25 | }, | ||
26 | HighlightedRange { | ||
27 | range: [21; 26), | ||
28 | tag: "variable", | ||
29 | id: Some( | ||
30 | 15975256018338854530, | ||
31 | ), | ||
32 | }, | ||
33 | HighlightedRange { | ||
34 | range: [29; 36), | ||
35 | tag: "string", | ||
36 | id: None, | ||
37 | }, | ||
38 | HighlightedRange { | ||
39 | range: [42; 45), | ||
40 | tag: "keyword", | ||
41 | id: None, | ||
42 | }, | ||
43 | HighlightedRange { | ||
44 | range: [46; 47), | ||
45 | tag: "variable", | ||
46 | id: Some( | ||
47 | 176272420896316891, | ||
48 | ), | ||
49 | }, | ||
50 | HighlightedRange { | ||
51 | range: [50; 55), | ||
52 | tag: "variable", | ||
53 | id: Some( | ||
54 | 15975256018338854530, | ||
55 | ), | ||
56 | }, | ||
57 | HighlightedRange { | ||
58 | range: [56; 65), | ||
59 | tag: "text", | ||
60 | id: None, | ||
61 | }, | ||
62 | HighlightedRange { | ||
63 | range: [73; 76), | ||
64 | tag: "keyword", | ||
65 | id: None, | ||
66 | }, | ||
67 | HighlightedRange { | ||
68 | range: [77; 78), | ||
69 | tag: "variable", | ||
70 | id: Some( | ||
71 | 15061637676198917049, | ||
72 | ), | ||
73 | }, | ||
74 | HighlightedRange { | ||
75 | range: [81; 86), | ||
76 | tag: "variable", | ||
77 | id: Some( | ||
78 | 15975256018338854530, | ||
79 | ), | ||
80 | }, | ||
81 | HighlightedRange { | ||
82 | range: [87; 96), | ||
83 | tag: "text", | ||
84 | id: None, | ||
85 | }, | ||
86 | HighlightedRange { | ||
87 | range: [105; 108), | ||
88 | tag: "keyword", | ||
89 | id: None, | ||
90 | }, | ||
91 | HighlightedRange { | ||
92 | range: [109; 110), | ||
93 | tag: "variable", | ||
94 | id: Some( | ||
95 | 1714508680417729339, | ||
96 | ), | ||
97 | }, | ||
98 | HighlightedRange { | ||
99 | range: [113; 134), | ||
100 | tag: "string", | ||
101 | id: None, | ||
102 | }, | ||
103 | HighlightedRange { | ||
104 | range: [140; 143), | ||
105 | tag: "keyword", | ||
106 | id: None, | ||
107 | }, | ||
108 | HighlightedRange { | ||
109 | range: [144; 145), | ||
110 | tag: "variable", | ||
111 | id: Some( | ||
112 | 15953336624848413466, | ||
113 | ), | ||
114 | }, | ||
115 | HighlightedRange { | ||
116 | range: [148; 149), | ||
117 | tag: "variable", | ||
118 | id: Some( | ||
119 | 1714508680417729339, | ||
120 | ), | ||
121 | }, | ||
122 | HighlightedRange { | ||
123 | range: [150; 159), | ||
124 | tag: "text", | ||
125 | id: None, | ||
126 | }, | ||
127 | ], | ||
128 | ) | ||