aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/hover.rs58
1 files changed, 36 insertions, 22 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index ad68bc43c..02099b05d 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -1477,33 +1477,35 @@ fn foo() { let bar = Ba<|>r; }
1477 1477
1478 #[test] 1478 #[test]
1479 fn test_hover_path_link() { 1479 fn test_hover_path_link() {
1480 check_hover_result( 1480 check(
1481 r" 1481 r"
1482 //- /lib.rs 1482 //- /lib.rs
1483 pub struct Foo; 1483 pub struct Foo;
1484 /// [Foo](struct.Foo.html) 1484 /// [Foo](struct.Foo.html)
1485 pub struct B<|>ar 1485 pub struct B<|>ar
1486 ", 1486 ",
1487 &["pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)"], 1487 expect![[
1488 "pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)"
1489 ]],
1488 ); 1490 );
1489 } 1491 }
1490 1492
1491 #[test] 1493 #[test]
1492 fn test_hover_path_link_no_strip() { 1494 fn test_hover_path_link_no_strip() {
1493 check_hover_result( 1495 check(
1494 r" 1496 r"
1495 //- /lib.rs 1497 //- /lib.rs
1496 pub struct Foo; 1498 pub struct Foo;
1497 /// [struct Foo](struct.Foo.html) 1499 /// [struct Foo](struct.Foo.html)
1498 pub struct B<|>ar 1500 pub struct B<|>ar
1499 ", 1501 ",
1500 &["pub struct Bar\n```\n___\n\n[struct Foo](https://docs.rs/test/*/test/struct.Foo.html)"], 1502 expect![["pub struct Bar\n```\n___\n\n[struct Foo](https://docs.rs/test/*/test/struct.Foo.html)"]],
1501 ); 1503 );
1502 } 1504 }
1503 1505
1504 #[test] 1506 #[test]
1505 fn test_hover_intra_link() { 1507 fn test_hover_intra_link() {
1506 check_hover_result( 1508 check(
1507 r" 1509 r"
1508 //- /lib.rs 1510 //- /lib.rs
1509 pub mod foo { 1511 pub mod foo {
@@ -1512,39 +1514,43 @@ fn foo() { let bar = Ba<|>r; }
1512 /// [Foo](foo::Foo) 1514 /// [Foo](foo::Foo)
1513 pub struct B<|>ar 1515 pub struct B<|>ar
1514 ", 1516 ",
1515 &["pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/foo/struct.Foo.html)"], 1517 expect![["pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/foo/struct.Foo.html)"]],
1516 ); 1518 );
1517 } 1519 }
1518 1520
1519 #[test] 1521 #[test]
1520 fn test_hover_intra_link_shortlink() { 1522 fn test_hover_intra_link_shortlink() {
1521 check_hover_result( 1523 check(
1522 r" 1524 r"
1523 //- /lib.rs 1525 //- /lib.rs
1524 pub struct Foo; 1526 pub struct Foo;
1525 /// [Foo] 1527 /// [Foo]
1526 pub struct B<|>ar 1528 pub struct B<|>ar
1527 ", 1529 ",
1528 &["pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)"], 1530 expect![[
1531 "pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)"
1532 ]],
1529 ); 1533 );
1530 } 1534 }
1531 1535
1532 #[test] 1536 #[test]
1533 fn test_hover_intra_link_shortlink_code() { 1537 fn test_hover_intra_link_shortlink_code() {
1534 check_hover_result( 1538 check(
1535 r" 1539 r"
1536 //- /lib.rs 1540 //- /lib.rs
1537 pub struct Foo; 1541 pub struct Foo;
1538 /// [`Foo`] 1542 /// [`Foo`]
1539 pub struct B<|>ar 1543 pub struct B<|>ar
1540 ", 1544 ",
1541 &["pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)"], 1545 expect![[
1546 "pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)"
1547 ]],
1542 ); 1548 );
1543 } 1549 }
1544 1550
1545 #[test] 1551 #[test]
1546 fn test_hover_intra_link_namespaced() { 1552 fn test_hover_intra_link_namespaced() {
1547 check_hover_result( 1553 check(
1548 r" 1554 r"
1549 //- /lib.rs 1555 //- /lib.rs
1550 pub struct Foo; 1556 pub struct Foo;
@@ -1552,39 +1558,45 @@ fn foo() { let bar = Ba<|>r; }
1552 /// [Foo()] 1558 /// [Foo()]
1553 pub struct B<|>ar 1559 pub struct B<|>ar
1554 ", 1560 ",
1555 &["pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)"], 1561 expect![[
1562 "pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)"
1563 ]],
1556 ); 1564 );
1557 } 1565 }
1558 1566
1559 #[test] 1567 #[test]
1560 fn test_hover_intra_link_shortlink_namspaced_code() { 1568 fn test_hover_intra_link_shortlink_namspaced_code() {
1561 check_hover_result( 1569 check(
1562 r" 1570 r"
1563 //- /lib.rs 1571 //- /lib.rs
1564 pub struct Foo; 1572 pub struct Foo;
1565 /// [`struct Foo`] 1573 /// [`struct Foo`]
1566 pub struct B<|>ar 1574 pub struct B<|>ar
1567 ", 1575 ",
1568 &["pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)"], 1576 expect![[
1577 "pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)"
1578 ]],
1569 ); 1579 );
1570 } 1580 }
1571 1581
1572 #[test] 1582 #[test]
1573 fn test_hover_intra_link_shortlink_namspaced_code_with_at() { 1583 fn test_hover_intra_link_shortlink_namspaced_code_with_at() {
1574 check_hover_result( 1584 check(
1575 r" 1585 r"
1576 //- /lib.rs 1586 //- /lib.rs
1577 pub struct Foo; 1587 pub struct Foo;
1578 /// [`struct@Foo`] 1588 /// [`struct@Foo`]
1579 pub struct B<|>ar 1589 pub struct B<|>ar
1580 ", 1590 ",
1581 &["pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)"], 1591 expect![[
1592 "pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)"
1593 ]],
1582 ); 1594 );
1583 } 1595 }
1584 1596
1585 #[test] 1597 #[test]
1586 fn test_hover_intra_link_reference() { 1598 fn test_hover_intra_link_reference() {
1587 check_hover_result( 1599 check(
1588 r" 1600 r"
1589 //- /lib.rs 1601 //- /lib.rs
1590 pub struct Foo; 1602 pub struct Foo;
@@ -1593,34 +1605,36 @@ fn foo() { let bar = Ba<|>r; }
1593 /// [foo]: Foo 1605 /// [foo]: Foo
1594 pub struct B<|>ar 1606 pub struct B<|>ar
1595 ", 1607 ",
1596 &["pub struct Bar\n```\n___\n\n[my Foo](https://docs.rs/test/*/test/struct.Foo.html)"], 1608 expect![[
1609 "pub struct Bar\n```\n___\n\n[my Foo](https://docs.rs/test/*/test/struct.Foo.html)"
1610 ]],
1597 ); 1611 );
1598 } 1612 }
1599 1613
1600 #[test] 1614 #[test]
1601 fn test_hover_external_url() { 1615 fn test_hover_external_url() {
1602 check_hover_result( 1616 check(
1603 r" 1617 r"
1604 //- /lib.rs 1618 //- /lib.rs
1605 pub struct Foo; 1619 pub struct Foo;
1606 /// [external](https://www.google.com) 1620 /// [external](https://www.google.com)
1607 pub struct B<|>ar 1621 pub struct B<|>ar
1608 ", 1622 ",
1609 &["pub struct Bar\n```\n___\n\n[external](https://www.google.com)"], 1623 expect![["pub struct Bar\n```\n___\n\n[external](https://www.google.com)"]],
1610 ); 1624 );
1611 } 1625 }
1612 1626
1613 // Check that we don't rewrite links which we can't identify 1627 // Check that we don't rewrite links which we can't identify
1614 #[test] 1628 #[test]
1615 fn test_hover_unknown_target() { 1629 fn test_hover_unknown_target() {
1616 check_hover_result( 1630 check(
1617 r" 1631 r"
1618 //- /lib.rs 1632 //- /lib.rs
1619 pub struct Foo; 1633 pub struct Foo;
1620 /// [baz](Baz) 1634 /// [baz](Baz)
1621 pub struct B<|>ar 1635 pub struct B<|>ar
1622 ", 1636 ",
1623 &["pub struct Bar\n```\n___\n\n[baz](Baz)"], 1637 expect![["pub struct Bar\n```\n___\n\n[baz](Baz)"]],
1624 ); 1638 );
1625 } 1639 }
1626 1640