aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/references.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/references.rs')
-rw-r--r--crates/ra_ide/src/references.rs90
1 files changed, 37 insertions, 53 deletions
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs
index 7d0544ff4..a3970bf83 100644
--- a/crates/ra_ide/src/references.rs
+++ b/crates/ra_ide/src/references.rs
@@ -214,8 +214,8 @@ mod tests {
214 let refs = get_all_refs(code); 214 let refs = get_all_refs(code);
215 check_result( 215 check_result(
216 refs, 216 refs,
217 "Foo STRUCT_DEF FileId(1) [5; 39) [12; 15) Other", 217 "Foo STRUCT_DEF FileId(1) 5..39 12..15 Other",
218 &["FileId(1) [138; 141) StructLiteral"], 218 &["FileId(1) 138..141 StructLiteral"],
219 ); 219 );
220 } 220 }
221 221
@@ -231,8 +231,8 @@ mod tests {
231 let refs = get_all_refs(code); 231 let refs = get_all_refs(code);
232 check_result( 232 check_result(
233 refs, 233 refs,
234 "Foo STRUCT_DEF FileId(1) [5; 18) [12; 15) Other", 234 "Foo STRUCT_DEF FileId(1) 5..18 12..15 Other",
235 &["FileId(1) [54; 57) Other", "FileId(1) [71; 74) StructLiteral"], 235 &["FileId(1) 54..57 Other", "FileId(1) 71..74 StructLiteral"],
236 ); 236 );
237 } 237 }
238 238
@@ -248,8 +248,8 @@ mod tests {
248 let refs = get_all_refs(code); 248 let refs = get_all_refs(code);
249 check_result( 249 check_result(
250 refs, 250 refs,
251 "Foo STRUCT_DEF FileId(1) [5; 21) [12; 15) Other", 251 "Foo STRUCT_DEF FileId(1) 5..21 12..15 Other",
252 &["FileId(1) [81; 84) StructLiteral"], 252 &["FileId(1) 81..84 StructLiteral"],
253 ); 253 );
254 } 254 }
255 255
@@ -266,8 +266,8 @@ mod tests {
266 let refs = get_all_refs(code); 266 let refs = get_all_refs(code);
267 check_result( 267 check_result(
268 refs, 268 refs,
269 "Foo STRUCT_DEF FileId(1) [5; 21) [12; 15) Other", 269 "Foo STRUCT_DEF FileId(1) 5..21 12..15 Other",
270 &["FileId(1) [71; 74) StructLiteral"], 270 &["FileId(1) 71..74 StructLiteral"],
271 ); 271 );
272 } 272 }
273 273
@@ -289,12 +289,12 @@ mod tests {
289 let refs = get_all_refs(code); 289 let refs = get_all_refs(code);
290 check_result( 290 check_result(
291 refs, 291 refs,
292 "i BIND_PAT FileId(1) [33; 34) Other Write", 292 "i BIND_PAT FileId(1) 33..34 Other Write",
293 &[ 293 &[
294 "FileId(1) [67; 68) Other Write", 294 "FileId(1) 67..68 Other Write",
295 "FileId(1) [71; 72) Other Read", 295 "FileId(1) 71..72 Other Read",
296 "FileId(1) [101; 102) Other Write", 296 "FileId(1) 101..102 Other Write",
297 "FileId(1) [127; 128) Other Write", 297 "FileId(1) 127..128 Other Write",
298 ], 298 ],
299 ); 299 );
300 } 300 }
@@ -315,8 +315,8 @@ mod tests {
315 let refs = get_all_refs(code); 315 let refs = get_all_refs(code);
316 check_result( 316 check_result(
317 refs, 317 refs,
318 "spam BIND_PAT FileId(1) [44; 48) Other", 318 "spam BIND_PAT FileId(1) 44..48 Other",
319 &["FileId(1) [71; 75) Other Read", "FileId(1) [78; 82) Other Read"], 319 &["FileId(1) 71..75 Other Read", "FileId(1) 78..82 Other Read"],
320 ); 320 );
321 } 321 }
322 322
@@ -328,11 +328,7 @@ mod tests {
328 }"#; 328 }"#;
329 329
330 let refs = get_all_refs(code); 330 let refs = get_all_refs(code);
331 check_result( 331 check_result(refs, "i BIND_PAT FileId(1) 12..13 Other", &["FileId(1) 38..39 Other Read"]);
332 refs,
333 "i BIND_PAT FileId(1) [12; 13) Other",
334 &["FileId(1) [38; 39) Other Read"],
335 );
336 } 332 }
337 333
338 #[test] 334 #[test]
@@ -343,11 +339,7 @@ mod tests {
343 }"#; 339 }"#;
344 340
345 let refs = get_all_refs(code); 341 let refs = get_all_refs(code);
346 check_result( 342 check_result(refs, "i BIND_PAT FileId(1) 12..13 Other", &["FileId(1) 38..39 Other Read"]);
347 refs,
348 "i BIND_PAT FileId(1) [12; 13) Other",
349 &["FileId(1) [38; 39) Other Read"],
350 );
351 } 343 }
352 344
353 #[test] 345 #[test]
@@ -366,8 +358,8 @@ mod tests {
366 let refs = get_all_refs(code); 358 let refs = get_all_refs(code);
367 check_result( 359 check_result(
368 refs, 360 refs,
369 "spam RECORD_FIELD_DEF FileId(1) [66; 79) [70; 74) Other", 361 "spam RECORD_FIELD_DEF FileId(1) 66..79 70..74 Other",
370 &["FileId(1) [152; 156) Other Read"], 362 &["FileId(1) 152..156 Other Read"],
371 ); 363 );
372 } 364 }
373 365
@@ -382,7 +374,7 @@ mod tests {
382 "#; 374 "#;
383 375
384 let refs = get_all_refs(code); 376 let refs = get_all_refs(code);
385 check_result(refs, "f FN_DEF FileId(1) [88; 104) [91; 92) Other", &[]); 377 check_result(refs, "f FN_DEF FileId(1) 88..104 91..92 Other", &[]);
386 } 378 }
387 379
388 #[test] 380 #[test]
@@ -397,7 +389,7 @@ mod tests {
397 "#; 389 "#;
398 390
399 let refs = get_all_refs(code); 391 let refs = get_all_refs(code);
400 check_result(refs, "B ENUM_VARIANT FileId(1) [83; 84) [83; 84) Other", &[]); 392 check_result(refs, "B ENUM_VARIANT FileId(1) 83..84 83..84 Other", &[]);
401 } 393 }
402 394
403 #[test] 395 #[test]
@@ -438,8 +430,8 @@ mod tests {
438 let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); 430 let refs = analysis.find_all_refs(pos, None).unwrap().unwrap();
439 check_result( 431 check_result(
440 refs, 432 refs,
441 "Foo STRUCT_DEF FileId(2) [16; 50) [27; 30) Other", 433 "Foo STRUCT_DEF FileId(2) 16..50 27..30 Other",
442 &["FileId(1) [52; 55) StructLiteral", "FileId(3) [77; 80) StructLiteral"], 434 &["FileId(1) 52..55 StructLiteral", "FileId(3) 77..80 StructLiteral"],
443 ); 435 );
444 } 436 }
445 437
@@ -466,11 +458,7 @@ mod tests {
466 458
467 let (analysis, pos) = analysis_and_position(code); 459 let (analysis, pos) = analysis_and_position(code);
468 let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); 460 let refs = analysis.find_all_refs(pos, None).unwrap().unwrap();
469 check_result( 461 check_result(refs, "foo SOURCE_FILE FileId(2) 0..35 Other", &["FileId(1) 13..16 Other"]);
470 refs,
471 "foo SOURCE_FILE FileId(2) [0; 35) Other",
472 &["FileId(1) [13; 16) Other"],
473 );
474 } 462 }
475 463
476 #[test] 464 #[test]
@@ -497,8 +485,8 @@ mod tests {
497 let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); 485 let refs = analysis.find_all_refs(pos, None).unwrap().unwrap();
498 check_result( 486 check_result(
499 refs, 487 refs,
500 "Foo STRUCT_DEF FileId(3) [0; 41) [18; 21) Other", 488 "Foo STRUCT_DEF FileId(3) 0..41 18..21 Other",
501 &["FileId(2) [20; 23) Other", "FileId(2) [46; 49) StructLiteral"], 489 &["FileId(2) 20..23 Other", "FileId(2) 46..49 StructLiteral"],
502 ); 490 );
503 } 491 }
504 492
@@ -525,16 +513,16 @@ mod tests {
525 let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); 513 let refs = analysis.find_all_refs(pos, None).unwrap().unwrap();
526 check_result( 514 check_result(
527 refs, 515 refs,
528 "quux FN_DEF FileId(1) [18; 34) [25; 29) Other", 516 "quux FN_DEF FileId(1) 18..34 25..29 Other",
529 &["FileId(2) [16; 20) StructLiteral", "FileId(3) [16; 20) StructLiteral"], 517 &["FileId(2) 16..20 StructLiteral", "FileId(3) 16..20 StructLiteral"],
530 ); 518 );
531 519
532 let refs = 520 let refs =
533 analysis.find_all_refs(pos, Some(SearchScope::single_file(bar))).unwrap().unwrap(); 521 analysis.find_all_refs(pos, Some(SearchScope::single_file(bar))).unwrap().unwrap();
534 check_result( 522 check_result(
535 refs, 523 refs,
536 "quux FN_DEF FileId(1) [18; 34) [25; 29) Other", 524 "quux FN_DEF FileId(1) 18..34 25..29 Other",
537 &["FileId(3) [16; 20) StructLiteral"], 525 &["FileId(3) 16..20 StructLiteral"],
538 ); 526 );
539 } 527 }
540 528
@@ -552,8 +540,8 @@ mod tests {
552 let refs = get_all_refs(code); 540 let refs = get_all_refs(code);
553 check_result( 541 check_result(
554 refs, 542 refs,
555 "m1 MACRO_CALL FileId(1) [9; 63) [46; 48) Other", 543 "m1 MACRO_CALL FileId(1) 9..63 46..48 Other",
556 &["FileId(1) [96; 98) StructLiteral", "FileId(1) [114; 116) StructLiteral"], 544 &["FileId(1) 96..98 StructLiteral", "FileId(1) 114..116 StructLiteral"],
557 ); 545 );
558 } 546 }
559 547
@@ -568,8 +556,8 @@ mod tests {
568 let refs = get_all_refs(code); 556 let refs = get_all_refs(code);
569 check_result( 557 check_result(
570 refs, 558 refs,
571 "i BIND_PAT FileId(1) [40; 41) Other Write", 559 "i BIND_PAT FileId(1) 40..41 Other Write",
572 &["FileId(1) [59; 60) Other Write", "FileId(1) [63; 64) Other Read"], 560 &["FileId(1) 59..60 Other Write", "FileId(1) 63..64 Other Read"],
573 ); 561 );
574 } 562 }
575 563
@@ -588,8 +576,8 @@ mod tests {
588 let refs = get_all_refs(code); 576 let refs = get_all_refs(code);
589 check_result( 577 check_result(
590 refs, 578 refs,
591 "f RECORD_FIELD_DEF FileId(1) [32; 38) [32; 33) Other", 579 "f RECORD_FIELD_DEF FileId(1) 32..38 32..33 Other",
592 &["FileId(1) [96; 97) Other Read", "FileId(1) [117; 118) Other Write"], 580 &["FileId(1) 96..97 Other Read", "FileId(1) 117..118 Other Write"],
593 ); 581 );
594 } 582 }
595 583
@@ -602,11 +590,7 @@ mod tests {
602 }"#; 590 }"#;
603 591
604 let refs = get_all_refs(code); 592 let refs = get_all_refs(code);
605 check_result( 593 check_result(refs, "i BIND_PAT FileId(1) 36..37 Other", &["FileId(1) 51..52 Other Write"]);
606 refs,
607 "i BIND_PAT FileId(1) [36; 37) Other",
608 &["FileId(1) [51; 52) Other Write"],
609 );
610 } 594 }
611 595
612 fn get_all_refs(text: &str) -> ReferenceSearchResult { 596 fn get_all_refs(text: &str) -> ReferenceSearchResult {