removed type.alias

This commit is contained in:
Omer Ben-Amram 2019-12-14 13:29:42 +02:00
parent 67641d3f5f
commit 083010f633
4 changed files with 28 additions and 14 deletions

View File

@ -10,8 +10,10 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
.builtin { color: #DD6718; }
.text { color: #DCDCCC; }
.type { color: #7CB8BB; }
.type\.param { color: #20999D; }
.attribute { color: #94BFF3; }
.literal { color: #BFEBBF; }
.literal\.numeric { color: #6A8759; }
.macro { color: #94BFF3; }
.variable { color: #DCDCCC; }
.variable\.mut { color: #DCDCCC; text-decoration: underline; }
@ -22,36 +24,36 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
</style>
<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>
<span class="keyword">struct</span> <span class="type">Foo</span> {
<span class="keyword">pub</span> <span class="field">x</span>: <span class="type">i32</span>,
<span class="keyword">pub</span> <span class="field">y</span>: <span class="type">i32</span>,
<span class="keyword">pub</span> <span class="field">x</span>: <span class="type.builtin">i32</span>,
<span class="keyword">pub</span> <span class="field">y</span>: <span class="type.builtin">i32</span>,
}
<span class="keyword">fn</span> <span class="function">foo</span>&lt;<span class="type">T</span>&gt;() -&gt; <span class="type">T</span> {
<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> {
<span class="macro">unimplemented</span><span class="macro">!</span>();
<span class="function">foo</span>::&lt;<span class="type">i32</span>&gt;();
<span class="function">foo</span>::&lt;<span class="type.builtin">i32</span>&gt;();
}
<span class="comment">// comment</span>
<span class="keyword">fn</span> <span class="function">main</span>() {
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"Hello, {}!"</span>, <span class="literal">92</span>);
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"Hello, {}!"</span>, <span class="literal.numeric">92</span>);
<span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable.mut">vec</span> = <span class="text">Vec</span>::<span class="text">new</span>();
<span class="keyword.control">if</span> <span class="keyword">true</span> {
<span class="variable.mut">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> });
<span class="variable.mut">vec</span>.<span class="text">push</span>(<span class="type">Foo</span> { <span class="field">x</span>: <span class="literal.numeric">0</span>, <span class="field">y</span>: <span class="literal.numeric">1</span> });
}
<span class="keyword.unsafe">unsafe</span> { <span class="variable.mut">vec</span>.<span class="text">set_len</span>(<span class="literal">0</span>); }
<span class="keyword.unsafe">unsafe</span> { <span class="variable.mut">vec</span>.<span class="text">set_len</span>(<span class="literal.numeric">0</span>); }
<span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable.mut">x</span> = <span class="literal">42</span>;
<span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable.mut">x</span> = <span class="literal.numeric">42</span>;
<span class="keyword">let</span> <span class="variable.mut">y</span> = &<span class="keyword">mut</span> <span class="variable.mut">x</span>;
<span class="keyword">let</span> <span class="variable">z</span> = &<span class="variable.mut">y</span>;
<span class="variable.mut">y</span>;
}
<span class="keyword">enum</span> <span class="type">E</span>&lt;<span class="type">X</span>&gt; {
<span class="constant">V</span>(<span class="type">X</span>)
<span class="keyword">enum</span> <span class="type">E</span>&lt;<span class="type.param">X</span>&gt; {
<span class="constant">V</span>(<span class="type.param">X</span>)
}
<span class="keyword">impl</span>&lt;<span class="type">X</span>&gt; <span class="type">E</span>&lt;<span class="type">X</span>&gt; {
<span class="keyword">fn</span> <span class="function">new</span>&lt;<span class="type">T</span>&gt;() -&gt; <span class="type">E</span>&lt;<span class="type">T</span>&gt; {}
<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; {
<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; {}
}</code></pre>

View File

@ -118,7 +118,7 @@ fn hash<T: std::hash::Hash + std::fmt::Debug>(x: T) -> u64 {
INT_NUMBER | FLOAT_NUMBER => "literal.numeric",
BYTE => "literal.byte",
CHAR => "literal.char",
LIFETIME => "lifetime",
LIFETIME => "type.lifetime",
T![unsafe] => "keyword.unsafe",
k if is_control_keyword(k) => "keyword.control",
k if k.is_keyword() => "keyword",
@ -218,7 +218,7 @@ fn highlight_name(db: &RootDatabase, name_kind: NameKind) -> &'static str {
Field(_) => "field",
AssocItem(hir::AssocItem::Function(_)) => "function",
AssocItem(hir::AssocItem::Const(_)) => "constant",
AssocItem(hir::AssocItem::TypeAlias(_)) => "type.alias",
AssocItem(hir::AssocItem::TypeAlias(_)) => "type",
Def(hir::ModuleDef::Module(_)) => "module",
Def(hir::ModuleDef::Function(_)) => "function",
Def(hir::ModuleDef::Adt(_)) => "type",
@ -259,8 +259,10 @@ fn html_escape(text: &str) -> String {
.builtin { color: #DD6718; }
.text { color: #DCDCCC; }
.type { color: #7CB8BB; }
.type\\.param { color: #20999D; }
.attribute { color: #94BFF3; }
.literal { color: #BFEBBF; }
.literal\\.numeric { color: #6A8759; }
.macro { color: #94BFF3; }
.variable { color: #DCDCCC; }
.variable\\.mut { color: #DCDCCC; text-decoration: underline; }

View File

@ -485,6 +485,15 @@
"highContrast": "#4EC9B0"
}
},
{
"id": "ralsp.type.lifetime",
"description": "Color for `Self` param type",
"defaults": {
"dark": "#4EC9B0",
"light": "#267F99",
"highContrast": "#4EC9B0"
}
},
{
"id": "ralsp.type.self",
"description": "Color for `Self` param type",

View File

@ -56,6 +56,7 @@ export class Highlighter {
decoration('type.self'),
decoration('type.generic'),
decoration('type.param'),
decoration('type.lifetime'),
decoration('builtin'),
decoration('text'),
decoration('attribute'),