From 19e28888aa41b2845b47adb7314aed99d3c48679 Mon Sep 17 00:00:00 2001 From: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> Date: Fri, 1 May 2020 16:26:22 +0200 Subject: wip Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> --- crates/ra_ide/src/goto_definition.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index 1dfca819d..31f567541 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs @@ -243,6 +243,24 @@ mod tests { ); } + #[test] + fn goto_def_for_use_alias() { + covers!(ra_ide_db::goto_def_for_use_alias); + check_goto( + " + //- /lib.rs + use foo as <|>bar; + + + //- /foo/lib.rs + #[macro_export] + macro_rules! foo { () => { () } } + ", + "foo MACRO_CALL FileId(2) 0..49 29..32", + "#[macro_export]\nmacro_rules! foo { () => { () } }|foo", + ); + } + #[test] fn goto_def_for_macros_in_use_tree() { check_goto( -- cgit v1.2.3 From 99c2ca84945cb12d51ca4353ac20f844e7b40eaa Mon Sep 17 00:00:00 2001 From: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> Date: Sat, 2 May 2020 21:42:27 +0200 Subject: add support of use alias semantic in definition #4202 Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> --- crates/ra_ide/src/goto_definition.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index 31f567541..5b9b3eef8 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs @@ -249,9 +249,24 @@ mod tests { check_goto( " //- /lib.rs - use foo as <|>bar; + use foo as bar<|>; + //- /foo/lib.rs + #[macro_export] + macro_rules! foo { () => { () } }", + "SOURCE_FILE FileId(2) 0..50", + "#[macro_export]\nmacro_rules! foo { () => { () } }\n", + ); + } + + #[test] + fn goto_def_for_use_alias_foo_macro() { + check_goto( + " + //- /lib.rs + use foo::foo as bar<|>; + //- /foo/lib.rs #[macro_export] macro_rules! foo { () => { () } } -- cgit v1.2.3