aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/call_hierarchy.rs20
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs2
2 files changed, 7 insertions, 15 deletions
diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs
index f984f40ad..51ac59a71 100644
--- a/crates/ra_ide/src/call_hierarchy.rs
+++ b/crates/ra_ide/src/call_hierarchy.rs
@@ -4,16 +4,11 @@ use indexmap::IndexMap;
4 4
5use hir::db::AstDatabase; 5use hir::db::AstDatabase;
6use ra_ide_db::RootDatabase; 6use ra_ide_db::RootDatabase;
7use ra_syntax::{ 7use ra_syntax::{ast, match_ast, AstNode, TextRange};
8 ast::{self, DocCommentsOwner},
9 match_ast, AstNode, TextRange,
10};
11 8
12use crate::{ 9use crate::{
13 call_info::FnCallNode, 10 call_info::FnCallNode, display::ToNav, expand::descend_into_macros, goto_definition,
14 display::{ShortLabel, ToNav}, 11 references, FilePosition, NavigationTarget, RangeInfo,
15 expand::descend_into_macros,
16 goto_definition, references, FilePosition, NavigationTarget, RangeInfo,
17}; 12};
18 13
19#[derive(Debug, Clone)] 14#[derive(Debug, Clone)]
@@ -49,6 +44,7 @@ pub(crate) fn incoming_calls(db: &RootDatabase, position: FilePosition) -> Optio
49 let refs = references::find_all_refs(db, position, None)?; 44 let refs = references::find_all_refs(db, position, None)?;
50 45
51 let mut calls = CallLocations::default(); 46 let mut calls = CallLocations::default();
47 let mut sb = hir::SourceBinder::new(db);
52 48
53 for reference in refs.info.references() { 49 for reference in refs.info.references() {
54 let file_id = reference.file_range.file_id; 50 let file_id = reference.file_range.file_id;
@@ -62,12 +58,8 @@ pub(crate) fn incoming_calls(db: &RootDatabase, position: FilePosition) -> Optio
62 match_ast! { 58 match_ast! {
63 match node { 59 match node {
64 ast::FnDef(it) => { 60 ast::FnDef(it) => {
65 Some(NavigationTarget::from_named( 61 let def = sb.to_def(token.with_value(it))?;
66 db, 62 Some(def.to_nav(sb.db))
67 token.with_value(&it),
68 it.doc_comment_text(),
69 it.short_label(),
70 ))
71 }, 63 },
72 _ => { None }, 64 _ => { None },
73 } 65 }
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs
index b42cb477e..c9d0058a6 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -125,7 +125,7 @@ impl NavigationTarget {
125 } 125 }
126 126
127 /// Allows `NavigationTarget` to be created from a `NameOwner` 127 /// Allows `NavigationTarget` to be created from a `NameOwner`
128 pub(crate) fn from_named( 128 fn from_named(
129 db: &RootDatabase, 129 db: &RootDatabase,
130 node: InFile<&dyn ast::NameOwner>, 130 node: InFile<&dyn ast::NameOwner>,
131 docs: Option<String>, 131 docs: Option<String>,