aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/hover.rs162
1 files changed, 74 insertions, 88 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index b012e4900..536411704 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -1407,12 +1407,11 @@ fn foo() { let bar = Ba<|>r; }
1407 #[test] 1407 #[test]
1408 fn test_hover_path_link() { 1408 fn test_hover_path_link() {
1409 check( 1409 check(
1410 r" 1410 r#"
1411 //- /lib.rs 1411pub struct Foo;
1412 pub struct Foo; 1412/// [Foo](struct.Foo.html)
1413 /// [Foo](struct.Foo.html) 1413pub struct B<|>ar
1414 pub struct B<|>ar 1414"#,
1415 ",
1416 expect![[r#" 1415 expect![[r#"
1417 *Bar* 1416 *Bar*
1418 1417
@@ -1434,12 +1433,11 @@ fn foo() { let bar = Ba<|>r; }
1434 #[test] 1433 #[test]
1435 fn test_hover_path_link_no_strip() { 1434 fn test_hover_path_link_no_strip() {
1436 check( 1435 check(
1437 r" 1436 r#"
1438 //- /lib.rs 1437pub struct Foo;
1439 pub struct Foo; 1438/// [struct Foo](struct.Foo.html)
1440 /// [struct Foo](struct.Foo.html) 1439pub struct B<|>ar
1441 pub struct B<|>ar 1440"#,
1442 ",
1443 expect![[r#" 1441 expect![[r#"
1444 *Bar* 1442 *Bar*
1445 1443
@@ -1462,14 +1460,13 @@ fn foo() { let bar = Ba<|>r; }
1462 #[test] 1460 #[test]
1463 fn test_hover_path_link_field() { 1461 fn test_hover_path_link_field() {
1464 check( 1462 check(
1465 r" 1463 r#"
1466 //- /lib.rs 1464pub struct Foo;
1467 pub struct Foo; 1465pub struct Bar {
1468 pub struct Bar { 1466 /// [Foo](struct.Foo.html)
1469 /// [Foo](struct.Foo.html) 1467 fie<|>ld: ()
1470 fie<|>ld: () 1468}
1471 } 1469"#,
1472 ",
1473 expect![[r#" 1470 expect![[r#"
1474 *field* 1471 *field*
1475 1472
@@ -1491,14 +1488,13 @@ fn foo() { let bar = Ba<|>r; }
1491 #[test] 1488 #[test]
1492 fn test_hover_intra_link() { 1489 fn test_hover_intra_link() {
1493 check( 1490 check(
1494 r" 1491 r#"
1495 //- /lib.rs 1492pub mod foo {
1496 pub mod foo { 1493 pub struct Foo;
1497 pub struct Foo; 1494}
1498 } 1495/// [Foo](foo::Foo)
1499 /// [Foo](foo::Foo) 1496pub struct B<|>ar
1500 pub struct B<|>ar 1497"#,
1501 ",
1502 expect![[r#" 1498 expect![[r#"
1503 *Bar* 1499 *Bar*
1504 1500
@@ -1521,16 +1517,14 @@ fn foo() { let bar = Ba<|>r; }
1521 fn test_hover_intra_link_html_root_url() { 1517 fn test_hover_intra_link_html_root_url() {
1522 check( 1518 check(
1523 r#" 1519 r#"
1524 //- /lib.rs 1520#![doc(arbitrary_attribute = "test", html_root_url = "https:/example.com", arbitrary_attribute2)]
1525
1526 #![doc(arbitrary_attribute = "test", html_root_url = "https:/example.com", arbitrary_attribute2)]
1527 1521
1528 pub mod foo { 1522pub mod foo {
1529 pub struct Foo; 1523 pub struct Foo;
1530 } 1524}
1531 /// [Foo](foo::Foo) 1525/// [Foo](foo::Foo)
1532 pub struct B<|>ar 1526pub struct B<|>ar
1533 "#, 1527"#,
1534 expect![[r#" 1528 expect![[r#"
1535 *Bar* 1529 *Bar*
1536 1530
@@ -1552,12 +1546,11 @@ fn foo() { let bar = Ba<|>r; }
1552 #[test] 1546 #[test]
1553 fn test_hover_intra_link_shortlink() { 1547 fn test_hover_intra_link_shortlink() {
1554 check( 1548 check(
1555 r" 1549 r#"
1556 //- /lib.rs 1550pub struct Foo;
1557 pub struct Foo; 1551/// [Foo]
1558 /// [Foo] 1552pub struct B<|>ar
1559 pub struct B<|>ar 1553"#,
1560 ",
1561 expect![[r#" 1554 expect![[r#"
1562 *Bar* 1555 *Bar*
1563 1556
@@ -1579,12 +1572,11 @@ fn foo() { let bar = Ba<|>r; }
1579 #[test] 1572 #[test]
1580 fn test_hover_intra_link_shortlink_code() { 1573 fn test_hover_intra_link_shortlink_code() {
1581 check( 1574 check(
1582 r" 1575 r#"
1583 //- /lib.rs 1576pub struct Foo;
1584 pub struct Foo; 1577/// [`Foo`]
1585 /// [`Foo`] 1578pub struct B<|>ar
1586 pub struct B<|>ar 1579"#,
1587 ",
1588 expect![[r#" 1580 expect![[r#"
1589 *Bar* 1581 *Bar*
1590 1582
@@ -1606,13 +1598,12 @@ fn foo() { let bar = Ba<|>r; }
1606 #[test] 1598 #[test]
1607 fn test_hover_intra_link_namespaced() { 1599 fn test_hover_intra_link_namespaced() {
1608 check( 1600 check(
1609 r" 1601 r#"
1610 //- /lib.rs 1602pub struct Foo;
1611 pub struct Foo; 1603fn Foo() {}
1612 fn Foo() {} 1604/// [Foo()]
1613 /// [Foo()] 1605pub struct B<|>ar
1614 pub struct B<|>ar 1606"#,
1615 ",
1616 expect![[r#" 1607 expect![[r#"
1617 *Bar* 1608 *Bar*
1618 1609
@@ -1634,12 +1625,11 @@ fn foo() { let bar = Ba<|>r; }
1634 #[test] 1625 #[test]
1635 fn test_hover_intra_link_shortlink_namspaced_code() { 1626 fn test_hover_intra_link_shortlink_namspaced_code() {
1636 check( 1627 check(
1637 r" 1628 r#"
1638 //- /lib.rs 1629pub struct Foo;
1639 pub struct Foo; 1630/// [`struct Foo`]
1640 /// [`struct Foo`] 1631pub struct B<|>ar
1641 pub struct B<|>ar 1632"#,
1642 ",
1643 expect![[r#" 1633 expect![[r#"
1644 *Bar* 1634 *Bar*
1645 1635
@@ -1661,12 +1651,11 @@ fn foo() { let bar = Ba<|>r; }
1661 #[test] 1651 #[test]
1662 fn test_hover_intra_link_shortlink_namspaced_code_with_at() { 1652 fn test_hover_intra_link_shortlink_namspaced_code_with_at() {
1663 check( 1653 check(
1664 r" 1654 r#"
1665 //- /lib.rs 1655pub struct Foo;
1666 pub struct Foo; 1656/// [`struct@Foo`]
1667 /// [`struct@Foo`] 1657pub struct B<|>ar
1668 pub struct B<|>ar 1658"#,
1669 ",
1670 expect![[r#" 1659 expect![[r#"
1671 *Bar* 1660 *Bar*
1672 1661
@@ -1688,14 +1677,13 @@ fn foo() { let bar = Ba<|>r; }
1688 #[test] 1677 #[test]
1689 fn test_hover_intra_link_reference() { 1678 fn test_hover_intra_link_reference() {
1690 check( 1679 check(
1691 r" 1680 r#"
1692 //- /lib.rs 1681pub struct Foo;
1693 pub struct Foo; 1682/// [my Foo][foo]
1694 /// [my Foo][foo] 1683///
1695 /// 1684/// [foo]: Foo
1696 /// [foo]: Foo 1685pub struct B<|>ar
1697 pub struct B<|>ar 1686"#,
1698 ",
1699 expect![[r#" 1687 expect![[r#"
1700 *Bar* 1688 *Bar*
1701 1689
@@ -1717,12 +1705,11 @@ fn foo() { let bar = Ba<|>r; }
1717 #[test] 1705 #[test]
1718 fn test_hover_external_url() { 1706 fn test_hover_external_url() {
1719 check( 1707 check(
1720 r" 1708 r#"
1721 //- /lib.rs 1709pub struct Foo;
1722 pub struct Foo; 1710/// [external](https://www.google.com)
1723 /// [external](https://www.google.com) 1711pub struct B<|>ar
1724 pub struct B<|>ar 1712"#,
1725 ",
1726 expect![[r#" 1713 expect![[r#"
1727 *Bar* 1714 *Bar*
1728 1715
@@ -1745,12 +1732,11 @@ fn foo() { let bar = Ba<|>r; }
1745 #[test] 1732 #[test]
1746 fn test_hover_unknown_target() { 1733 fn test_hover_unknown_target() {
1747 check( 1734 check(
1748 r" 1735 r#"
1749 //- /lib.rs 1736pub struct Foo;
1750 pub struct Foo; 1737/// [baz](Baz)
1751 /// [baz](Baz) 1738pub struct B<|>ar
1752 pub struct B<|>ar 1739"#,
1753 ",
1754 expect![[r#" 1740 expect![[r#"
1755 *Bar* 1741 *Bar*
1756 1742