aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/references.rs
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-02-13 21:11:31 +0000
committerLukas Wirth <[email protected]>2021-02-13 21:11:31 +0000
commit403a63d2b49a5dc080d10bbd6bbb48acc6e15d55 (patch)
tree6e84e6e40f498a2c7f0bf4c2c6941b62895f5f4b /crates/ide/src/references.rs
parent205e72f34d26898779c8ab11c8500e74fd8ce28b (diff)
Don't classify attribute macros as their path unless it's a function with the proc_macro_attribute attribute
Diffstat (limited to 'crates/ide/src/references.rs')
-rw-r--r--crates/ide/src/references.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index c7cefb3b6..17086f7d4 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -1127,4 +1127,39 @@ impl Foo {
1127 "#]], 1127 "#]],
1128 ); 1128 );
1129 } 1129 }
1130
1131 #[test]
1132 fn test_attr_differs_from_fn_with_same_name() {
1133 check(
1134 r#"
1135#[test]
1136fn test$0() {
1137 test();
1138}
1139"#,
1140 expect![[r#"
1141 test Function FileId(0) 0..33 11..15
1142
1143 FileId(0) 24..28
1144 "#]],
1145 );
1146 }
1147
1148 #[test]
1149 fn test_attr_matches_proc_macro_fn() {
1150 check(
1151 r#"
1152#[proc_macro_attribute]
1153fn my_proc_macro() {}
1154
1155#[my_proc_macro$0]
1156fn test() {}
1157"#,
1158 expect![[r#"
1159 my_proc_macro Function FileId(0) 0..45 27..40
1160
1161 FileId(0) 49..62
1162 "#]],
1163 );
1164 }
1130} 1165}