aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/navigation_target.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/navigation_target.rs')
-rw-r--r--crates/ra_ide_api/src/navigation_target.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/ra_ide_api/src/navigation_target.rs b/crates/ra_ide_api/src/navigation_target.rs
index 6538081ac..d806cb368 100644
--- a/crates/ra_ide_api/src/navigation_target.rs
+++ b/crates/ra_ide_api/src/navigation_target.rs
@@ -3,7 +3,7 @@ use ra_syntax::{
3 SyntaxNode, SyntaxNodePtr, AstNode, SmolStr, TextRange, ast, 3 SyntaxNode, SyntaxNodePtr, AstNode, SmolStr, TextRange, ast,
4 SyntaxKind::{self, NAME}, 4 SyntaxKind::{self, NAME},
5}; 5};
6use hir::{ModuleSource, FieldSource, Name}; 6use hir::{ModuleSource, FieldSource, Name, ImplItem};
7 7
8use crate::{FileSymbol, db::RootDatabase}; 8use crate::{FileSymbol, db::RootDatabase};
9 9
@@ -174,6 +174,20 @@ impl NavigationTarget {
174 ) 174 )
175 } 175 }
176 176
177 pub(crate) fn from_impl_item(db: &RootDatabase, impl_item: hir::ImplItem) -> NavigationTarget {
178 match impl_item {
179 ImplItem::Method(f) => NavigationTarget::from_function(db, f),
180 ImplItem::Const(c) => {
181 let (file_id, node) = c.source(db);
182 NavigationTarget::from_named(file_id.original_file(db), &*node)
183 }
184 ImplItem::TypeAlias(a) => {
185 let (file_id, node) = a.source(db);
186 NavigationTarget::from_named(file_id.original_file(db), &*node)
187 }
188 }
189 }
190
177 #[cfg(test)] 191 #[cfg(test)]
178 pub(crate) fn assert_match(&self, expected: &str) { 192 pub(crate) fn assert_match(&self, expected: &str) {
179 let actual = self.debug_render(); 193 let actual = self.debug_render();