diff options
Diffstat (limited to 'crates/ra_ide_api/src/goto_definition.rs')
-rw-r--r-- | crates/ra_ide_api/src/goto_definition.rs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index b6c72efdf..c10a6c844 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs | |||
@@ -71,10 +71,11 @@ pub(crate) fn reference_definition( | |||
71 | Some(nav) => return Exact(nav), | 71 | Some(nav) => return Exact(nav), |
72 | None => return Approximate(vec![]), | 72 | None => return Approximate(vec![]), |
73 | }, | 73 | }, |
74 | Some(SelfType(ty)) => { | 74 | Some(SelfType(imp)) => { |
75 | if let Some((adt, _)) = ty.as_adt() { | 75 | // FIXME: ideally, this should point to the type in the impl, and |
76 | return Exact(adt.to_nav(db)); | 76 | // not at the whole impl. And goto **type** definition should bring |
77 | } | 77 | // us to the actual type |
78 | return Exact(imp.to_nav(db)); | ||
78 | } | 79 | } |
79 | Some(Local(local)) => return Exact(local.to_nav(db)), | 80 | Some(Local(local)) => return Exact(local.to_nav(db)), |
80 | Some(GenericParam(_)) => { | 81 | Some(GenericParam(_)) => { |
@@ -503,7 +504,7 @@ mod tests { | |||
503 | } | 504 | } |
504 | } | 505 | } |
505 | ", | 506 | ", |
506 | "Foo STRUCT_DEF FileId(1) [0; 11) [7; 10)", | 507 | "impl IMPL_BLOCK FileId(1) [12; 73)", |
507 | ); | 508 | ); |
508 | 509 | ||
509 | check_goto( | 510 | check_goto( |
@@ -516,7 +517,7 @@ mod tests { | |||
516 | } | 517 | } |
517 | } | 518 | } |
518 | ", | 519 | ", |
519 | "Foo STRUCT_DEF FileId(1) [0; 11) [7; 10)", | 520 | "impl IMPL_BLOCK FileId(1) [12; 73)", |
520 | ); | 521 | ); |
521 | 522 | ||
522 | check_goto( | 523 | check_goto( |
@@ -529,7 +530,7 @@ mod tests { | |||
529 | } | 530 | } |
530 | } | 531 | } |
531 | ", | 532 | ", |
532 | "Foo ENUM_DEF FileId(1) [0; 14) [5; 8)", | 533 | "impl IMPL_BLOCK FileId(1) [15; 75)", |
533 | ); | 534 | ); |
534 | 535 | ||
535 | check_goto( | 536 | check_goto( |
@@ -541,7 +542,7 @@ mod tests { | |||
541 | } | 542 | } |
542 | } | 543 | } |
543 | ", | 544 | ", |
544 | "Foo ENUM_DEF FileId(1) [0; 14) [5; 8)", | 545 | "impl IMPL_BLOCK FileId(1) [15; 62)", |
545 | ); | 546 | ); |
546 | } | 547 | } |
547 | 548 | ||
@@ -560,7 +561,7 @@ mod tests { | |||
560 | } | 561 | } |
561 | } | 562 | } |
562 | ", | 563 | ", |
563 | "Foo STRUCT_DEF FileId(1) [0; 11) [7; 10)", | 564 | "impl IMPL_BLOCK FileId(1) [49; 115)", |
564 | ); | 565 | ); |
565 | 566 | ||
566 | check_goto( | 567 | check_goto( |
@@ -572,11 +573,11 @@ mod tests { | |||
572 | } | 573 | } |
573 | impl Make for Foo { | 574 | impl Make for Foo { |
574 | fn new() -> Self<|> { | 575 | fn new() -> Self<|> { |
575 | Self{} | 576 | Self {} |
576 | } | 577 | } |
577 | } | 578 | } |
578 | ", | 579 | ", |
579 | "Foo STRUCT_DEF FileId(1) [0; 11) [7; 10)", | 580 | "impl IMPL_BLOCK FileId(1) [49; 115)", |
580 | ); | 581 | ); |
581 | } | 582 | } |
582 | 583 | ||