aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/goto_definition.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/goto_definition.rs')
-rw-r--r--crates/ra_ide/src/goto_definition.rs90
1 files changed, 45 insertions, 45 deletions
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs
index 9998ca5a3..1dfca819d 100644
--- a/crates/ra_ide/src/goto_definition.rs
+++ b/crates/ra_ide/src/goto_definition.rs
@@ -140,7 +140,7 @@ mod tests {
140 struct Foo; 140 struct Foo;
141 enum E { X(Foo<|>) } 141 enum E { X(Foo<|>) }
142 ", 142 ",
143 "Foo STRUCT_DEF FileId(1) [0; 11) [7; 10)", 143 "Foo STRUCT_DEF FileId(1) 0..11 7..10",
144 "struct Foo;|Foo", 144 "struct Foo;|Foo",
145 ); 145 );
146 } 146 }
@@ -153,7 +153,7 @@ mod tests {
153 struct Foo; 153 struct Foo;
154 enum E { X(<|>Foo) } 154 enum E { X(<|>Foo) }
155 ", 155 ",
156 "Foo STRUCT_DEF FileId(1) [0; 11) [7; 10)", 156 "Foo STRUCT_DEF FileId(1) 0..11 7..10",
157 "struct Foo;|Foo", 157 "struct Foo;|Foo",
158 ); 158 );
159 } 159 }
@@ -174,7 +174,7 @@ mod tests {
174 //- /b.rs 174 //- /b.rs
175 struct Foo; 175 struct Foo;
176 ", 176 ",
177 "Foo STRUCT_DEF FileId(2) [0; 11) [7; 10)", 177 "Foo STRUCT_DEF FileId(2) 0..11 7..10",
178 "struct Foo;|Foo", 178 "struct Foo;|Foo",
179 ); 179 );
180 } 180 }
@@ -189,7 +189,7 @@ mod tests {
189 //- /foo.rs 189 //- /foo.rs
190 // empty 190 // empty
191 ", 191 ",
192 "foo SOURCE_FILE FileId(2) [0; 10)", 192 "foo SOURCE_FILE FileId(2) 0..10",
193 "// empty\n\n", 193 "// empty\n\n",
194 ); 194 );
195 195
@@ -201,7 +201,7 @@ mod tests {
201 //- /foo/mod.rs 201 //- /foo/mod.rs
202 // empty 202 // empty
203 ", 203 ",
204 "foo SOURCE_FILE FileId(2) [0; 10)", 204 "foo SOURCE_FILE FileId(2) 0..10",
205 "// empty\n\n", 205 "// empty\n\n",
206 ); 206 );
207 } 207 }
@@ -218,7 +218,7 @@ mod tests {
218 <|>foo!(); 218 <|>foo!();
219 } 219 }
220 ", 220 ",
221 "foo MACRO_CALL FileId(1) [0; 33) [13; 16)", 221 "foo MACRO_CALL FileId(1) 0..33 13..16",
222 "macro_rules! foo { () => { () } }|foo", 222 "macro_rules! foo { () => { () } }|foo",
223 ); 223 );
224 } 224 }
@@ -238,7 +238,7 @@ mod tests {
238 #[macro_export] 238 #[macro_export]
239 macro_rules! foo { () => { () } } 239 macro_rules! foo { () => { () } }
240 ", 240 ",
241 "foo MACRO_CALL FileId(2) [0; 49) [29; 32)", 241 "foo MACRO_CALL FileId(2) 0..49 29..32",
242 "#[macro_export]\nmacro_rules! foo { () => { () } }|foo", 242 "#[macro_export]\nmacro_rules! foo { () => { () } }|foo",
243 ); 243 );
244 } 244 }
@@ -254,7 +254,7 @@ mod tests {
254 #[macro_export] 254 #[macro_export]
255 macro_rules! foo { () => { () } } 255 macro_rules! foo { () => { () } }
256 ", 256 ",
257 "foo MACRO_CALL FileId(2) [0; 49) [29; 32)", 257 "foo MACRO_CALL FileId(2) 0..49 29..32",
258 "#[macro_export]\nmacro_rules! foo { () => { () } }|foo", 258 "#[macro_export]\nmacro_rules! foo { () => { () } }|foo",
259 ); 259 );
260 } 260 }
@@ -274,7 +274,7 @@ mod tests {
274 <|>foo(); 274 <|>foo();
275 } 275 }
276 ", 276 ",
277 "foo FN_DEF FileId(1) [64; 80) [75; 78)", 277 "foo FN_DEF FileId(1) 64..80 75..78",
278 "define_fn!(foo);|foo", 278 "define_fn!(foo);|foo",
279 ); 279 );
280 } 280 }
@@ -294,7 +294,7 @@ mod tests {
294 <|>foo(); 294 <|>foo();
295 } 295 }
296 ", 296 ",
297 "foo FN_DEF FileId(1) [51; 64) [51; 64)", 297 "foo FN_DEF FileId(1) 51..64 51..64",
298 "define_fn!();|define_fn!();", 298 "define_fn!();|define_fn!();",
299 ); 299 );
300 } 300 }
@@ -312,7 +312,7 @@ mod tests {
312 } 312 }
313 } 313 }
314 ", 314 ",
315 "foo MACRO_CALL FileId(1) [0; 28) [13; 16)", 315 "foo MACRO_CALL FileId(1) 0..28 13..16",
316 "macro_rules! foo {() => {0}}|foo", 316 "macro_rules! foo {() => {0}}|foo",
317 ); 317 );
318 } 318 }
@@ -330,7 +330,7 @@ mod tests {
330 } 330 }
331 } 331 }
332 ", 332 ",
333 "foo MACRO_CALL FileId(1) [0; 28) [13; 16)", 333 "foo MACRO_CALL FileId(1) 0..28 13..16",
334 "macro_rules! foo {() => {0}}|foo", 334 "macro_rules! foo {() => {0}}|foo",
335 ); 335 );
336 } 336 }
@@ -350,7 +350,7 @@ mod tests {
350 foo.frobnicate<|>(); 350 foo.frobnicate<|>();
351 } 351 }
352 ", 352 ",
353 "frobnicate FN_DEF FileId(1) [27; 51) [30; 40)", 353 "frobnicate FN_DEF FileId(1) 27..51 30..40",
354 "fn frobnicate(&self) { }|frobnicate", 354 "fn frobnicate(&self) { }|frobnicate",
355 ); 355 );
356 } 356 }
@@ -369,7 +369,7 @@ mod tests {
369 foo.spam<|>; 369 foo.spam<|>;
370 } 370 }
371 ", 371 ",
372 "spam RECORD_FIELD_DEF FileId(1) [17; 26) [17; 21)", 372 "spam RECORD_FIELD_DEF FileId(1) 17..26 17..21",
373 "spam: u32|spam", 373 "spam: u32|spam",
374 ); 374 );
375 } 375 }
@@ -390,7 +390,7 @@ mod tests {
390 } 390 }
391 } 391 }
392 ", 392 ",
393 "spam RECORD_FIELD_DEF FileId(1) [17; 26) [17; 21)", 393 "spam RECORD_FIELD_DEF FileId(1) 17..26 17..21",
394 "spam: u32|spam", 394 "spam: u32|spam",
395 ); 395 );
396 } 396 }
@@ -409,7 +409,7 @@ mod tests {
409 let Foo { spam<|>: _, } = foo 409 let Foo { spam<|>: _, } = foo
410 } 410 }
411 ", 411 ",
412 "spam RECORD_FIELD_DEF FileId(1) [17; 26) [17; 21)", 412 "spam RECORD_FIELD_DEF FileId(1) 17..26 17..21",
413 "spam: u32|spam", 413 "spam: u32|spam",
414 ); 414 );
415 } 415 }
@@ -426,7 +426,7 @@ mod tests {
426 Foo { spam<|>: m!() } 426 Foo { spam<|>: m!() }
427 } 427 }
428 ", 428 ",
429 "spam RECORD_FIELD_DEF FileId(1) [45; 54) [45; 49)", 429 "spam RECORD_FIELD_DEF FileId(1) 45..54 45..49",
430 "spam: u32|spam", 430 "spam: u32|spam",
431 ); 431 );
432 } 432 }
@@ -443,7 +443,7 @@ mod tests {
443 foo.<|>0; 443 foo.<|>0;
444 } 444 }
445 ", 445 ",
446 "TUPLE_FIELD_DEF FileId(1) [11; 14)", 446 "TUPLE_FIELD_DEF FileId(1) 11..14",
447 "u32", 447 "u32",
448 ); 448 );
449 } 449 }
@@ -462,7 +462,7 @@ mod tests {
462 Foo::frobnicate<|>(); 462 Foo::frobnicate<|>();
463 } 463 }
464 ", 464 ",
465 "frobnicate FN_DEF FileId(1) [27; 46) [30; 40)", 465 "frobnicate FN_DEF FileId(1) 27..46 30..40",
466 "fn frobnicate() { }|frobnicate", 466 "fn frobnicate() { }|frobnicate",
467 ); 467 );
468 } 468 }
@@ -480,7 +480,7 @@ mod tests {
480 Foo::frobnicate<|>(); 480 Foo::frobnicate<|>();
481 } 481 }
482 ", 482 ",
483 "frobnicate FN_DEF FileId(1) [16; 32) [19; 29)", 483 "frobnicate FN_DEF FileId(1) 16..32 19..29",
484 "fn frobnicate();|frobnicate", 484 "fn frobnicate();|frobnicate",
485 ); 485 );
486 } 486 }
@@ -500,7 +500,7 @@ mod tests {
500 Foo::frobnicate<|>(); 500 Foo::frobnicate<|>();
501 } 501 }
502 ", 502 ",
503 "frobnicate FN_DEF FileId(1) [30; 46) [33; 43)", 503 "frobnicate FN_DEF FileId(1) 30..46 33..43",
504 "fn frobnicate();|frobnicate", 504 "fn frobnicate();|frobnicate",
505 ); 505 );
506 } 506 }
@@ -517,7 +517,7 @@ mod tests {
517 } 517 }
518 } 518 }
519 ", 519 ",
520 "impl IMPL_DEF FileId(1) [12; 73)", 520 "impl IMPL_DEF FileId(1) 12..73",
521 "impl Foo {...}", 521 "impl Foo {...}",
522 ); 522 );
523 523
@@ -531,7 +531,7 @@ mod tests {
531 } 531 }
532 } 532 }
533 ", 533 ",
534 "impl IMPL_DEF FileId(1) [12; 73)", 534 "impl IMPL_DEF FileId(1) 12..73",
535 "impl Foo {...}", 535 "impl Foo {...}",
536 ); 536 );
537 537
@@ -545,7 +545,7 @@ mod tests {
545 } 545 }
546 } 546 }
547 ", 547 ",
548 "impl IMPL_DEF FileId(1) [15; 75)", 548 "impl IMPL_DEF FileId(1) 15..75",
549 "impl Foo {...}", 549 "impl Foo {...}",
550 ); 550 );
551 551
@@ -558,7 +558,7 @@ mod tests {
558 } 558 }
559 } 559 }
560 ", 560 ",
561 "impl IMPL_DEF FileId(1) [15; 62)", 561 "impl IMPL_DEF FileId(1) 15..62",
562 "impl Foo {...}", 562 "impl Foo {...}",
563 ); 563 );
564 } 564 }
@@ -578,7 +578,7 @@ mod tests {
578 } 578 }
579 } 579 }
580 ", 580 ",
581 "impl IMPL_DEF FileId(1) [49; 115)", 581 "impl IMPL_DEF FileId(1) 49..115",
582 "impl Make for Foo {...}", 582 "impl Make for Foo {...}",
583 ); 583 );
584 584
@@ -595,7 +595,7 @@ mod tests {
595 } 595 }
596 } 596 }
597 ", 597 ",
598 "impl IMPL_DEF FileId(1) [49; 115)", 598 "impl IMPL_DEF FileId(1) 49..115",
599 "impl Make for Foo {...}", 599 "impl Make for Foo {...}",
600 ); 600 );
601 } 601 }
@@ -607,7 +607,7 @@ mod tests {
607 //- /lib.rs 607 //- /lib.rs
608 struct Foo<|> { value: u32 } 608 struct Foo<|> { value: u32 }
609 ", 609 ",
610 "Foo STRUCT_DEF FileId(1) [0; 25) [7; 10)", 610 "Foo STRUCT_DEF FileId(1) 0..25 7..10",
611 "struct Foo { value: u32 }|Foo", 611 "struct Foo { value: u32 }|Foo",
612 ); 612 );
613 613
@@ -618,7 +618,7 @@ mod tests {
618 field<|>: string, 618 field<|>: string,
619 } 619 }
620 "#, 620 "#,
621 "field RECORD_FIELD_DEF FileId(1) [17; 30) [17; 22)", 621 "field RECORD_FIELD_DEF FileId(1) 17..30 17..22",
622 "field: string|field", 622 "field: string|field",
623 ); 623 );
624 624
@@ -627,7 +627,7 @@ mod tests {
627 //- /lib.rs 627 //- /lib.rs
628 fn foo_test<|>() { } 628 fn foo_test<|>() { }
629 ", 629 ",
630 "foo_test FN_DEF FileId(1) [0; 17) [3; 11)", 630 "foo_test FN_DEF FileId(1) 0..17 3..11",
631 "fn foo_test() { }|foo_test", 631 "fn foo_test() { }|foo_test",
632 ); 632 );
633 633
@@ -638,7 +638,7 @@ mod tests {
638 Variant, 638 Variant,
639 } 639 }
640 ", 640 ",
641 "Foo ENUM_DEF FileId(1) [0; 25) [5; 8)", 641 "Foo ENUM_DEF FileId(1) 0..25 5..8",
642 "enum Foo {...}|Foo", 642 "enum Foo {...}|Foo",
643 ); 643 );
644 644
@@ -651,7 +651,7 @@ mod tests {
651 Variant3, 651 Variant3,
652 } 652 }
653 ", 653 ",
654 "Variant2 ENUM_VARIANT FileId(1) [29; 37) [29; 37)", 654 "Variant2 ENUM_VARIANT FileId(1) 29..37 29..37",
655 "Variant2|Variant2", 655 "Variant2|Variant2",
656 ); 656 );
657 657
@@ -660,7 +660,7 @@ mod tests {
660 //- /lib.rs 660 //- /lib.rs
661 static INNER<|>: &str = ""; 661 static INNER<|>: &str = "";
662 "#, 662 "#,
663 "INNER STATIC_DEF FileId(1) [0; 24) [7; 12)", 663 "INNER STATIC_DEF FileId(1) 0..24 7..12",
664 "static INNER: &str = \"\";|INNER", 664 "static INNER: &str = \"\";|INNER",
665 ); 665 );
666 666
@@ -669,7 +669,7 @@ mod tests {
669 //- /lib.rs 669 //- /lib.rs
670 const INNER<|>: &str = ""; 670 const INNER<|>: &str = "";
671 "#, 671 "#,
672 "INNER CONST_DEF FileId(1) [0; 23) [6; 11)", 672 "INNER CONST_DEF FileId(1) 0..23 6..11",
673 "const INNER: &str = \"\";|INNER", 673 "const INNER: &str = \"\";|INNER",
674 ); 674 );
675 675
@@ -678,7 +678,7 @@ mod tests {
678 //- /lib.rs 678 //- /lib.rs
679 type Thing<|> = Option<()>; 679 type Thing<|> = Option<()>;
680 "#, 680 "#,
681 "Thing TYPE_ALIAS_DEF FileId(1) [0; 24) [5; 10)", 681 "Thing TYPE_ALIAS_DEF FileId(1) 0..24 5..10",
682 "type Thing = Option<()>;|Thing", 682 "type Thing = Option<()>;|Thing",
683 ); 683 );
684 684
@@ -687,7 +687,7 @@ mod tests {
687 //- /lib.rs 687 //- /lib.rs
688 trait Foo<|> { } 688 trait Foo<|> { }
689 "#, 689 "#,
690 "Foo TRAIT_DEF FileId(1) [0; 13) [6; 9)", 690 "Foo TRAIT_DEF FileId(1) 0..13 6..9",
691 "trait Foo { }|Foo", 691 "trait Foo { }|Foo",
692 ); 692 );
693 693
@@ -696,7 +696,7 @@ mod tests {
696 //- /lib.rs 696 //- /lib.rs
697 mod bar<|> { } 697 mod bar<|> { }
698 "#, 698 "#,
699 "bar MODULE FileId(1) [0; 11) [4; 7)", 699 "bar MODULE FileId(1) 0..11 4..7",
700 "mod bar { }|bar", 700 "mod bar { }|bar",
701 ); 701 );
702 } 702 }
@@ -717,7 +717,7 @@ mod tests {
717 } 717 }
718 mod confuse_index { fn foo(); } 718 mod confuse_index { fn foo(); }
719 ", 719 ",
720 "foo FN_DEF FileId(1) [52; 63) [55; 58)", 720 "foo FN_DEF FileId(1) 52..63 55..58",
721 "fn foo() {}|foo", 721 "fn foo() {}|foo",
722 ); 722 );
723 } 723 }
@@ -746,7 +746,7 @@ mod tests {
746 format!(\"{}\", fo<|>o()) 746 format!(\"{}\", fo<|>o())
747 } 747 }
748 ", 748 ",
749 "foo FN_DEF FileId(1) [398; 415) [401; 404)", 749 "foo FN_DEF FileId(1) 398..415 401..404",
750 "fn foo() -> i8 {}|foo", 750 "fn foo() -> i8 {}|foo",
751 ); 751 );
752 } 752 }
@@ -760,7 +760,7 @@ mod tests {
760 t: <|>T, 760 t: <|>T,
761 } 761 }
762 ", 762 ",
763 "T TYPE_PARAM FileId(1) [11; 12)", 763 "T TYPE_PARAM FileId(1) 11..12",
764 "T", 764 "T",
765 ); 765 );
766 } 766 }
@@ -782,7 +782,7 @@ mod tests {
782 }); 782 });
783 } 783 }
784 ", 784 ",
785 "x BIND_PAT FileId(1) [69; 70)", 785 "x BIND_PAT FileId(1) 69..70",
786 "x", 786 "x",
787 ); 787 );
788 788
@@ -801,7 +801,7 @@ mod tests {
801 }); 801 });
802 } 802 }
803 ", 803 ",
804 "y BIND_PAT FileId(1) [98; 99)", 804 "y BIND_PAT FileId(1) 98..99",
805 "y", 805 "y",
806 ); 806 );
807 } 807 }
@@ -818,7 +818,7 @@ mod tests {
818 } 818 }
819 } 819 }
820 ", 820 ",
821 "x BIND_PAT FileId(1) [39; 40)", 821 "x BIND_PAT FileId(1) 39..40",
822 "x", 822 "x",
823 ); 823 );
824 } 824 }
@@ -833,7 +833,7 @@ mod tests {
833 <|>foo!(); 833 <|>foo!();
834 } 834 }
835 ", 835 ",
836 "foo MACRO_CALL FileId(1) [15; 48) [28; 31)", 836 "foo MACRO_CALL FileId(1) 15..48 28..31",
837 "macro_rules! foo { () => { () } }|foo", 837 "macro_rules! foo { () => { () } }|foo",
838 ); 838 );
839 } 839 }
@@ -850,7 +850,7 @@ mod tests {
850 Foo { x<|> }; 850 Foo { x<|> };
851 } 851 }
852 ", 852 ",
853 "x BIND_PAT FileId(1) [42; 43)", 853 "x BIND_PAT FileId(1) 42..43",
854 "x", 854 "x",
855 ) 855 )
856 } 856 }