diff options
author | Kevin DeLorey <[email protected]> | 2020-02-09 16:25:47 +0000 |
---|---|---|
committer | Kevin DeLorey <[email protected]> | 2020-02-09 16:37:43 +0000 |
commit | a957c473fdb79880c39b73dc9e0c923093cf16ac (patch) | |
tree | f998b548f530ce604651e0e6af314ed2ec74b3b5 /crates/ra_ide/src/goto_definition.rs | |
parent | 22caf982b99c54058e2e9200aeea0e61cada284a (diff) | |
parent | 1b9b13b4b4a75b5531c3f046ce6bf72d681f2732 (diff) |
Merge branch 'master' into kdelorey/complete-trait-impl
Diffstat (limited to 'crates/ra_ide/src/goto_definition.rs')
-rw-r--r-- | crates/ra_ide/src/goto_definition.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index 5a12a619c..de5551a4c 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs | |||
@@ -1,6 +1,7 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use hir::{db::AstDatabase, InFile, SourceBinder}; | 3 | use hir::{db::AstDatabase, InFile, SourceBinder}; |
4 | use ra_ide_db::{symbol_index, RootDatabase}; | ||
4 | use ra_syntax::{ | 5 | use ra_syntax::{ |
5 | ast::{self, DocCommentsOwner}, | 6 | ast::{self, DocCommentsOwner}, |
6 | match_ast, AstNode, | 7 | match_ast, AstNode, |
@@ -9,7 +10,6 @@ use ra_syntax::{ | |||
9 | }; | 10 | }; |
10 | 11 | ||
11 | use crate::{ | 12 | use crate::{ |
12 | db::RootDatabase, | ||
13 | display::{ShortLabel, ToNav}, | 13 | display::{ShortLabel, ToNav}, |
14 | expand::descend_into_macros, | 14 | expand::descend_into_macros, |
15 | references::{classify_name_ref, NameKind::*}, | 15 | references::{classify_name_ref, NameKind::*}, |
@@ -76,11 +76,10 @@ pub(crate) fn reference_definition( | |||
76 | let name_kind = classify_name_ref(sb, name_ref).map(|d| d.kind); | 76 | let name_kind = classify_name_ref(sb, name_ref).map(|d| d.kind); |
77 | match name_kind { | 77 | match name_kind { |
78 | Some(Macro(it)) => return Exact(it.to_nav(sb.db)), | 78 | Some(Macro(it)) => return Exact(it.to_nav(sb.db)), |
79 | Some(Field(it)) => return Exact(it.to_nav(sb.db)), | 79 | Some(StructField(it)) => return Exact(it.to_nav(sb.db)), |
80 | Some(TypeParam(it)) => return Exact(it.to_nav(sb.db)), | 80 | Some(TypeParam(it)) => return Exact(it.to_nav(sb.db)), |
81 | Some(AssocItem(it)) => return Exact(it.to_nav(sb.db)), | ||
82 | Some(Local(it)) => return Exact(it.to_nav(sb.db)), | 81 | Some(Local(it)) => return Exact(it.to_nav(sb.db)), |
83 | Some(Def(def)) => match NavigationTarget::from_def(sb.db, def) { | 82 | Some(ModuleDef(def)) => match NavigationTarget::from_def(sb.db, def) { |
84 | Some(nav) => return Exact(nav), | 83 | Some(nav) => return Exact(nav), |
85 | None => return Approximate(vec![]), | 84 | None => return Approximate(vec![]), |
86 | }, | 85 | }, |
@@ -94,7 +93,7 @@ pub(crate) fn reference_definition( | |||
94 | }; | 93 | }; |
95 | 94 | ||
96 | // Fallback index based approach: | 95 | // Fallback index based approach: |
97 | let navs = crate::symbol_index::index_resolve(sb.db, name_ref.value) | 96 | let navs = symbol_index::index_resolve(sb.db, name_ref.value) |
98 | .into_iter() | 97 | .into_iter() |
99 | .map(|s| s.to_nav(sb.db)) | 98 | .map(|s| s.to_nav(sb.db)) |
100 | .collect(); | 99 | .collect(); |