File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -376,16 +376,20 @@ impl ToNav for hir::Local {
376
376
impl ToNav for hir:: TypeParam {
377
377
fn to_nav ( & self , db : & RootDatabase ) -> NavigationTarget {
378
378
let src = self . source ( db) ;
379
- let range = match src. value {
379
+ let full_range = match & src. value {
380
380
Either :: Left ( it) => it. syntax ( ) . text_range ( ) ,
381
381
Either :: Right ( it) => it. syntax ( ) . text_range ( ) ,
382
382
} ;
383
+ let focus_range = match & src. value {
384
+ Either :: Left ( _) => None ,
385
+ Either :: Right ( it) => it. name ( ) . map ( |it| it. syntax ( ) . text_range ( ) ) ,
386
+ } ;
383
387
NavigationTarget {
384
388
file_id : src. file_id . original_file ( db) ,
385
389
name : self . name ( db) . to_string ( ) . into ( ) ,
386
390
kind : TYPE_PARAM ,
387
- full_range : range ,
388
- focus_range : None ,
391
+ full_range,
392
+ focus_range,
389
393
container_name : None ,
390
394
description : None ,
391
395
docs : None ,
Original file line number Diff line number Diff line change @@ -754,14 +754,14 @@ mod tests {
754
754
#[ test]
755
755
fn goto_for_type_param ( ) {
756
756
check_goto (
757
- "
757
+ r# "
758
758
//- /lib.rs
759
- struct Foo<T> {
759
+ struct Foo<T: Clone > {
760
760
t: <|>T,
761
761
}
762
- " ,
763
- "T TYPE_PARAM FileId(1) 11..12" ,
764
- "T" ,
762
+ "# ,
763
+ "T TYPE_PARAM FileId(1) 11..19 11.. 12" ,
764
+ "T: Clone|T " ,
765
765
) ;
766
766
}
767
767
You can’t perform that action at this time.
0 commit comments