diff options
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/goto_definition.rs | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index d3c198813..64c0cbad4 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs | |||
@@ -64,9 +64,11 @@ pub(crate) fn reference_definition( | |||
64 | 64 | ||
65 | let name_kind = classify_name_ref(db, name_ref).map(|d| d.kind); | 65 | let name_kind = classify_name_ref(db, name_ref).map(|d| d.kind); |
66 | match name_kind { | 66 | match name_kind { |
67 | Some(Macro(mac)) => return Exact(mac.to_nav(db)), | 67 | Some(Macro(it)) => return Exact(it.to_nav(db)), |
68 | Some(Field(field)) => return Exact(field.to_nav(db)), | 68 | Some(Field(it)) => return Exact(it.to_nav(db)), |
69 | Some(AssocItem(assoc)) => return Exact(assoc.to_nav(db)), | 69 | Some(GenericParam(it)) => return Exact(it.to_nav(db)), |
70 | Some(AssocItem(it)) => return Exact(it.to_nav(db)), | ||
71 | Some(Local(it)) => return Exact(it.to_nav(db)), | ||
70 | Some(Def(def)) => match NavigationTarget::from_def(db, def) { | 72 | Some(Def(def)) => match NavigationTarget::from_def(db, def) { |
71 | Some(nav) => return Exact(nav), | 73 | Some(nav) => return Exact(nav), |
72 | None => return Approximate(vec![]), | 74 | None => return Approximate(vec![]), |
@@ -77,10 +79,6 @@ pub(crate) fn reference_definition( | |||
77 | // us to the actual type | 79 | // us to the actual type |
78 | return Exact(imp.to_nav(db)); | 80 | return Exact(imp.to_nav(db)); |
79 | } | 81 | } |
80 | Some(Local(local)) => return Exact(local.to_nav(db)), | ||
81 | Some(GenericParam(_)) => { | ||
82 | // FIXME: go to the generic param def | ||
83 | } | ||
84 | None => {} | 82 | None => {} |
85 | }; | 83 | }; |
86 | 84 | ||
@@ -723,4 +721,17 @@ mod tests { | |||
723 | "foo FN_DEF FileId(1) [359; 376) [362; 365)", | 721 | "foo FN_DEF FileId(1) [359; 376) [362; 365)", |
724 | ); | 722 | ); |
725 | } | 723 | } |
724 | |||
725 | #[test] | ||
726 | fn goto_for_type_param() { | ||
727 | check_goto( | ||
728 | " | ||
729 | //- /lib.rs | ||
730 | struct Foo<T> { | ||
731 | t: <|>T, | ||
732 | } | ||
733 | ", | ||
734 | "T TYPE_PARAM FileId(1) [11; 12)", | ||
735 | ); | ||
736 | } | ||
726 | } | 737 | } |