From bad4e48672f928644457cece3b7e21dd78ea1e9b Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sun, 21 Mar 2021 20:08:08 +0100 Subject: Set up a search scope when searching for mbe macro references --- crates/ide/src/references.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'crates/ide') diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index 379674530..95ed8a045 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs @@ -1294,4 +1294,34 @@ pub use level1::Foo; "#]], ); } + + #[test] + fn test_decl_macro_references() { + check( + r#" +//- /lib.rs crate:lib +#[macro_use] +mod qux; +mod bar; + +pub use self::foo; +//- /qux.rs +#[macro_export] +macro_rules! foo$0 { + () => {struct Foo;}; +} +//- /bar.rs +foo!(); +//- /other.rs crate:other deps:lib new_source_root: +lib::foo!(); +"#, + expect![[r#" + foo Macro FileId(1) 0..61 29..32 + + FileId(0) 46..49 + FileId(2) 0..3 + FileId(3) 5..8 + "#]], + ); + } } -- cgit v1.2.3