aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
authorZac Pullar-Strecker <[email protected]>2020-08-02 09:19:14 +0100
committerZac Pullar-Strecker <[email protected]>2020-08-02 09:32:09 +0100
commitb34ad4bc8ad368a096c14d3710239a5a2eb9ccb5 (patch)
tree95a1375e90f11a09385a76dfab37494558fbc909 /crates/ra_ide/src
parentc4d4869f23dbe481c42a8fb24d2bc43e36b88933 (diff)
update & configure cmark to render three backticks
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/hover.rs332
-rw-r--r--crates/ra_ide/src/link_rewrite.rs6
2 files changed, 170 insertions, 168 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index 7e78ee597..5aacb4c14 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -425,9 +425,9 @@ fn main() {
425 expect![[r#" 425 expect![[r#"
426 *iter* 426 *iter*
427 427
428 ````rust 428 ```rust
429 Iter<Scan<OtherStruct<OtherStruct<i32>>, |&mut u32, &u32, &mut u32| -> Option<u32>, u32>> 429 Iter<Scan<OtherStruct<OtherStruct<i32>>, |&mut u32, &u32, &mut u32| -> Option<u32>, u32>>
430 ```` 430 ```
431 "#]], 431 "#]],
432 ); 432 );
433 } 433 }
@@ -444,13 +444,13 @@ fn main() { let foo_test = fo<|>o(); }
444 expect![[r#" 444 expect![[r#"
445 *foo* 445 *foo*
446 446
447 ````rust 447 ```rust
448 test 448 test
449 ```` 449 ```
450 450
451 ````rust 451 ```rust
452 pub fn foo() -> u32 452 pub fn foo() -> u32
453 ```` 453 ```
454 "#]], 454 "#]],
455 ); 455 );
456 456
@@ -493,13 +493,13 @@ fn main() { let foo_test = fo<|>o(); }
493 expect![[r#" 493 expect![[r#"
494 *foo* 494 *foo*
495 495
496 ````rust 496 ```rust
497 test 497 test
498 ```` 498 ```
499 499
500 ````rust 500 ```rust
501 pub fn foo<'a, T: AsRef<str>>(b: &'a T) -> &'a str 501 pub fn foo<'a, T: AsRef<str>>(b: &'a T) -> &'a str
502 ```` 502 ```
503 "#]], 503 "#]],
504 ); 504 );
505 } 505 }
@@ -515,13 +515,13 @@ fn main() { }
515 expect![[r#" 515 expect![[r#"
516 *foo* 516 *foo*
517 517
518 ````rust 518 ```rust
519 test 519 test
520 ```` 520 ```
521 521
522 ````rust 522 ```rust
523 pub fn foo(a: u32, b: u32) -> u32 523 pub fn foo(a: u32, b: u32) -> u32
524 ```` 524 ```
525 "#]], 525 "#]],
526 ); 526 );
527 } 527 }
@@ -540,13 +540,13 @@ fn main() {
540 expect![[r#" 540 expect![[r#"
541 *field_a* 541 *field_a*
542 542
543 ````rust 543 ```rust
544 test::Foo 544 test::Foo
545 ```` 545 ```
546 546
547 ````rust 547 ```rust
548 field_a: u32 548 field_a: u32
549 ```` 549 ```
550 "#]], 550 "#]],
551 ); 551 );
552 552
@@ -562,13 +562,13 @@ fn main() {
562 expect![[r#" 562 expect![[r#"
563 *field_a* 563 *field_a*
564 564
565 ````rust 565 ```rust
566 test::Foo 566 test::Foo
567 ```` 567 ```
568 568
569 ````rust 569 ```rust
570 field_a: u32 570 field_a: u32
571 ```` 571 ```
572 "#]], 572 "#]],
573 ); 573 );
574 } 574 }
@@ -580,13 +580,13 @@ fn main() {
580 expect![[r#" 580 expect![[r#"
581 *foo* 581 *foo*
582 582
583 ````rust 583 ```rust
584 test 584 test
585 ```` 585 ```
586 586
587 ````rust 587 ```rust
588 const foo: u32 588 const foo: u32
589 ```` 589 ```
590 "#]], 590 "#]],
591 ); 591 );
592 check( 592 check(
@@ -594,13 +594,13 @@ fn main() {
594 expect![[r#" 594 expect![[r#"
595 *foo* 595 *foo*
596 596
597 ````rust 597 ```rust
598 test 598 test
599 ```` 599 ```
600 600
601 ````rust 601 ```rust
602 static foo: u32 602 static foo: u32
603 ```` 603 ```
604 "#]], 604 "#]],
605 ); 605 );
606 } 606 }
@@ -617,9 +617,9 @@ fn main() {
617 expect![[r#" 617 expect![[r#"
618 *zz* 618 *zz*
619 619
620 ````rust 620 ```rust
621 Test<i32, u8> 621 Test<i32, u8>
622 ```` 622 ```
623 "#]], 623 "#]],
624 ); 624 );
625 } 625 }
@@ -636,13 +636,13 @@ fn main() { So<|>me(12); }
636 expect![[r#" 636 expect![[r#"
637 *Some* 637 *Some*
638 638
639 ````rust 639 ```rust
640 test::Option 640 test::Option
641 ```` 641 ```
642 642
643 ````rust 643 ```rust
644 Some 644 Some
645 ```` 645 ```
646 "#]], 646 "#]],
647 ); 647 );
648 648
@@ -656,9 +656,9 @@ fn main() { let b<|>ar = Some(12); }
656 expect![[r#" 656 expect![[r#"
657 *bar* 657 *bar*
658 658
659 ````rust 659 ```rust
660 Option<i32> 660 Option<i32>
661 ```` 661 ```
662 "#]], 662 "#]],
663 ); 663 );
664 } 664 }
@@ -675,13 +675,13 @@ enum Option<T> {
675 expect![[r#" 675 expect![[r#"
676 *None* 676 *None*
677 677
678 ````rust 678 ```rust
679 test::Option 679 test::Option
680 ```` 680 ```
681 681
682 ````rust 682 ```rust
683 None 683 None
684 ```` 684 ```
685 685
686 --- 686 ---
687 687
@@ -702,13 +702,13 @@ fn main() {
702 expect![[r#" 702 expect![[r#"
703 *Some* 703 *Some*
704 704
705 ````rust 705 ```rust
706 test::Option 706 test::Option
707 ```` 707 ```
708 708
709 ````rust 709 ```rust
710 Some 710 Some
711 ```` 711 ```
712 712
713 --- 713 ---
714 714
@@ -724,9 +724,9 @@ fn main() {
724 expect![[r#" 724 expect![[r#"
725 *foo* 725 *foo*
726 726
727 ````rust 727 ```rust
728 i32 728 i32
729 ```` 729 ```
730 "#]], 730 "#]],
731 ) 731 )
732 } 732 }
@@ -738,9 +738,9 @@ fn main() {
738 expect![[r#" 738 expect![[r#"
739 *foo* 739 *foo*
740 740
741 ````rust 741 ```rust
742 i32 742 i32
743 ```` 743 ```
744 "#]], 744 "#]],
745 ) 745 )
746 } 746 }
@@ -752,9 +752,9 @@ fn main() {
752 expect![[r#" 752 expect![[r#"
753 *foo* 753 *foo*
754 754
755 ````rust 755 ```rust
756 i32 756 i32
757 ```` 757 ```
758 "#]], 758 "#]],
759 ) 759 )
760 } 760 }
@@ -766,9 +766,9 @@ fn main() {
766 expect![[r#" 766 expect![[r#"
767 *foo* 767 *foo*
768 768
769 ````rust 769 ```rust
770 i32 770 i32
771 ```` 771 ```
772 "#]], 772 "#]],
773 ) 773 )
774 } 774 }
@@ -788,9 +788,9 @@ fn main() { let foo_<|>test = Thing::new(); }
788 expect![[r#" 788 expect![[r#"
789 *foo_test* 789 *foo_test*
790 790
791 ````rust 791 ```rust
792 Thing 792 Thing
793 ```` 793 ```
794 "#]], 794 "#]],
795 ) 795 )
796 } 796 }
@@ -812,13 +812,13 @@ fn main() { let foo_test = wrapper::Thing::new<|>(); }
812 expect![[r#" 812 expect![[r#"
813 *new* 813 *new*
814 814
815 ````rust 815 ```rust
816 test::wrapper::Thing 816 test::wrapper::Thing
817 ```` 817 ```
818 818
819 ````rust 819 ```rust
820 fn new() -> Thing 820 fn new() -> Thing
821 ```` 821 ```
822 "#]], 822 "#]],
823 ) 823 )
824 } 824 }
@@ -843,13 +843,13 @@ fn main() {
843 expect![[r#" 843 expect![[r#"
844 *C* 844 *C*
845 845
846 ````rust 846 ```rust
847 test 847 test
848 ```` 848 ```
849 849
850 ````rust 850 ```rust
851 const C: u32 851 const C: u32
852 ```` 852 ```
853 "#]], 853 "#]],
854 ) 854 )
855 } 855 }
@@ -925,9 +925,9 @@ fn y() {
925 expect![[r#" 925 expect![[r#"
926 *x* 926 *x*
927 927
928 ````rust 928 ```rust
929 i32 929 i32
930 ```` 930 ```
931 "#]], 931 "#]],
932 ) 932 )
933 } 933 }
@@ -943,13 +943,13 @@ fn f() { fo<|>o!(); }
943 expect![[r#" 943 expect![[r#"
944 *foo* 944 *foo*
945 945
946 ````rust 946 ```rust
947 test 947 test
948 ```` 948 ```
949 949
950 ````rust 950 ```rust
951 macro_rules! foo 951 macro_rules! foo
952 ```` 952 ```
953 "#]], 953 "#]],
954 ) 954 )
955 } 955 }
@@ -978,13 +978,13 @@ id! {
978 expect![[r#" 978 expect![[r#"
979 *foo* 979 *foo*
980 980
981 ````rust 981 ```rust
982 test 982 test
983 ```` 983 ```
984 984
985 ````rust 985 ```rust
986 fn foo() 986 fn foo()
987 ```` 987 ```
988 "#]], 988 "#]],
989 ); 989 );
990 } 990 }
@@ -999,9 +999,9 @@ fn foo(bar:u32) { let a = id!(ba<|>r); }
999 expect![[r#" 999 expect![[r#"
1000 *bar* 1000 *bar*
1001 1001
1002 ````rust 1002 ```rust
1003 u32 1003 u32
1004 ```` 1004 ```
1005 "#]], 1005 "#]],
1006 ); 1006 );
1007 } 1007 }
@@ -1017,9 +1017,9 @@ fn foo(bar:u32) { let a = id!(ba<|>r); }
1017 expect![[r#" 1017 expect![[r#"
1018 *bar* 1018 *bar*
1019 1019
1020 ````rust 1020 ```rust
1021 u32 1021 u32
1022 ```` 1022 ```
1023 "#]], 1023 "#]],
1024 ); 1024 );
1025 } 1025 }
@@ -1076,13 +1076,13 @@ fn foo() {
1076 expect![[r#" 1076 expect![[r#"
1077 *bar* 1077 *bar*
1078 1078
1079 ````rust 1079 ```rust
1080 test 1080 test
1081 ```` 1081 ```
1082 1082
1083 ````rust 1083 ```rust
1084 fn bar() -> bool 1084 fn bar() -> bool
1085 ```` 1085 ```
1086 "#]], 1086 "#]],
1087 ); 1087 );
1088 } 1088 }
@@ -1113,13 +1113,13 @@ fn bar() { fo<|>o(); }
1113 expect![[r#" 1113 expect![[r#"
1114 *foo* 1114 *foo*
1115 1115
1116 ````rust 1116 ```rust
1117 test 1117 test
1118 ```` 1118 ```
1119 1119
1120 ````rust 1120 ```rust
1121 fn foo() 1121 fn foo()
1122 ```` 1122 ```
1123 1123
1124 --- 1124 ---
1125 1125
@@ -1135,13 +1135,13 @@ fn bar() { fo<|>o(); }
1135 expect![[r#" 1135 expect![[r#"
1136 *foo* 1136 *foo*
1137 1137
1138 ````rust 1138 ```rust
1139 test 1139 test
1140 ```` 1140 ```
1141 1141
1142 ````rust 1142 ```rust
1143 async fn foo() 1143 async fn foo()
1144 ```` 1144 ```
1145 "#]], 1145 "#]],
1146 ); 1146 );
1147 check( 1147 check(
@@ -1149,13 +1149,13 @@ fn bar() { fo<|>o(); }
1149 expect![[r#" 1149 expect![[r#"
1150 *foo* 1150 *foo*
1151 1151
1152 ````rust 1152 ```rust
1153 test 1153 test
1154 ```` 1154 ```
1155 1155
1156 ````rust 1156 ```rust
1157 pub const unsafe fn foo() 1157 pub const unsafe fn foo()
1158 ```` 1158 ```
1159 "#]], 1159 "#]],
1160 ); 1160 );
1161 check( 1161 check(
@@ -1163,13 +1163,13 @@ fn bar() { fo<|>o(); }
1163 expect![[r#" 1163 expect![[r#"
1164 *foo* 1164 *foo*
1165 1165
1166 ````rust 1166 ```rust
1167 test 1167 test
1168 ```` 1168 ```
1169 1169
1170 ````rust 1170 ```rust
1171 pub(crate) async unsafe extern "C" fn foo() 1171 pub(crate) async unsafe extern "C" fn foo()
1172 ```` 1172 ```
1173 "#]], 1173 "#]],
1174 ); 1174 );
1175 } 1175 }
@@ -1205,13 +1205,13 @@ fn my() {}
1205 expect![[r#" 1205 expect![[r#"
1206 *my* 1206 *my*
1207 1207
1208 ````rust 1208 ```rust
1209 test 1209 test
1210 ```` 1210 ```
1211 1211
1212 ````rust 1212 ```rust
1213 mod my 1213 mod my
1214 ```` 1214 ```
1215 "#]], 1215 "#]],
1216 ); 1216 );
1217 } 1217 }
@@ -1228,13 +1228,13 @@ fn foo() { let bar = Ba<|>r; }
1228 expect![[r#" 1228 expect![[r#"
1229 *Bar* 1229 *Bar*
1230 1230
1231 ````rust 1231 ```rust
1232 test 1232 test
1233 ```` 1233 ```
1234 1234
1235 ````rust 1235 ```rust
1236 struct Bar 1236 struct Bar
1237 ```` 1237 ```
1238 1238
1239 --- 1239 ---
1240 1240
@@ -1255,13 +1255,13 @@ fn foo() { let bar = Ba<|>r; }
1255 expect![[r#" 1255 expect![[r#"
1256 *Bar* 1256 *Bar*
1257 1257
1258 ````rust 1258 ```rust
1259 test 1259 test
1260 ```` 1260 ```
1261 1261
1262 ````rust 1262 ```rust
1263 struct Bar 1263 struct Bar
1264 ```` 1264 ```
1265 1265
1266 --- 1266 ---
1267 1267
@@ -1284,13 +1284,13 @@ fn foo() { let bar = Ba<|>r; }
1284 expect![[r#" 1284 expect![[r#"
1285 *Bar* 1285 *Bar*
1286 1286
1287 ````rust 1287 ```rust
1288 test 1288 test
1289 ```` 1289 ```
1290 1290
1291 ````rust 1291 ```rust
1292 struct Bar 1292 struct Bar
1293 ```` 1293 ```
1294 1294
1295 --- 1295 ---
1296 1296
@@ -1315,13 +1315,13 @@ fn foo() { let bar = Ba<|>r; }
1315 expect![[r#" 1315 expect![[r#"
1316 *Bar* 1316 *Bar*
1317 1317
1318 ````rust 1318 ```rust
1319 test 1319 test
1320 ```` 1320 ```
1321 1321
1322 ````rust 1322 ```rust
1323 pub struct Bar 1323 pub struct Bar
1324 ```` 1324 ```
1325 1325
1326 --- 1326 ---
1327 1327
@@ -1342,13 +1342,13 @@ fn foo() { let bar = Ba<|>r; }
1342 expect![[r#" 1342 expect![[r#"
1343 *Bar* 1343 *Bar*
1344 1344
1345 ````rust 1345 ```rust
1346 test 1346 test
1347 ```` 1347 ```
1348 1348
1349 ````rust 1349 ```rust
1350 pub struct Bar 1350 pub struct Bar
1351 ```` 1351 ```
1352 1352
1353 --- 1353 ---
1354 1354
@@ -1371,13 +1371,13 @@ fn foo() { let bar = Ba<|>r; }
1371 expect![[r#" 1371 expect![[r#"
1372 *Bar* 1372 *Bar*
1373 1373
1374 ````rust 1374 ```rust
1375 test 1375 test
1376 ```` 1376 ```
1377 1377
1378 ````rust 1378 ```rust
1379 pub struct Bar 1379 pub struct Bar
1380 ```` 1380 ```
1381 1381
1382 --- 1382 ---
1383 1383
@@ -1398,13 +1398,13 @@ fn foo() { let bar = Ba<|>r; }
1398 expect![[r#" 1398 expect![[r#"
1399 *Bar* 1399 *Bar*
1400 1400
1401 ````rust 1401 ```rust
1402 test 1402 test
1403 ```` 1403 ```
1404 1404
1405 ````rust 1405 ```rust
1406 pub struct Bar 1406 pub struct Bar
1407 ```` 1407 ```
1408 1408
1409 --- 1409 ---
1410 1410
@@ -1425,13 +1425,13 @@ fn foo() { let bar = Ba<|>r; }
1425 expect![[r#" 1425 expect![[r#"
1426 *Bar* 1426 *Bar*
1427 1427
1428 ````rust 1428 ```rust
1429 test 1429 test
1430 ```` 1430 ```
1431 1431
1432 ````rust 1432 ```rust
1433 pub struct Bar 1433 pub struct Bar
1434 ```` 1434 ```
1435 1435
1436 --- 1436 ---
1437 1437
@@ -1453,13 +1453,13 @@ fn foo() { let bar = Ba<|>r; }
1453 expect![[r#" 1453 expect![[r#"
1454 *Bar* 1454 *Bar*
1455 1455
1456 ````rust 1456 ```rust
1457 test 1457 test
1458 ```` 1458 ```
1459 1459
1460 ````rust 1460 ```rust
1461 pub struct Bar 1461 pub struct Bar
1462 ```` 1462 ```
1463 1463
1464 --- 1464 ---
1465 1465
@@ -1480,13 +1480,13 @@ fn foo() { let bar = Ba<|>r; }
1480 expect![[r#" 1480 expect![[r#"
1481 *Bar* 1481 *Bar*
1482 1482
1483 ````rust 1483 ```rust
1484 test 1484 test
1485 ```` 1485 ```
1486 1486
1487 ````rust 1487 ```rust
1488 pub struct Bar 1488 pub struct Bar
1489 ```` 1489 ```
1490 1490
1491 --- 1491 ---
1492 1492
@@ -1507,13 +1507,13 @@ fn foo() { let bar = Ba<|>r; }
1507 expect![[r#" 1507 expect![[r#"
1508 *Bar* 1508 *Bar*
1509 1509
1510 ````rust 1510 ```rust
1511 test 1511 test
1512 ```` 1512 ```
1513 1513
1514 ````rust 1514 ```rust
1515 pub struct Bar 1515 pub struct Bar
1516 ```` 1516 ```
1517 1517
1518 --- 1518 ---
1519 1519
@@ -1536,13 +1536,13 @@ fn foo() { let bar = Ba<|>r; }
1536 expect![[r#" 1536 expect![[r#"
1537 *Bar* 1537 *Bar*
1538 1538
1539 ````rust 1539 ```rust
1540 test 1540 test
1541 ```` 1541 ```
1542 1542
1543 ````rust 1543 ```rust
1544 pub struct Bar 1544 pub struct Bar
1545 ```` 1545 ```
1546 1546
1547 --- 1547 ---
1548 1548
@@ -1563,13 +1563,13 @@ fn foo() { let bar = Ba<|>r; }
1563 expect![[r#" 1563 expect![[r#"
1564 *Bar* 1564 *Bar*
1565 1565
1566 ````rust 1566 ```rust
1567 test 1567 test
1568 ```` 1568 ```
1569 1569
1570 ````rust 1570 ```rust
1571 pub struct Bar 1571 pub struct Bar
1572 ```` 1572 ```
1573 1573
1574 --- 1574 ---
1575 1575
@@ -1591,13 +1591,13 @@ fn foo() { let bar = Ba<|>r; }
1591 expect![[r#" 1591 expect![[r#"
1592 *Bar* 1592 *Bar*
1593 1593
1594 ````rust 1594 ```rust
1595 test 1595 test
1596 ```` 1596 ```
1597 1597
1598 ````rust 1598 ```rust
1599 pub struct Bar 1599 pub struct Bar
1600 ```` 1600 ```
1601 1601
1602 --- 1602 ---
1603 1603
@@ -1629,13 +1629,13 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
1629 expect![[r#" 1629 expect![[r#"
1630 *foo* 1630 *foo*
1631 1631
1632 ````rust 1632 ```rust
1633 test::Bar 1633 test::Bar
1634 ```` 1634 ```
1635 1635
1636 ````rust 1636 ```rust
1637 fn foo(&self) 1637 fn foo(&self)
1638 ```` 1638 ```
1639 1639
1640 --- 1640 ---
1641 1641
@@ -1667,13 +1667,13 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
1667 expect![[r#" 1667 expect![[r#"
1668 *foo* 1668 *foo*
1669 1669
1670 ````rust 1670 ```rust
1671 test::Bar 1671 test::Bar
1672 ```` 1672 ```
1673 1673
1674 ````rust 1674 ```rust
1675 fn foo(&self) 1675 fn foo(&self)
1676 ```` 1676 ```
1677 1677
1678 --- 1678 ---
1679 1679
diff --git a/crates/ra_ide/src/link_rewrite.rs b/crates/ra_ide/src/link_rewrite.rs
index 1065eb619..37d695bb8 100644
--- a/crates/ra_ide/src/link_rewrite.rs
+++ b/crates/ra_ide/src/link_rewrite.rs
@@ -4,7 +4,7 @@ use std::iter::once;
4 4
5use itertools::Itertools; 5use itertools::Itertools;
6use pulldown_cmark::{CowStr, Event, Options, Parser, Tag}; 6use pulldown_cmark::{CowStr, Event, Options, Parser, Tag};
7use pulldown_cmark_to_cmark::cmark; 7use pulldown_cmark_to_cmark::{cmark_with_options, Options as CmarkOptions};
8use url::Url; 8use url::Url;
9 9
10use hir::{Adt, AsName, AttrDef, Crate, Hygiene, ItemInNs, ModPath, ModuleDef}; 10use hir::{Adt, AsName, AttrDef, Crate, Hygiene, ItemInNs, ModPath, ModuleDef};
@@ -42,7 +42,9 @@ pub fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition)
42 } 42 }
43 }); 43 });
44 let mut out = String::new(); 44 let mut out = String::new();
45 cmark(doc, &mut out, None).ok(); 45 let mut options = CmarkOptions::default();
46 options.code_block_backticks = 3;
47 cmark_with_options(doc, &mut out, None, options).ok();
46 out 48 out
47} 49}
48 50