diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-25 11:48:47 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-25 11:48:47 +0100 |
commit | 91bd783273477d5709ea4bb891355e9aa9a7cdfe (patch) | |
tree | 606a17d688e931e35fe45eefd6c13c0baf7bd5bb /crates/ra_ide_api/src/snapshots | |
parent | 9800699bab04e97996f0aebec528714165a2619b (diff) | |
parent | c6e905a79f7ba083b3f97728aa3a74fb0e03661b (diff) |
Merge #1327
1327: Colorize Rust code as HTML r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/snapshots')
-rw-r--r-- | crates/ra_ide_api/src/snapshots/highlighting.html | 45 | ||||
-rw-r--r-- | crates/ra_ide_api/src/snapshots/tests__highlighting.snap | 146 |
2 files changed, 45 insertions, 146 deletions
diff --git a/crates/ra_ide_api/src/snapshots/highlighting.html b/crates/ra_ide_api/src/snapshots/highlighting.html new file mode 100644 index 000000000..bfc0a67b1 --- /dev/null +++ b/crates/ra_ide_api/src/snapshots/highlighting.html | |||
@@ -0,0 +1,45 @@ | |||
1 | |||
2 | <style> | ||
3 | pre { | ||
4 | color: #DCDCCC; | ||
5 | background-color: #3F3F3F; | ||
6 | font-size: 22px; | ||
7 | } | ||
8 | |||
9 | .comment { color: #7F9F7F; } | ||
10 | .string { color: #CC9393; } | ||
11 | .function { color: #93E0E3; } | ||
12 | .parameter { color: #94BFF3; } | ||
13 | .builtin { color: #DD6718; } | ||
14 | .text { color: #DCDCCC; } | ||
15 | .attribute { color: #BFEBBF; } | ||
16 | .literal { color: #DFAF8F; } | ||
17 | .macro { color: #DFAF8F; } | ||
18 | |||
19 | .keyword { color: #F0DFAF; } | ||
20 | .keyword\.unsafe { color: #F0DFAF; font-weight: bold; } | ||
21 | .keyword\.control { color: #DC8CC3; } | ||
22 | |||
23 | </style> | ||
24 | <pre><code> | ||
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> { | ||
27 | <span class="keyword">pub</span> <span class="function">x</span>: <span class="text">i32</span>, | ||
28 | <span class="keyword">pub</span> <span class="function">y</span>: <span class="text">i32</span>, | ||
29 | } | ||
30 | |||
31 | <span class="keyword">fn</span> <span class="function">foo</span><<span class="type function">T</span>>() -> <span class="type">T</span> { | ||
32 | <span class="macro">unimplemented</span><span class="macro">!</span>(); | ||
33 | } | ||
34 | |||
35 | <span class="comment">// comment</span> | ||
36 | <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>); | ||
38 | |||
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>(); | ||
40 | <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> }); | ||
42 | } | ||
43 | <span class="keyword.unsafe">unsafe</span> { <span class="text">vec</span>.<span class="text">set_len</span>(<span class="literal">0</span>); } | ||
44 | } | ||
45 | </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 9c60aed2a..000000000 --- a/crates/ra_ide_api/src/snapshots/tests__highlighting.snap +++ /dev/null | |||
@@ -1,146 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:23:35.242742395Z" | ||
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 | }, | ||
13 | HighlightedRange { | ||
14 | range: [25; 31), | ||
15 | tag: "keyword", | ||
16 | }, | ||
17 | HighlightedRange { | ||
18 | range: [32; 35), | ||
19 | tag: "function", | ||
20 | }, | ||
21 | HighlightedRange { | ||
22 | range: [42; 45), | ||
23 | tag: "keyword", | ||
24 | }, | ||
25 | HighlightedRange { | ||
26 | range: [46; 47), | ||
27 | tag: "function", | ||
28 | }, | ||
29 | HighlightedRange { | ||
30 | range: [49; 52), | ||
31 | tag: "text", | ||
32 | }, | ||
33 | HighlightedRange { | ||
34 | range: [58; 61), | ||
35 | tag: "keyword", | ||
36 | }, | ||
37 | HighlightedRange { | ||
38 | range: [62; 63), | ||
39 | tag: "function", | ||
40 | }, | ||
41 | HighlightedRange { | ||
42 | range: [65; 68), | ||
43 | tag: "text", | ||
44 | }, | ||
45 | HighlightedRange { | ||
46 | range: [73; 75), | ||
47 | tag: "keyword", | ||
48 | }, | ||
49 | HighlightedRange { | ||
50 | range: [76; 79), | ||
51 | tag: "function", | ||
52 | }, | ||
53 | HighlightedRange { | ||
54 | range: [80; 81), | ||
55 | tag: "type", | ||
56 | }, | ||
57 | HighlightedRange { | ||
58 | range: [80; 81), | ||
59 | tag: "function", | ||
60 | }, | ||
61 | HighlightedRange { | ||
62 | range: [88; 89), | ||
63 | tag: "type", | ||
64 | }, | ||
65 | HighlightedRange { | ||
66 | range: [96; 110), | ||
67 | tag: "macro", | ||
68 | }, | ||
69 | HighlightedRange { | ||
70 | range: [117; 127), | ||
71 | tag: "comment", | ||
72 | }, | ||
73 | HighlightedRange { | ||
74 | range: [128; 130), | ||
75 | tag: "keyword", | ||
76 | }, | ||
77 | HighlightedRange { | ||
78 | range: [131; 135), | ||
79 | tag: "function", | ||
80 | }, | ||
81 | HighlightedRange { | ||
82 | range: [145; 153), | ||
83 | tag: "macro", | ||
84 | }, | ||
85 | HighlightedRange { | ||
86 | range: [154; 166), | ||
87 | tag: "string", | ||
88 | }, | ||
89 | HighlightedRange { | ||
90 | range: [168; 170), | ||
91 | tag: "literal", | ||
92 | }, | ||
93 | HighlightedRange { | ||
94 | range: [178; 181), | ||
95 | tag: "keyword", | ||
96 | }, | ||
97 | HighlightedRange { | ||
98 | range: [182; 185), | ||
99 | tag: "keyword", | ||
100 | }, | ||
101 | HighlightedRange { | ||
102 | range: [186; 189), | ||
103 | tag: "macro", | ||
104 | }, | ||
105 | HighlightedRange { | ||
106 | range: [197; 200), | ||
107 | tag: "macro", | ||
108 | }, | ||
109 | HighlightedRange { | ||
110 | range: [192; 195), | ||
111 | tag: "text", | ||
112 | }, | ||
113 | HighlightedRange { | ||
114 | range: [208; 211), | ||
115 | tag: "macro", | ||
116 | }, | ||
117 | HighlightedRange { | ||
118 | range: [212; 216), | ||
119 | tag: "macro", | ||
120 | }, | ||
121 | HighlightedRange { | ||
122 | range: [226; 227), | ||
123 | tag: "literal", | ||
124 | }, | ||
125 | HighlightedRange { | ||
126 | range: [232; 233), | ||
127 | tag: "literal", | ||
128 | }, | ||
129 | HighlightedRange { | ||
130 | range: [242; 248), | ||
131 | tag: "keyword.unsafe", | ||
132 | }, | ||
133 | HighlightedRange { | ||
134 | range: [251; 254), | ||
135 | tag: "text", | ||
136 | }, | ||
137 | HighlightedRange { | ||
138 | range: [255; 262), | ||
139 | tag: "text", | ||
140 | }, | ||
141 | HighlightedRange { | ||
142 | range: [263; 264), | ||
143 | tag: "literal", | ||
144 | }, | ||
145 | ], | ||
146 | ) | ||