aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/references.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/references.rs')
-rw-r--r--crates/ide/src/references.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index 55f95ebae..fef70533d 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -39,6 +39,15 @@ pub struct Declaration {
39 pub access: Option<ReferenceAccess>, 39 pub access: Option<ReferenceAccess>,
40} 40}
41 41
42// Feature: Find All References
43//
44// Shows all references of the item at the cursor location
45//
46// |===
47// | Editor | Shortcut
48//
49// | VS Code | kbd:[Shift+Alt+F12]
50// |===
42pub(crate) fn find_all_refs( 51pub(crate) fn find_all_refs(
43 sema: &Semantics<RootDatabase>, 52 sema: &Semantics<RootDatabase>,
44 position: FilePosition, 53 position: FilePosition,
@@ -1224,4 +1233,29 @@ fn test() {}
1224 "#]], 1233 "#]],
1225 ); 1234 );
1226 } 1235 }
1236
1237 #[test]
1238 fn test_const_in_pattern() {
1239 check(
1240 r#"
1241const A$0: i32 = 42;
1242
1243fn main() {
1244 match A {
1245 A => (),
1246 _ => (),
1247 }
1248 if let A = A {}
1249}
1250"#,
1251 expect![[r#"
1252 A Const FileId(0) 0..18 6..7
1253
1254 FileId(0) 42..43
1255 FileId(0) 54..55
1256 FileId(0) 97..98
1257 FileId(0) 101..102
1258 "#]],
1259 );
1260 }
1227} 1261}