diff options
Diffstat (limited to 'crates/ra_ide/src/goto_definition.rs')
-rw-r--r-- | crates/ra_ide/src/goto_definition.rs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index 48757f170..184555792 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs | |||
@@ -817,4 +817,45 @@ mod tests { | |||
817 | "T", | 817 | "T", |
818 | ); | 818 | ); |
819 | } | 819 | } |
820 | |||
821 | #[test] | ||
822 | fn goto_within_macro() { | ||
823 | check_goto( | ||
824 | " | ||
825 | //- /lib.rs | ||
826 | macro_rules! id { | ||
827 | ($($tt:tt)*) => ($($tt)*) | ||
828 | } | ||
829 | |||
830 | fn foo() { | ||
831 | let x = 1; | ||
832 | id!({ | ||
833 | let y = <|>x; | ||
834 | let z = y; | ||
835 | }); | ||
836 | } | ||
837 | ", | ||
838 | "x BIND_PAT FileId(1) [69; 70)", | ||
839 | "x", | ||
840 | ); | ||
841 | |||
842 | check_goto( | ||
843 | " | ||
844 | //- /lib.rs | ||
845 | macro_rules! id { | ||
846 | ($($tt:tt)*) => ($($tt)*) | ||
847 | } | ||
848 | |||
849 | fn foo() { | ||
850 | let x = 1; | ||
851 | id!({ | ||
852 | let y = x; | ||
853 | let z = <|>y; | ||
854 | }); | ||
855 | } | ||
856 | ", | ||
857 | "y BIND_PAT FileId(1) [98; 99)", | ||
858 | "y", | ||
859 | ); | ||
860 | } | ||
820 | } | 861 | } |