diff options
Diffstat (limited to 'crates/ra_ide/src/references')
-rw-r--r-- | crates/ra_ide/src/references/classify.rs | 14 | ||||
-rw-r--r-- | crates/ra_ide/src/references/name_definition.rs | 6 |
2 files changed, 14 insertions, 6 deletions
diff --git a/crates/ra_ide/src/references/classify.rs b/crates/ra_ide/src/references/classify.rs index b716d32e5..c1f091ec0 100644 --- a/crates/ra_ide/src/references/classify.rs +++ b/crates/ra_ide/src/references/classify.rs | |||
@@ -110,6 +110,15 @@ pub(crate) fn classify_name(db: &RootDatabase, name: InFile<&ast::Name>) -> Opti | |||
110 | kind: NameKind::Macro(def), | 110 | kind: NameKind::Macro(def), |
111 | }) | 111 | }) |
112 | }, | 112 | }, |
113 | ast::TypeParam(it) => { | ||
114 | let src = name.with_value(it); | ||
115 | let def = hir::TypeParam::from_source(db, src)?; | ||
116 | Some(NameDefinition { | ||
117 | visibility: None, | ||
118 | container: def.module(db), | ||
119 | kind: NameKind::TypeParam(def), | ||
120 | }) | ||
121 | }, | ||
113 | _ => None, | 122 | _ => None, |
114 | } | 123 | } |
115 | } | 124 | } |
@@ -168,9 +177,8 @@ pub(crate) fn classify_name_ref( | |||
168 | let kind = NameKind::Local(local); | 177 | let kind = NameKind::Local(local); |
169 | Some(NameDefinition { kind, container, visibility: None }) | 178 | Some(NameDefinition { kind, container, visibility: None }) |
170 | } | 179 | } |
171 | PathResolution::GenericParam(par) => { | 180 | PathResolution::TypeParam(par) => { |
172 | // FIXME: get generic param def | 181 | let kind = NameKind::TypeParam(par); |
173 | let kind = NameKind::GenericParam(par); | ||
174 | Some(NameDefinition { kind, container, visibility }) | 182 | Some(NameDefinition { kind, container, visibility }) |
175 | } | 183 | } |
176 | PathResolution::Macro(def) => { | 184 | PathResolution::Macro(def) => { |
diff --git a/crates/ra_ide/src/references/name_definition.rs b/crates/ra_ide/src/references/name_definition.rs index 10d3a2364..8c67c8863 100644 --- a/crates/ra_ide/src/references/name_definition.rs +++ b/crates/ra_ide/src/references/name_definition.rs | |||
@@ -4,8 +4,8 @@ | |||
4 | //! Note that the reference search is possible for not all of the classified items. | 4 | //! Note that the reference search is possible for not all of the classified items. |
5 | 5 | ||
6 | use hir::{ | 6 | use hir::{ |
7 | Adt, AssocItem, GenericParam, HasSource, ImplBlock, Local, MacroDef, Module, ModuleDef, | 7 | Adt, AssocItem, HasSource, ImplBlock, Local, MacroDef, Module, ModuleDef, StructField, |
8 | StructField, VariantDef, | 8 | TypeParam, VariantDef, |
9 | }; | 9 | }; |
10 | use ra_syntax::{ast, ast::VisibilityOwner}; | 10 | use ra_syntax::{ast, ast::VisibilityOwner}; |
11 | 11 | ||
@@ -19,7 +19,7 @@ pub enum NameKind { | |||
19 | Def(ModuleDef), | 19 | Def(ModuleDef), |
20 | SelfType(ImplBlock), | 20 | SelfType(ImplBlock), |
21 | Local(Local), | 21 | Local(Local), |
22 | GenericParam(GenericParam), | 22 | TypeParam(TypeParam), |
23 | } | 23 | } |
24 | 24 | ||
25 | #[derive(PartialEq, Eq)] | 25 | #[derive(PartialEq, Eq)] |