diff options
-rw-r--r-- | crates/ra_ide/src/hover.rs | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 39519df40..a4c97e7f9 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -368,7 +368,7 @@ mod tests { | |||
368 | let content = analysis.db.file_text(position.file_id); | 368 | let content = analysis.db.file_text(position.file_id); |
369 | let hovered_element = &content[hover.range]; | 369 | let hovered_element = &content[hover.range]; |
370 | 370 | ||
371 | let actual = format!("{}:\n{}\n", hovered_element, hover.info.markup); | 371 | let actual = format!("*{}*\n{}\n", hovered_element, hover.info.markup); |
372 | expect.assert_eq(&actual) | 372 | expect.assert_eq(&actual) |
373 | } | 373 | } |
374 | 374 | ||
@@ -389,7 +389,7 @@ fn main() { | |||
389 | } | 389 | } |
390 | "#, | 390 | "#, |
391 | expect![[r#" | 391 | expect![[r#" |
392 | foo(): | 392 | *foo()* |
393 | ```rust | 393 | ```rust |
394 | u32 | 394 | u32 |
395 | ``` | 395 | ``` |
@@ -421,7 +421,7 @@ fn main() { | |||
421 | } | 421 | } |
422 | "#, | 422 | "#, |
423 | expect![[r#" | 423 | expect![[r#" |
424 | iter: | 424 | *iter* |
425 | ```rust | 425 | ```rust |
426 | Iter<Scan<OtherStruct<OtherStruct<i32>>, |&mut u32, &u32, &mut u32| -> Option<u32>, u32>> | 426 | Iter<Scan<OtherStruct<OtherStruct<i32>>, |&mut u32, &u32, &mut u32| -> Option<u32>, u32>> |
427 | ``` | 427 | ``` |
@@ -439,7 +439,7 @@ pub fn foo() -> u32 { 1 } | |||
439 | fn main() { let foo_test = fo<|>o(); } | 439 | fn main() { let foo_test = fo<|>o(); } |
440 | "#, | 440 | "#, |
441 | expect![[r#" | 441 | expect![[r#" |
442 | foo: | 442 | *foo* |
443 | ```rust | 443 | ```rust |
444 | pub fn foo() -> u32 | 444 | pub fn foo() -> u32 |
445 | ``` | 445 | ``` |
@@ -466,7 +466,7 @@ mod c; | |||
466 | fn main() { let foo_test = fo<|>o(); } | 466 | fn main() { let foo_test = fo<|>o(); } |
467 | "#, | 467 | "#, |
468 | expect![[r#" | 468 | expect![[r#" |
469 | foo: | 469 | *foo* |
470 | ```rust | 470 | ```rust |
471 | {unknown} | 471 | {unknown} |
472 | ``` | 472 | ``` |
@@ -483,7 +483,7 @@ pub fn foo<'a, T: AsRef<str>>(b: &'a T) -> &'a str { } | |||
483 | fn main() { let foo_test = fo<|>o(); } | 483 | fn main() { let foo_test = fo<|>o(); } |
484 | "#, | 484 | "#, |
485 | expect![[r#" | 485 | expect![[r#" |
486 | foo: | 486 | *foo* |
487 | ```rust | 487 | ```rust |
488 | pub fn foo<'a, T: AsRef<str>>(b: &'a T) -> &'a str | 488 | pub fn foo<'a, T: AsRef<str>>(b: &'a T) -> &'a str |
489 | ``` | 489 | ``` |
@@ -500,7 +500,7 @@ pub fn foo<|>(a: u32, b: u32) -> u32 {} | |||
500 | fn main() { } | 500 | fn main() { } |
501 | "#, | 501 | "#, |
502 | expect![[r#" | 502 | expect![[r#" |
503 | foo: | 503 | *foo* |
504 | ```rust | 504 | ```rust |
505 | pub fn foo(a: u32, b: u32) -> u32 | 505 | pub fn foo(a: u32, b: u32) -> u32 |
506 | ``` | 506 | ``` |
@@ -520,7 +520,7 @@ fn main() { | |||
520 | } | 520 | } |
521 | "#, | 521 | "#, |
522 | expect![[r#" | 522 | expect![[r#" |
523 | field_a: | 523 | *field_a* |
524 | ```rust | 524 | ```rust |
525 | Foo | 525 | Foo |
526 | ``` | 526 | ``` |
@@ -541,7 +541,7 @@ fn main() { | |||
541 | } | 541 | } |
542 | "#, | 542 | "#, |
543 | expect![[r#" | 543 | expect![[r#" |
544 | field_a: | 544 | *field_a* |
545 | ```rust | 545 | ```rust |
546 | Foo | 546 | Foo |
547 | ``` | 547 | ``` |
@@ -558,7 +558,7 @@ fn main() { | |||
558 | check( | 558 | check( |
559 | r#"const foo<|>: u32 = 0;"#, | 559 | r#"const foo<|>: u32 = 0;"#, |
560 | expect![[r#" | 560 | expect![[r#" |
561 | foo: | 561 | *foo* |
562 | ```rust | 562 | ```rust |
563 | const foo: u32 | 563 | const foo: u32 |
564 | ``` | 564 | ``` |
@@ -567,7 +567,7 @@ fn main() { | |||
567 | check( | 567 | check( |
568 | r#"static foo<|>: u32 = 0;"#, | 568 | r#"static foo<|>: u32 = 0;"#, |
569 | expect![[r#" | 569 | expect![[r#" |
570 | foo: | 570 | *foo* |
571 | ```rust | 571 | ```rust |
572 | static foo: u32 | 572 | static foo: u32 |
573 | ``` | 573 | ``` |
@@ -585,7 +585,7 @@ fn main() { | |||
585 | let zz<|> = Test { t: 23u8, k: 33 }; | 585 | let zz<|> = Test { t: 23u8, k: 33 }; |
586 | }"#, | 586 | }"#, |
587 | expect![[r#" | 587 | expect![[r#" |
588 | zz: | 588 | *zz* |
589 | ```rust | 589 | ```rust |
590 | Test<i32, u8> | 590 | Test<i32, u8> |
591 | ``` | 591 | ``` |
@@ -603,7 +603,7 @@ use Option::Some; | |||
603 | fn main() { So<|>me(12); } | 603 | fn main() { So<|>me(12); } |
604 | "#, | 604 | "#, |
605 | expect![[r#" | 605 | expect![[r#" |
606 | Some: | 606 | *Some* |
607 | ```rust | 607 | ```rust |
608 | Option | 608 | Option |
609 | ``` | 609 | ``` |
@@ -622,7 +622,7 @@ use Option::Some; | |||
622 | fn main() { let b<|>ar = Some(12); } | 622 | fn main() { let b<|>ar = Some(12); } |
623 | "#, | 623 | "#, |
624 | expect![[r#" | 624 | expect![[r#" |
625 | bar: | 625 | *bar* |
626 | ```rust | 626 | ```rust |
627 | Option<i32> | 627 | Option<i32> |
628 | ``` | 628 | ``` |
@@ -640,7 +640,7 @@ enum Option<T> { | |||
640 | } | 640 | } |
641 | "#, | 641 | "#, |
642 | expect![[r#" | 642 | expect![[r#" |
643 | None: | 643 | *None* |
644 | ```rust | 644 | ```rust |
645 | Option | 645 | Option |
646 | ``` | 646 | ``` |
@@ -665,7 +665,7 @@ fn main() { | |||
665 | } | 665 | } |
666 | "#, | 666 | "#, |
667 | expect![[r#" | 667 | expect![[r#" |
668 | Some: | 668 | *Some* |
669 | ```rust | 669 | ```rust |
670 | Option | 670 | Option |
671 | ``` | 671 | ``` |
@@ -685,7 +685,7 @@ fn main() { | |||
685 | check( | 685 | check( |
686 | r#"fn func(foo: i32) { fo<|>o; }"#, | 686 | r#"fn func(foo: i32) { fo<|>o; }"#, |
687 | expect![[r#" | 687 | expect![[r#" |
688 | foo: | 688 | *foo* |
689 | ```rust | 689 | ```rust |
690 | i32 | 690 | i32 |
691 | ``` | 691 | ``` |
@@ -698,7 +698,7 @@ fn main() { | |||
698 | check( | 698 | check( |
699 | r#"fn func(fo<|>o: i32) {}"#, | 699 | r#"fn func(fo<|>o: i32) {}"#, |
700 | expect![[r#" | 700 | expect![[r#" |
701 | foo: | 701 | *foo* |
702 | ```rust | 702 | ```rust |
703 | i32 | 703 | i32 |
704 | ``` | 704 | ``` |
@@ -711,7 +711,7 @@ fn main() { | |||
711 | check( | 711 | check( |
712 | r#"fn func(foo: i32) { if true { <|>foo; }; }"#, | 712 | r#"fn func(foo: i32) { if true { <|>foo; }; }"#, |
713 | expect![[r#" | 713 | expect![[r#" |
714 | foo: | 714 | *foo* |
715 | ```rust | 715 | ```rust |
716 | i32 | 716 | i32 |
717 | ``` | 717 | ``` |
@@ -724,7 +724,7 @@ fn main() { | |||
724 | check( | 724 | check( |
725 | r#"fn func(<|>foo: i32) {}"#, | 725 | r#"fn func(<|>foo: i32) {}"#, |
726 | expect![[r#" | 726 | expect![[r#" |
727 | foo: | 727 | *foo* |
728 | ```rust | 728 | ```rust |
729 | i32 | 729 | i32 |
730 | ``` | 730 | ``` |
@@ -745,7 +745,7 @@ impl Thing { | |||
745 | fn main() { let foo_<|>test = Thing::new(); } | 745 | fn main() { let foo_<|>test = Thing::new(); } |
746 | "#, | 746 | "#, |
747 | expect![[r#" | 747 | expect![[r#" |
748 | foo_test: | 748 | *foo_test* |
749 | ```rust | 749 | ```rust |
750 | Thing | 750 | Thing |
751 | ``` | 751 | ``` |
@@ -768,7 +768,7 @@ mod wrapper { | |||
768 | fn main() { let foo_test = wrapper::Thing::new<|>(); } | 768 | fn main() { let foo_test = wrapper::Thing::new<|>(); } |
769 | "#, | 769 | "#, |
770 | expect![[r#" | 770 | expect![[r#" |
771 | new: | 771 | *new* |
772 | ```rust | 772 | ```rust |
773 | wrapper::Thing | 773 | wrapper::Thing |
774 | ``` | 774 | ``` |
@@ -798,7 +798,7 @@ fn main() { | |||
798 | } | 798 | } |
799 | "#, | 799 | "#, |
800 | expect![[r#" | 800 | expect![[r#" |
801 | C: | 801 | *C* |
802 | ```rust | 802 | ```rust |
803 | const C: u32 | 803 | const C: u32 |
804 | ``` | 804 | ``` |
@@ -816,7 +816,7 @@ impl Thing { | |||
816 | } | 816 | } |
817 | "#, | 817 | "#, |
818 | expect![[r#" | 818 | expect![[r#" |
819 | Self { x: 0 }: | 819 | *Self { x: 0 }* |
820 | ```rust | 820 | ```rust |
821 | Thing | 821 | Thing |
822 | ``` | 822 | ``` |
@@ -875,7 +875,7 @@ fn y() { | |||
875 | } | 875 | } |
876 | "#, | 876 | "#, |
877 | expect![[r#" | 877 | expect![[r#" |
878 | x: | 878 | *x* |
879 | ```rust | 879 | ```rust |
880 | i32 | 880 | i32 |
881 | ``` | 881 | ``` |
@@ -892,7 +892,7 @@ macro_rules! foo { () => {} } | |||
892 | fn f() { fo<|>o!(); } | 892 | fn f() { fo<|>o!(); } |
893 | "#, | 893 | "#, |
894 | expect![[r#" | 894 | expect![[r#" |
895 | foo: | 895 | *foo* |
896 | ```rust | 896 | ```rust |
897 | macro_rules! foo | 897 | macro_rules! foo |
898 | ``` | 898 | ``` |
@@ -905,7 +905,7 @@ fn f() { fo<|>o!(); } | |||
905 | check( | 905 | check( |
906 | r#"struct TS(String, i32<|>);"#, | 906 | r#"struct TS(String, i32<|>);"#, |
907 | expect![[r#" | 907 | expect![[r#" |
908 | i32: | 908 | *i32* |
909 | i32 | 909 | i32 |
910 | "#]], | 910 | "#]], |
911 | ) | 911 | ) |
@@ -922,7 +922,7 @@ id! { | |||
922 | } | 922 | } |
923 | "#, | 923 | "#, |
924 | expect![[r#" | 924 | expect![[r#" |
925 | foo: | 925 | *foo* |
926 | ```rust | 926 | ```rust |
927 | fn foo() | 927 | fn foo() |
928 | ``` | 928 | ``` |
@@ -938,7 +938,7 @@ macro_rules! id { ($($tt:tt)*) => { $($tt)* } } | |||
938 | fn foo(bar:u32) { let a = id!(ba<|>r); } | 938 | fn foo(bar:u32) { let a = id!(ba<|>r); } |
939 | "#, | 939 | "#, |
940 | expect![[r#" | 940 | expect![[r#" |
941 | bar: | 941 | *bar* |
942 | ```rust | 942 | ```rust |
943 | u32 | 943 | u32 |
944 | ``` | 944 | ``` |
@@ -955,7 +955,7 @@ macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } | |||
955 | fn foo(bar:u32) { let a = id!(ba<|>r); } | 955 | fn foo(bar:u32) { let a = id!(ba<|>r); } |
956 | "#, | 956 | "#, |
957 | expect![[r#" | 957 | expect![[r#" |
958 | bar: | 958 | *bar* |
959 | ```rust | 959 | ```rust |
960 | u32 | 960 | u32 |
961 | ``` | 961 | ``` |
@@ -973,7 +973,7 @@ fn bar() -> u32 { 0 } | |||
973 | fn foo() { let a = id!([0u32, bar(<|>)] ); } | 973 | fn foo() { let a = id!([0u32, bar(<|>)] ); } |
974 | "#, | 974 | "#, |
975 | expect![[r#" | 975 | expect![[r#" |
976 | bar(): | 976 | *bar()* |
977 | ```rust | 977 | ```rust |
978 | u32 | 978 | u32 |
979 | ``` | 979 | ``` |
@@ -992,7 +992,7 @@ fn foo() { | |||
992 | } | 992 | } |
993 | "#, | 993 | "#, |
994 | expect![[r#" | 994 | expect![[r#" |
995 | "Tracks": | 995 | *"Tracks"* |
996 | ```rust | 996 | ```rust |
997 | &str | 997 | &str |
998 | ``` | 998 | ``` |
@@ -1013,7 +1013,7 @@ fn foo() { | |||
1013 | } | 1013 | } |
1014 | "#, | 1014 | "#, |
1015 | expect![[r#" | 1015 | expect![[r#" |
1016 | bar: | 1016 | *bar* |
1017 | ```rust | 1017 | ```rust |
1018 | fn bar() -> bool | 1018 | fn bar() -> bool |
1019 | ``` | 1019 | ``` |
@@ -1045,7 +1045,7 @@ fn foo() { } | |||
1045 | fn bar() { fo<|>o(); } | 1045 | fn bar() { fo<|>o(); } |
1046 | ", | 1046 | ", |
1047 | expect![[r#" | 1047 | expect![[r#" |
1048 | foo: | 1048 | *foo* |
1049 | ```rust | 1049 | ```rust |
1050 | fn foo() | 1050 | fn foo() |
1051 | ``` | 1051 | ``` |
@@ -1061,7 +1061,7 @@ fn bar() { fo<|>o(); } | |||
1061 | check( | 1061 | check( |
1062 | r#"async fn foo<|>() {}"#, | 1062 | r#"async fn foo<|>() {}"#, |
1063 | expect![[r#" | 1063 | expect![[r#" |
1064 | foo: | 1064 | *foo* |
1065 | ```rust | 1065 | ```rust |
1066 | async fn foo() | 1066 | async fn foo() |
1067 | ``` | 1067 | ``` |
@@ -1070,7 +1070,7 @@ fn bar() { fo<|>o(); } | |||
1070 | check( | 1070 | check( |
1071 | r#"pub const unsafe fn foo<|>() {}"#, | 1071 | r#"pub const unsafe fn foo<|>() {}"#, |
1072 | expect![[r#" | 1072 | expect![[r#" |
1073 | foo: | 1073 | *foo* |
1074 | ```rust | 1074 | ```rust |
1075 | pub const unsafe fn foo() | 1075 | pub const unsafe fn foo() |
1076 | ``` | 1076 | ``` |
@@ -1079,7 +1079,7 @@ fn bar() { fo<|>o(); } | |||
1079 | check( | 1079 | check( |
1080 | r#"pub(crate) async unsafe extern "C" fn foo<|>() {}"#, | 1080 | r#"pub(crate) async unsafe extern "C" fn foo<|>() {}"#, |
1081 | expect![[r#" | 1081 | expect![[r#" |
1082 | foo: | 1082 | *foo* |
1083 | ```rust | 1083 | ```rust |
1084 | pub(crate) async unsafe extern "C" fn foo() | 1084 | pub(crate) async unsafe extern "C" fn foo() |
1085 | ``` | 1085 | ``` |
@@ -1116,7 +1116,7 @@ mod my { pub struct Bar; } | |||
1116 | fn my() {} | 1116 | fn my() {} |
1117 | "#, | 1117 | "#, |
1118 | expect![[r#" | 1118 | expect![[r#" |
1119 | my: | 1119 | *my* |
1120 | ```rust | 1120 | ```rust |
1121 | mod my | 1121 | mod my |
1122 | ``` | 1122 | ``` |
@@ -1134,7 +1134,7 @@ struct Bar; | |||
1134 | fn foo() { let bar = Ba<|>r; } | 1134 | fn foo() { let bar = Ba<|>r; } |
1135 | "#, | 1135 | "#, |
1136 | expect![[r#" | 1136 | expect![[r#" |
1137 | Bar: | 1137 | *Bar* |
1138 | ```rust | 1138 | ```rust |
1139 | struct Bar | 1139 | struct Bar |
1140 | ``` | 1140 | ``` |
@@ -1155,7 +1155,7 @@ struct Bar; | |||
1155 | fn foo() { let bar = Ba<|>r; } | 1155 | fn foo() { let bar = Ba<|>r; } |
1156 | "#, | 1156 | "#, |
1157 | expect![[r#" | 1157 | expect![[r#" |
1158 | Bar: | 1158 | *Bar* |
1159 | ```rust | 1159 | ```rust |
1160 | struct Bar | 1160 | struct Bar |
1161 | ``` | 1161 | ``` |
@@ -1178,7 +1178,7 @@ struct Bar; | |||
1178 | fn foo() { let bar = Ba<|>r; } | 1178 | fn foo() { let bar = Ba<|>r; } |
1179 | "#, | 1179 | "#, |
1180 | expect![[r#" | 1180 | expect![[r#" |
1181 | Bar: | 1181 | *Bar* |
1182 | ```rust | 1182 | ```rust |
1183 | struct Bar | 1183 | struct Bar |
1184 | ``` | 1184 | ``` |
@@ -1214,7 +1214,7 @@ bar!(); | |||
1214 | fn foo() { let bar = Bar; bar.fo<|>o(); } | 1214 | fn foo() { let bar = Bar; bar.fo<|>o(); } |
1215 | "#, | 1215 | "#, |
1216 | expect![[r#" | 1216 | expect![[r#" |
1217 | foo: | 1217 | *foo* |
1218 | ```rust | 1218 | ```rust |
1219 | Bar | 1219 | Bar |
1220 | ``` | 1220 | ``` |
@@ -1250,7 +1250,7 @@ bar!(); | |||
1250 | fn foo() { let bar = Bar; bar.fo<|>o(); } | 1250 | fn foo() { let bar = Bar; bar.fo<|>o(); } |
1251 | "#, | 1251 | "#, |
1252 | expect![[r#" | 1252 | expect![[r#" |
1253 | foo: | 1253 | *foo* |
1254 | ```rust | 1254 | ```rust |
1255 | Bar | 1255 | Bar |
1256 | ``` | 1256 | ``` |