diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 8c4b635d22..2957e496c1 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs @@ -37,7 +37,7 @@ use crate::{ InEnvironment, TraitEnvironment, Ty, }, Adt, AssocItem, Const, DefWithBody, Enum, EnumVariant, FromSource, Function, GenericParam, - Local, MacroDef, Name, Path, ScopeDef, Static, Struct, Trait, Type, TypeAlias, + ImplBlock, Local, MacroDef, Name, Path, ScopeDef, Static, Struct, Trait, Type, TypeAlias, }; fn try_get_resolver_for_node(db: &impl HirDatabase, node: InFile<&SyntaxNode>) -> Option { @@ -59,6 +59,10 @@ fn try_get_resolver_for_node(db: &impl HirDatabase, node: InFile<&SyntaxNode>) - let src = node.with_value(it); Some(Enum::from_source(db, src)?.id.resolver(db)) }, + ast::ImplBlock(it) => { + let src = node.with_value(it); + Some(ImplBlock::from_source(db, src)?.id.resolver(db)) + }, _ => match node.value.kind() { FN_DEF | CONST_DEF | STATIC_DEF => { 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 65df2e3352..ed98dbc13a 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( Some(NameDefinition { kind, container, visibility: None }) } PathResolution::GenericParam(par) => { - // FIXME: get generic param def let kind = NameKind::GenericParam(par); Some(NameDefinition { kind, container, visibility }) } diff --git a/crates/ra_ide/src/snapshots/highlighting.html b/crates/ra_ide/src/snapshots/highlighting.html index b39c4d3717..4166a8f90d 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 .parameter { color: #94BFF3; } .builtin { color: #DD6718; } .text { color: #DCDCCC; } +.type { color: #7CB8BB; } .attribute { color: #94BFF3; } .literal { color: #BFEBBF; } .macro { color: #94BFF3; } @@ -45,4 +46,12 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd let z = &y; y; +} + +enum E<X> { + V(X) +} + +impl<X> E<X> { + fn new<T>() -> E<T> {} } \ 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 e6a79541fe..20eefeb57a 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 .parameter { color: #94BFF3; } .builtin { color: #DD6718; } .text { color: #DCDCCC; } +.type { color: #7CB8BB; } .attribute { color: #94BFF3; } .literal { color: #BFEBBF; } .macro { color: #94BFF3; } @@ -303,6 +304,14 @@ fn main() { y; } + +enum E { + V(X) +} + +impl E { + fn new() -> E {} +} "# .trim(), );