aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/source_binder.rs6
-rw-r--r--crates/ra_ide/src/references/classify.rs1
-rw-r--r--crates/ra_ide/src/snapshots/highlighting.html9
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs9
4 files changed, 23 insertions, 2 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 8c4b635d2..2957e496c 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -37,7 +37,7 @@ use crate::{
37 InEnvironment, TraitEnvironment, Ty, 37 InEnvironment, TraitEnvironment, Ty,
38 }, 38 },
39 Adt, AssocItem, Const, DefWithBody, Enum, EnumVariant, FromSource, Function, GenericParam, 39 Adt, AssocItem, Const, DefWithBody, Enum, EnumVariant, FromSource, Function, GenericParam,
40 Local, MacroDef, Name, Path, ScopeDef, Static, Struct, Trait, Type, TypeAlias, 40 ImplBlock, Local, MacroDef, Name, Path, ScopeDef, Static, Struct, Trait, Type, TypeAlias,
41}; 41};
42 42
43fn try_get_resolver_for_node(db: &impl HirDatabase, node: InFile<&SyntaxNode>) -> Option<Resolver> { 43fn try_get_resolver_for_node(db: &impl HirDatabase, node: InFile<&SyntaxNode>) -> Option<Resolver> {
@@ -59,6 +59,10 @@ fn try_get_resolver_for_node(db: &impl HirDatabase, node: InFile<&SyntaxNode>) -
59 let src = node.with_value(it); 59 let src = node.with_value(it);
60 Some(Enum::from_source(db, src)?.id.resolver(db)) 60 Some(Enum::from_source(db, src)?.id.resolver(db))
61 }, 61 },
62 ast::ImplBlock(it) => {
63 let src = node.with_value(it);
64 Some(ImplBlock::from_source(db, src)?.id.resolver(db))
65 },
62 _ => match node.value.kind() { 66 _ => match node.value.kind() {
63 FN_DEF | CONST_DEF | STATIC_DEF => { 67 FN_DEF | CONST_DEF | STATIC_DEF => {
64 let def = def_with_body_from_child_node(db, node)?; 68 let def = def_with_body_from_child_node(db, node)?;
diff --git a/crates/ra_ide/src/references/classify.rs b/crates/ra_ide/src/references/classify.rs
index 65df2e335..ed98dbc13 100644
--- a/crates/ra_ide/src/references/classify.rs
+++ b/crates/ra_ide/src/references/classify.rs
@@ -178,7 +178,6 @@ pub(crate) fn classify_name_ref(
178 Some(NameDefinition { kind, container, visibility: None }) 178 Some(NameDefinition { kind, container, visibility: None })
179 } 179 }
180 PathResolution::GenericParam(par) => { 180 PathResolution::GenericParam(par) => {
181 // FIXME: get generic param def
182 let kind = NameKind::GenericParam(par); 181 let kind = NameKind::GenericParam(par);
183 Some(NameDefinition { kind, container, visibility }) 182 Some(NameDefinition { kind, container, visibility })
184 } 183 }
diff --git a/crates/ra_ide/src/snapshots/highlighting.html b/crates/ra_ide/src/snapshots/highlighting.html
index b39c4d371..4166a8f90 100644
--- a/crates/ra_ide/src/snapshots/highlighting.html
+++ b/crates/ra_ide/src/snapshots/highlighting.html
@@ -9,6 +9,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
9.parameter { color: #94BFF3; } 9.parameter { color: #94BFF3; }
10.builtin { color: #DD6718; } 10.builtin { color: #DD6718; }
11.text { color: #DCDCCC; } 11.text { color: #DCDCCC; }
12.type { color: #7CB8BB; }
12.attribute { color: #94BFF3; } 13.attribute { color: #94BFF3; }
13.literal { color: #BFEBBF; } 14.literal { color: #BFEBBF; }
14.macro { color: #94BFF3; } 15.macro { color: #94BFF3; }
@@ -45,4 +46,12 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
45 <span class="keyword">let</span> <span class="variable">z</span> = &<span class="variable.mut">y</span>; 46 <span class="keyword">let</span> <span class="variable">z</span> = &<span class="variable.mut">y</span>;
46 47
47 <span class="variable.mut">y</span>; 48 <span class="variable.mut">y</span>;
49}
50
51<span class="keyword">enum</span> <span class="type">E</span>&lt;<span class="type">X</span>&gt; {
52 <span class="constant">V</span>(<span class="type">X</span>)
53}
54
55<span class="keyword">impl</span>&lt;<span class="type">X</span>&gt; <span class="type">E</span>&lt;<span class="type">X</span>&gt; {
56 <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; {}
48}</code></pre> \ No newline at end of file 57}</code></pre> \ No newline at end of file
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index e6a79541f..20eefeb57 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -255,6 +255,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
255.parameter { color: #94BFF3; } 255.parameter { color: #94BFF3; }
256.builtin { color: #DD6718; } 256.builtin { color: #DD6718; }
257.text { color: #DCDCCC; } 257.text { color: #DCDCCC; }
258.type { color: #7CB8BB; }
258.attribute { color: #94BFF3; } 259.attribute { color: #94BFF3; }
259.literal { color: #BFEBBF; } 260.literal { color: #BFEBBF; }
260.macro { color: #94BFF3; } 261.macro { color: #94BFF3; }
@@ -303,6 +304,14 @@ fn main() {
303 304
304 y; 305 y;
305} 306}
307
308enum E<X> {
309 V(X)
310}
311
312impl<X> E<X> {
313 fn new<T>() -> E<T> {}
314}
306"# 315"#
307 .trim(), 316 .trim(),
308 ); 317 );