aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/display/navigation_target.rs15
-rw-r--r--crates/ra_ide_api/src/goto_definition.rs2
-rw-r--r--crates/ra_ide_api/src/hover.rs6
-rw-r--r--crates/ra_ide_api/src/name_ref_kind.rs2
-rw-r--r--crates/ra_ide_api/src/syntax_highlighting.rs6
5 files changed, 17 insertions, 14 deletions
diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs
index 03382ab3c..11f73ccfd 100644
--- a/crates/ra_ide_api/src/display/navigation_target.rs
+++ b/crates/ra_ide_api/src/display/navigation_target.rs
@@ -1,4 +1,4 @@
1use hir::{FieldSource, HasSource, ImplItem, ModuleSource}; 1use hir::{AssocItem, FieldSource, HasSource, ModuleSource};
2use ra_db::{FileId, SourceDatabase}; 2use ra_db::{FileId, SourceDatabase};
3use ra_syntax::{ 3use ra_syntax::{
4 algo::visit::{visitor, Visitor}, 4 algo::visit::{visitor, Visitor},
@@ -221,11 +221,14 @@ impl NavigationTarget {
221 ) 221 )
222 } 222 }
223 223
224 pub(crate) fn from_impl_item(db: &RootDatabase, impl_item: hir::ImplItem) -> NavigationTarget { 224 pub(crate) fn from_assoc_item(
225 match impl_item { 225 db: &RootDatabase,
226 ImplItem::Method(it) => NavigationTarget::from_def_source(db, it), 226 assoc_item: hir::AssocItem,
227 ImplItem::Const(it) => NavigationTarget::from_def_source(db, it), 227 ) -> NavigationTarget {
228 ImplItem::TypeAlias(it) => NavigationTarget::from_def_source(db, it), 228 match assoc_item {
229 AssocItem::Function(it) => NavigationTarget::from_def_source(db, it),
230 AssocItem::Const(it) => NavigationTarget::from_def_source(db, it),
231 AssocItem::TypeAlias(it) => NavigationTarget::from_def_source(db, it),
229 } 232 }
230 } 233 }
231 234
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs
index 28529a2de..503dcacff 100644
--- a/crates/ra_ide_api/src/goto_definition.rs
+++ b/crates/ra_ide_api/src/goto_definition.rs
@@ -60,7 +60,7 @@ pub(crate) fn reference_definition(
60 match classify_name_ref(db, &analyzer, name_ref) { 60 match classify_name_ref(db, &analyzer, name_ref) {
61 Some(Macro(mac)) => return Exact(NavigationTarget::from_macro_def(db, mac)), 61 Some(Macro(mac)) => return Exact(NavigationTarget::from_macro_def(db, mac)),
62 Some(FieldAccess(field)) => return Exact(NavigationTarget::from_field(db, field)), 62 Some(FieldAccess(field)) => return Exact(NavigationTarget::from_field(db, field)),
63 Some(AssocItem(assoc)) => return Exact(NavigationTarget::from_impl_item(db, assoc)), 63 Some(AssocItem(assoc)) => return Exact(NavigationTarget::from_assoc_item(db, assoc)),
64 Some(Method(func)) => return Exact(NavigationTarget::from_def_source(db, func)), 64 Some(Method(func)) => return Exact(NavigationTarget::from_def_source(db, func)),
65 Some(Def(def)) => match NavigationTarget::from_def(db, def) { 65 Some(Def(def)) => match NavigationTarget::from_def(db, def) {
66 Some(nav) => return Exact(nav), 66 Some(nav) => return Exact(nav),
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs
index 28a6bef12..655bcdb16 100644
--- a/crates/ra_ide_api/src/hover.rs
+++ b/crates/ra_ide_api/src/hover.rs
@@ -117,9 +117,9 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn
117 } 117 }
118 } 118 }
119 Some(AssocItem(it)) => res.extend(match it { 119 Some(AssocItem(it)) => res.extend(match it {
120 hir::ImplItem::Method(it) => from_def_source(db, it), 120 hir::AssocItem::Function(it) => from_def_source(db, it),
121 hir::ImplItem::Const(it) => from_def_source(db, it), 121 hir::AssocItem::Const(it) => from_def_source(db, it),
122 hir::ImplItem::TypeAlias(it) => from_def_source(db, it), 122 hir::AssocItem::TypeAlias(it) => from_def_source(db, it),
123 }), 123 }),
124 Some(Def(it)) => { 124 Some(Def(it)) => {
125 match it { 125 match it {
diff --git a/crates/ra_ide_api/src/name_ref_kind.rs b/crates/ra_ide_api/src/name_ref_kind.rs
index 6c2a7b260..aff03464a 100644
--- a/crates/ra_ide_api/src/name_ref_kind.rs
+++ b/crates/ra_ide_api/src/name_ref_kind.rs
@@ -8,7 +8,7 @@ pub enum NameRefKind {
8 Method(hir::Function), 8 Method(hir::Function),
9 Macro(hir::MacroDef), 9 Macro(hir::MacroDef),
10 FieldAccess(hir::StructField), 10 FieldAccess(hir::StructField),
11 AssocItem(hir::ImplItem), 11 AssocItem(hir::AssocItem),
12 Def(hir::ModuleDef), 12 Def(hir::ModuleDef),
13 SelfType(hir::Ty), 13 SelfType(hir::Ty),
14 Pat(AstPtr<ast::BindPat>), 14 Pat(AstPtr<ast::BindPat>),
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs
index 86ab3a260..3d7f91c1d 100644
--- a/crates/ra_ide_api/src/syntax_highlighting.rs
+++ b/crates/ra_ide_api/src/syntax_highlighting.rs
@@ -102,9 +102,9 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
102 Some(Method(_)) => "function", 102 Some(Method(_)) => "function",
103 Some(Macro(_)) => "macro", 103 Some(Macro(_)) => "macro",
104 Some(FieldAccess(_)) => "field", 104 Some(FieldAccess(_)) => "field",
105 Some(AssocItem(hir::ImplItem::Method(_))) => "function", 105 Some(AssocItem(hir::AssocItem::Function(_))) => "function",
106 Some(AssocItem(hir::ImplItem::Const(_))) => "constant", 106 Some(AssocItem(hir::AssocItem::Const(_))) => "constant",
107 Some(AssocItem(hir::ImplItem::TypeAlias(_))) => "type", 107 Some(AssocItem(hir::AssocItem::TypeAlias(_))) => "type",
108 Some(Def(hir::ModuleDef::Module(_))) => "module", 108 Some(Def(hir::ModuleDef::Module(_))) => "module",
109 Some(Def(hir::ModuleDef::Function(_))) => "function", 109 Some(Def(hir::ModuleDef::Function(_))) => "function",
110 Some(Def(hir::ModuleDef::Adt(_))) => "type", 110 Some(Def(hir::ModuleDef::Adt(_))) => "type",