@@ -4,16 +4,11 @@ use indexmap::IndexMap;
44
55use hir:: db:: AstDatabase ;
66use ra_ide_db:: RootDatabase ;
7- use ra_syntax:: {
8- ast:: { self , DocCommentsOwner } ,
9- match_ast, AstNode , TextRange ,
10- } ;
7+ use ra_syntax:: { ast, match_ast, AstNode , TextRange } ;
118
129use crate :: {
13- call_info:: FnCallNode ,
14- display:: { ShortLabel , ToNav } ,
15- expand:: descend_into_macros,
16- goto_definition, references, FilePosition , NavigationTarget , RangeInfo ,
10+ call_info:: FnCallNode , display:: ToNav , expand:: descend_into_macros, goto_definition,
11+ references, FilePosition , NavigationTarget , RangeInfo ,
1712} ;
1813
1914#[ derive( Debug , Clone ) ]
@@ -49,6 +44,7 @@ pub(crate) fn incoming_calls(db: &RootDatabase, position: FilePosition) -> Optio
4944 let refs = references:: find_all_refs ( db, position, None ) ?;
5045
5146 let mut calls = CallLocations :: default ( ) ;
47+ let mut sb = hir:: SourceBinder :: new ( db) ;
5248
5349 for reference in refs. info . references ( ) {
5450 let file_id = reference. file_range . file_id ;
@@ -62,12 +58,8 @@ pub(crate) fn incoming_calls(db: &RootDatabase, position: FilePosition) -> Optio
6258 match_ast ! {
6359 match node {
6460 ast:: FnDef ( it) => {
65- Some ( NavigationTarget :: from_named(
66- db,
67- token. with_value( & it) ,
68- it. doc_comment_text( ) ,
69- it. short_label( ) ,
70- ) )
61+ let def = sb. to_def( token. with_value( it) ) ?;
62+ Some ( def. to_nav( sb. db) )
7163 } ,
7264 _ => { None } ,
7365 }
0 commit comments