diff options
Diffstat (limited to 'crates/ra_ide_api/src/references.rs')
-rw-r--r-- | crates/ra_ide_api/src/references.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs index b5b1c9a16..9cb9433e7 100644 --- a/crates/ra_ide_api/src/references.rs +++ b/crates/ra_ide_api/src/references.rs | |||
@@ -19,7 +19,9 @@ use ra_db::{SourceDatabase, SourceDatabaseExt}; | |||
19 | use ra_prof::profile; | 19 | use ra_prof::profile; |
20 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode, SourceFile, SyntaxNode, TextUnit}; | 20 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode, SourceFile, SyntaxNode, TextUnit}; |
21 | 21 | ||
22 | use crate::{db::RootDatabase, FilePosition, FileRange, NavigationTarget, RangeInfo}; | 22 | use crate::{ |
23 | db::RootDatabase, display::ToNav, FilePosition, FileRange, NavigationTarget, RangeInfo, | ||
24 | }; | ||
23 | 25 | ||
24 | pub(crate) use self::{ | 26 | pub(crate) use self::{ |
25 | classify::{classify_name, classify_name_ref}, | 27 | classify::{classify_name, classify_name_ref}, |
@@ -76,16 +78,15 @@ pub(crate) fn find_all_refs( | |||
76 | let RangeInfo { range, info: (name, def) } = find_name(db, &syntax, position)?; | 78 | let RangeInfo { range, info: (name, def) } = find_name(db, &syntax, position)?; |
77 | 79 | ||
78 | let declaration = match def.kind { | 80 | let declaration = match def.kind { |
79 | NameKind::Macro(mac) => NavigationTarget::from_macro_def(db, mac), | 81 | NameKind::Macro(mac) => mac.to_nav(db), |
80 | NameKind::Field(field) => NavigationTarget::from_field(db, field), | 82 | NameKind::Field(field) => field.to_nav(db), |
81 | NameKind::AssocItem(assoc) => NavigationTarget::from_assoc_item(db, assoc), | 83 | NameKind::AssocItem(assoc) => assoc.to_nav(db), |
82 | NameKind::Def(def) => NavigationTarget::from_def(db, def)?, | 84 | NameKind::Def(def) => NavigationTarget::from_def(db, def)?, |
83 | NameKind::SelfType(ref ty) => match ty.as_adt() { | 85 | NameKind::SelfType(ref ty) => match ty.as_adt() { |
84 | Some((def_id, _)) => NavigationTarget::from_adt_def(db, def_id), | 86 | Some((adt, _)) => adt.to_nav(db), |
85 | None => return None, | 87 | None => return None, |
86 | }, | 88 | }, |
87 | NameKind::Pat((_, pat)) => NavigationTarget::from_pat(db, position.file_id, pat), | 89 | NameKind::Local(local) => local.to_nav(db), |
88 | NameKind::SelfParam(par) => NavigationTarget::from_self_param(position.file_id, par), | ||
89 | NameKind::GenericParam(_) => return None, | 90 | NameKind::GenericParam(_) => return None, |
90 | }; | 91 | }; |
91 | 92 | ||