From 7c25224f0522cb828c4aa2d791562b84ee2995f9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 18 Dec 2019 16:25:15 +0100 Subject: Don't bother with focus range for navigation to locals --- crates/ra_ide/src/goto_definition.rs | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'crates/ra_ide/src/goto_definition.rs') 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 { "T", ); } + + #[test] + fn goto_within_macro() { + check_goto( + " + //- /lib.rs + macro_rules! id { + ($($tt:tt)*) => ($($tt)*) + } + + fn foo() { + let x = 1; + id!({ + let y = <|>x; + let z = y; + }); + } + ", + "x BIND_PAT FileId(1) [69; 70)", + "x", + ); + + check_goto( + " + //- /lib.rs + macro_rules! id { + ($($tt:tt)*) => ($($tt)*) + } + + fn foo() { + let x = 1; + id!({ + let y = x; + let z = <|>y; + }); + } + ", + "y BIND_PAT FileId(1) [98; 99)", + "y", + ); + } } -- cgit v1.2.3