diff options
author | Lukas Wirth <[email protected]> | 2021-03-21 19:08:08 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-03-23 10:32:10 +0000 |
commit | bad4e48672f928644457cece3b7e21dd78ea1e9b (patch) | |
tree | ae9a17f4f08b05204b78a5d015ff7ece1305e88d /crates/ide/src | |
parent | 1efd220f2f844596dd22bfd73a8a0c596354be38 (diff) |
Set up a search scope when searching for mbe macro references
Diffstat (limited to 'crates/ide/src')
-rw-r--r-- | crates/ide/src/references.rs | 30 |
1 files changed, 30 insertions, 0 deletions
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; | |||
1294 | "#]], | 1294 | "#]], |
1295 | ); | 1295 | ); |
1296 | } | 1296 | } |
1297 | |||
1298 | #[test] | ||
1299 | fn test_decl_macro_references() { | ||
1300 | check( | ||
1301 | r#" | ||
1302 | //- /lib.rs crate:lib | ||
1303 | #[macro_use] | ||
1304 | mod qux; | ||
1305 | mod bar; | ||
1306 | |||
1307 | pub use self::foo; | ||
1308 | //- /qux.rs | ||
1309 | #[macro_export] | ||
1310 | macro_rules! foo$0 { | ||
1311 | () => {struct Foo;}; | ||
1312 | } | ||
1313 | //- /bar.rs | ||
1314 | foo!(); | ||
1315 | //- /other.rs crate:other deps:lib new_source_root: | ||
1316 | lib::foo!(); | ||
1317 | "#, | ||
1318 | expect![[r#" | ||
1319 | foo Macro FileId(1) 0..61 29..32 | ||
1320 | |||
1321 | FileId(0) 46..49 | ||
1322 | FileId(2) 0..3 | ||
1323 | FileId(3) 5..8 | ||
1324 | "#]], | ||
1325 | ); | ||
1326 | } | ||
1297 | } | 1327 | } |