aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/hover.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/hover.rs')
-rw-r--r--crates/ra_ide/src/hover.rs144
1 files changed, 72 insertions, 72 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index a4c97e7f9..d067c339d 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -133,8 +133,8 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn
133fn show_implementations_action(db: &RootDatabase, def: Definition) -> Option<HoverAction> { 133fn show_implementations_action(db: &RootDatabase, def: Definition) -> Option<HoverAction> {
134 fn to_action(nav_target: NavigationTarget) -> HoverAction { 134 fn to_action(nav_target: NavigationTarget) -> HoverAction {
135 HoverAction::Implementaion(FilePosition { 135 HoverAction::Implementaion(FilePosition {
136 file_id: nav_target.file_id(), 136 file_id: nav_target.file_id,
137 offset: nav_target.range().start(), 137 offset: nav_target.focus_or_full_range().start(),
138 }) 138 })
139 } 139 }
140 140
@@ -1357,11 +1357,11 @@ fn foo_<|>test() {}
1357 1, 1357 1,
1358 ), 1358 ),
1359 full_range: 0..24, 1359 full_range: 0..24,
1360 name: "foo_test",
1361 kind: FN_DEF,
1362 focus_range: Some( 1360 focus_range: Some(
1363 11..19, 1361 11..19,
1364 ), 1362 ),
1363 name: "foo_test",
1364 kind: FN_DEF,
1365 container_name: None, 1365 container_name: None,
1366 description: None, 1366 description: None,
1367 docs: None, 1367 docs: None,
@@ -1400,11 +1400,11 @@ mod tests<|> {
1400 1, 1400 1,
1401 ), 1401 ),
1402 full_range: 0..46, 1402 full_range: 0..46,
1403 name: "tests",
1404 kind: MODULE,
1405 focus_range: Some( 1403 focus_range: Some(
1406 4..9, 1404 4..9,
1407 ), 1405 ),
1406 name: "tests",
1407 kind: MODULE,
1408 container_name: None, 1408 container_name: None,
1409 description: None, 1409 description: None,
1410 docs: None, 1410 docs: None,
@@ -1439,11 +1439,11 @@ fn main() { let s<|>t = S{ f1:0 }; }
1439 1, 1439 1,
1440 ), 1440 ),
1441 full_range: 0..19, 1441 full_range: 0..19,
1442 name: "S",
1443 kind: STRUCT_DEF,
1444 focus_range: Some( 1442 focus_range: Some(
1445 7..8, 1443 7..8,
1446 ), 1444 ),
1445 name: "S",
1446 kind: STRUCT_DEF,
1447 container_name: None, 1447 container_name: None,
1448 description: Some( 1448 description: Some(
1449 "struct S", 1449 "struct S",
@@ -1478,11 +1478,11 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; }
1478 1, 1478 1,
1479 ), 1479 ),
1480 full_range: 17..37, 1480 full_range: 17..37,
1481 name: "S",
1482 kind: STRUCT_DEF,
1483 focus_range: Some( 1481 focus_range: Some(
1484 24..25, 1482 24..25,
1485 ), 1483 ),
1484 name: "S",
1485 kind: STRUCT_DEF,
1486 container_name: None, 1486 container_name: None,
1487 description: Some( 1487 description: Some(
1488 "struct S", 1488 "struct S",
@@ -1497,11 +1497,11 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; }
1497 1, 1497 1,
1498 ), 1498 ),
1499 full_range: 0..16, 1499 full_range: 0..16,
1500 name: "Arg",
1501 kind: STRUCT_DEF,
1502 focus_range: Some( 1500 focus_range: Some(
1503 7..10, 1501 7..10,
1504 ), 1502 ),
1503 name: "Arg",
1504 kind: STRUCT_DEF,
1505 container_name: None, 1505 container_name: None,
1506 description: Some( 1506 description: Some(
1507 "struct Arg", 1507 "struct Arg",
@@ -1536,11 +1536,11 @@ fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; }
1536 1, 1536 1,
1537 ), 1537 ),
1538 full_range: 17..37, 1538 full_range: 17..37,
1539 name: "S",
1540 kind: STRUCT_DEF,
1541 focus_range: Some( 1539 focus_range: Some(
1542 24..25, 1540 24..25,
1543 ), 1541 ),
1542 name: "S",
1543 kind: STRUCT_DEF,
1544 container_name: None, 1544 container_name: None,
1545 description: Some( 1545 description: Some(
1546 "struct S", 1546 "struct S",
@@ -1555,11 +1555,11 @@ fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; }
1555 1, 1555 1,
1556 ), 1556 ),
1557 full_range: 0..16, 1557 full_range: 0..16,
1558 name: "Arg",
1559 kind: STRUCT_DEF,
1560 focus_range: Some( 1558 focus_range: Some(
1561 7..10, 1559 7..10,
1562 ), 1560 ),
1561 name: "Arg",
1562 kind: STRUCT_DEF,
1563 container_name: None, 1563 container_name: None,
1564 description: Some( 1564 description: Some(
1565 "struct Arg", 1565 "struct Arg",
@@ -1597,11 +1597,11 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); }
1597 1, 1597 1,
1598 ), 1598 ),
1599 full_range: 0..14, 1599 full_range: 0..14,
1600 name: "A",
1601 kind: STRUCT_DEF,
1602 focus_range: Some( 1600 focus_range: Some(
1603 7..8, 1601 7..8,
1604 ), 1602 ),
1603 name: "A",
1604 kind: STRUCT_DEF,
1605 container_name: None, 1605 container_name: None,
1606 description: Some( 1606 description: Some(
1607 "struct A", 1607 "struct A",
@@ -1616,11 +1616,11 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); }
1616 1, 1616 1,
1617 ), 1617 ),
1618 full_range: 15..29, 1618 full_range: 15..29,
1619 name: "B",
1620 kind: STRUCT_DEF,
1621 focus_range: Some( 1619 focus_range: Some(
1622 22..23, 1620 22..23,
1623 ), 1621 ),
1622 name: "B",
1623 kind: STRUCT_DEF,
1624 container_name: None, 1624 container_name: None,
1625 description: Some( 1625 description: Some(
1626 "struct B", 1626 "struct B",
@@ -1635,11 +1635,11 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); }
1635 1, 1635 1,
1636 ), 1636 ),
1637 full_range: 42..60, 1637 full_range: 42..60,
1638 name: "C",
1639 kind: STRUCT_DEF,
1640 focus_range: Some( 1638 focus_range: Some(
1641 53..54, 1639 53..54,
1642 ), 1640 ),
1641 name: "C",
1642 kind: STRUCT_DEF,
1643 container_name: None, 1643 container_name: None,
1644 description: Some( 1644 description: Some(
1645 "pub struct C", 1645 "pub struct C",
@@ -1674,11 +1674,11 @@ fn main() { let s<|>t = foo(); }
1674 1, 1674 1,
1675 ), 1675 ),
1676 full_range: 0..12, 1676 full_range: 0..12,
1677 name: "Foo",
1678 kind: TRAIT_DEF,
1679 focus_range: Some( 1677 focus_range: Some(
1680 6..9, 1678 6..9,
1681 ), 1679 ),
1680 name: "Foo",
1681 kind: TRAIT_DEF,
1682 container_name: None, 1682 container_name: None,
1683 description: Some( 1683 description: Some(
1684 "trait Foo", 1684 "trait Foo",
@@ -1714,11 +1714,11 @@ fn main() { let s<|>t = foo(); }
1714 1, 1714 1,
1715 ), 1715 ),
1716 full_range: 0..15, 1716 full_range: 0..15,
1717 name: "Foo",
1718 kind: TRAIT_DEF,
1719 focus_range: Some( 1717 focus_range: Some(
1720 6..9, 1718 6..9,
1721 ), 1719 ),
1720 name: "Foo",
1721 kind: TRAIT_DEF,
1722 container_name: None, 1722 container_name: None,
1723 description: Some( 1723 description: Some(
1724 "trait Foo", 1724 "trait Foo",
@@ -1733,11 +1733,11 @@ fn main() { let s<|>t = foo(); }
1733 1, 1733 1,
1734 ), 1734 ),
1735 full_range: 16..25, 1735 full_range: 16..25,
1736 name: "S",
1737 kind: STRUCT_DEF,
1738 focus_range: Some( 1736 focus_range: Some(
1739 23..24, 1737 23..24,
1740 ), 1738 ),
1739 name: "S",
1740 kind: STRUCT_DEF,
1741 container_name: None, 1741 container_name: None,
1742 description: Some( 1742 description: Some(
1743 "struct S", 1743 "struct S",
@@ -1773,11 +1773,11 @@ fn main() { let s<|>t = foo(); }
1773 1, 1773 1,
1774 ), 1774 ),
1775 full_range: 0..12, 1775 full_range: 0..12,
1776 name: "Foo",
1777 kind: TRAIT_DEF,
1778 focus_range: Some( 1776 focus_range: Some(
1779 6..9, 1777 6..9,
1780 ), 1778 ),
1779 name: "Foo",
1780 kind: TRAIT_DEF,
1781 container_name: None, 1781 container_name: None,
1782 description: Some( 1782 description: Some(
1783 "trait Foo", 1783 "trait Foo",
@@ -1792,11 +1792,11 @@ fn main() { let s<|>t = foo(); }
1792 1, 1792 1,
1793 ), 1793 ),
1794 full_range: 13..25, 1794 full_range: 13..25,
1795 name: "Bar",
1796 kind: TRAIT_DEF,
1797 focus_range: Some( 1795 focus_range: Some(
1798 19..22, 1796 19..22,
1799 ), 1797 ),
1798 name: "Bar",
1799 kind: TRAIT_DEF,
1800 container_name: None, 1800 container_name: None,
1801 description: Some( 1801 description: Some(
1802 "trait Bar", 1802 "trait Bar",
@@ -1835,11 +1835,11 @@ fn main() { let s<|>t = foo(); }
1835 1, 1835 1,
1836 ), 1836 ),
1837 full_range: 0..15, 1837 full_range: 0..15,
1838 name: "Foo",
1839 kind: TRAIT_DEF,
1840 focus_range: Some( 1838 focus_range: Some(
1841 6..9, 1839 6..9,
1842 ), 1840 ),
1841 name: "Foo",
1842 kind: TRAIT_DEF,
1843 container_name: None, 1843 container_name: None,
1844 description: Some( 1844 description: Some(
1845 "trait Foo", 1845 "trait Foo",
@@ -1854,11 +1854,11 @@ fn main() { let s<|>t = foo(); }
1854 1, 1854 1,
1855 ), 1855 ),
1856 full_range: 16..31, 1856 full_range: 16..31,
1857 name: "Bar",
1858 kind: TRAIT_DEF,
1859 focus_range: Some( 1857 focus_range: Some(
1860 22..25, 1858 22..25,
1861 ), 1859 ),
1860 name: "Bar",
1861 kind: TRAIT_DEF,
1862 container_name: None, 1862 container_name: None,
1863 description: Some( 1863 description: Some(
1864 "trait Bar", 1864 "trait Bar",
@@ -1873,11 +1873,11 @@ fn main() { let s<|>t = foo(); }
1873 1, 1873 1,
1874 ), 1874 ),
1875 full_range: 32..44, 1875 full_range: 32..44,
1876 name: "S1",
1877 kind: STRUCT_DEF,
1878 focus_range: Some( 1876 focus_range: Some(
1879 39..41, 1877 39..41,
1880 ), 1878 ),
1879 name: "S1",
1880 kind: STRUCT_DEF,
1881 container_name: None, 1881 container_name: None,
1882 description: Some( 1882 description: Some(
1883 "struct S1", 1883 "struct S1",
@@ -1892,11 +1892,11 @@ fn main() { let s<|>t = foo(); }
1892 1, 1892 1,
1893 ), 1893 ),
1894 full_range: 45..57, 1894 full_range: 45..57,
1895 name: "S2",
1896 kind: STRUCT_DEF,
1897 focus_range: Some( 1895 focus_range: Some(
1898 52..54, 1896 52..54,
1899 ), 1897 ),
1898 name: "S2",
1899 kind: STRUCT_DEF,
1900 container_name: None, 1900 container_name: None,
1901 description: Some( 1901 description: Some(
1902 "struct S2", 1902 "struct S2",
@@ -1929,11 +1929,11 @@ fn foo(ar<|>g: &impl Foo) {}
1929 1, 1929 1,
1930 ), 1930 ),
1931 full_range: 0..12, 1931 full_range: 0..12,
1932 name: "Foo",
1933 kind: TRAIT_DEF,
1934 focus_range: Some( 1932 focus_range: Some(
1935 6..9, 1933 6..9,
1936 ), 1934 ),
1935 name: "Foo",
1936 kind: TRAIT_DEF,
1937 container_name: None, 1937 container_name: None,
1938 description: Some( 1938 description: Some(
1939 "trait Foo", 1939 "trait Foo",
@@ -1969,11 +1969,11 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {}
1969 1, 1969 1,
1970 ), 1970 ),
1971 full_range: 0..12, 1971 full_range: 0..12,
1972 name: "Foo",
1973 kind: TRAIT_DEF,
1974 focus_range: Some( 1972 focus_range: Some(
1975 6..9, 1973 6..9,
1976 ), 1974 ),
1975 name: "Foo",
1976 kind: TRAIT_DEF,
1977 container_name: None, 1977 container_name: None,
1978 description: Some( 1978 description: Some(
1979 "trait Foo", 1979 "trait Foo",
@@ -1988,11 +1988,11 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {}
1988 1, 1988 1,
1989 ), 1989 ),
1990 full_range: 13..28, 1990 full_range: 13..28,
1991 name: "Bar",
1992 kind: TRAIT_DEF,
1993 focus_range: Some( 1991 focus_range: Some(
1994 19..22, 1992 19..22,
1995 ), 1993 ),
1994 name: "Bar",
1995 kind: TRAIT_DEF,
1996 container_name: None, 1996 container_name: None,
1997 description: Some( 1997 description: Some(
1998 "trait Bar", 1998 "trait Bar",
@@ -2007,11 +2007,11 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {}
2007 1, 2007 1,
2008 ), 2008 ),
2009 full_range: 29..39, 2009 full_range: 29..39,
2010 name: "S",
2011 kind: STRUCT_DEF,
2012 focus_range: Some( 2010 focus_range: Some(
2013 36..37, 2011 36..37,
2014 ), 2012 ),
2013 name: "S",
2014 kind: STRUCT_DEF,
2015 container_name: None, 2015 container_name: None,
2016 description: Some( 2016 description: Some(
2017 "struct S", 2017 "struct S",
@@ -2045,11 +2045,11 @@ fn foo(ar<|>g: &impl Foo<S>) {}
2045 1, 2045 1,
2046 ), 2046 ),
2047 full_range: 0..15, 2047 full_range: 0..15,
2048 name: "Foo",
2049 kind: TRAIT_DEF,
2050 focus_range: Some( 2048 focus_range: Some(
2051 6..9, 2049 6..9,
2052 ), 2050 ),
2051 name: "Foo",
2052 kind: TRAIT_DEF,
2053 container_name: None, 2053 container_name: None,
2054 description: Some( 2054 description: Some(
2055 "trait Foo", 2055 "trait Foo",
@@ -2064,11 +2064,11 @@ fn foo(ar<|>g: &impl Foo<S>) {}
2064 1, 2064 1,
2065 ), 2065 ),
2066 full_range: 16..27, 2066 full_range: 16..27,
2067 name: "S",
2068 kind: STRUCT_DEF,
2069 focus_range: Some( 2067 focus_range: Some(
2070 23..24, 2068 23..24,
2071 ), 2069 ),
2070 name: "S",
2071 kind: STRUCT_DEF,
2072 container_name: None, 2072 container_name: None,
2073 description: Some( 2073 description: Some(
2074 "struct S", 2074 "struct S",
@@ -2107,11 +2107,11 @@ fn main() { let s<|>t = foo(); }
2107 1, 2107 1,
2108 ), 2108 ),
2109 full_range: 42..55, 2109 full_range: 42..55,
2110 name: "B",
2111 kind: STRUCT_DEF,
2112 focus_range: Some( 2110 focus_range: Some(
2113 49..50, 2111 49..50,
2114 ), 2112 ),
2113 name: "B",
2114 kind: STRUCT_DEF,
2115 container_name: None, 2115 container_name: None,
2116 description: Some( 2116 description: Some(
2117 "struct B", 2117 "struct B",
@@ -2126,11 +2126,11 @@ fn main() { let s<|>t = foo(); }
2126 1, 2126 1,
2127 ), 2127 ),
2128 full_range: 0..12, 2128 full_range: 0..12,
2129 name: "Foo",
2130 kind: TRAIT_DEF,
2131 focus_range: Some( 2129 focus_range: Some(
2132 6..9, 2130 6..9,
2133 ), 2131 ),
2132 name: "Foo",
2133 kind: TRAIT_DEF,
2134 container_name: None, 2134 container_name: None,
2135 description: Some( 2135 description: Some(
2136 "trait Foo", 2136 "trait Foo",
@@ -2163,11 +2163,11 @@ fn foo(ar<|>g: &dyn Foo) {}
2163 1, 2163 1,
2164 ), 2164 ),
2165 full_range: 0..12, 2165 full_range: 0..12,
2166 name: "Foo",
2167 kind: TRAIT_DEF,
2168 focus_range: Some( 2166 focus_range: Some(
2169 6..9, 2167 6..9,
2170 ), 2168 ),
2169 name: "Foo",
2170 kind: TRAIT_DEF,
2171 container_name: None, 2171 container_name: None,
2172 description: Some( 2172 description: Some(
2173 "trait Foo", 2173 "trait Foo",
@@ -2201,11 +2201,11 @@ fn foo(ar<|>g: &dyn Foo<S>) {}
2201 1, 2201 1,
2202 ), 2202 ),
2203 full_range: 0..15, 2203 full_range: 0..15,
2204 name: "Foo",
2205 kind: TRAIT_DEF,
2206 focus_range: Some( 2204 focus_range: Some(
2207 6..9, 2205 6..9,
2208 ), 2206 ),
2207 name: "Foo",
2208 kind: TRAIT_DEF,
2209 container_name: None, 2209 container_name: None,
2210 description: Some( 2210 description: Some(
2211 "trait Foo", 2211 "trait Foo",
@@ -2220,11 +2220,11 @@ fn foo(ar<|>g: &dyn Foo<S>) {}
2220 1, 2220 1,
2221 ), 2221 ),
2222 full_range: 16..27, 2222 full_range: 16..27,
2223 name: "S",
2224 kind: STRUCT_DEF,
2225 focus_range: Some( 2223 focus_range: Some(
2226 23..24, 2224 23..24,
2227 ), 2225 ),
2226 name: "S",
2227 kind: STRUCT_DEF,
2228 container_name: None, 2228 container_name: None,
2229 description: Some( 2229 description: Some(
2230 "struct S", 2230 "struct S",
@@ -2261,11 +2261,11 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
2261 1, 2261 1,
2262 ), 2262 ),
2263 full_range: 0..21, 2263 full_range: 0..21,
2264 name: "ImplTrait",
2265 kind: TRAIT_DEF,
2266 focus_range: Some( 2264 focus_range: Some(
2267 6..15, 2265 6..15,
2268 ), 2266 ),
2267 name: "ImplTrait",
2268 kind: TRAIT_DEF,
2269 container_name: None, 2269 container_name: None,
2270 description: Some( 2270 description: Some(
2271 "trait ImplTrait", 2271 "trait ImplTrait",
@@ -2280,11 +2280,11 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
2280 1, 2280 1,
2281 ), 2281 ),
2282 full_range: 43..57, 2282 full_range: 43..57,
2283 name: "B",
2284 kind: STRUCT_DEF,
2285 focus_range: Some( 2283 focus_range: Some(
2286 50..51, 2284 50..51,
2287 ), 2285 ),
2286 name: "B",
2287 kind: STRUCT_DEF,
2288 container_name: None, 2288 container_name: None,
2289 description: Some( 2289 description: Some(
2290 "struct B", 2290 "struct B",
@@ -2299,11 +2299,11 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
2299 1, 2299 1,
2300 ), 2300 ),
2301 full_range: 22..42, 2301 full_range: 22..42,
2302 name: "DynTrait",
2303 kind: TRAIT_DEF,
2304 focus_range: Some( 2302 focus_range: Some(
2305 28..36, 2303 28..36,
2306 ), 2304 ),
2305 name: "DynTrait",
2306 kind: TRAIT_DEF,
2307 container_name: None, 2307 container_name: None,
2308 description: Some( 2308 description: Some(
2309 "trait DynTrait", 2309 "trait DynTrait",
@@ -2318,11 +2318,11 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
2318 1, 2318 1,
2319 ), 2319 ),
2320 full_range: 58..69, 2320 full_range: 58..69,
2321 name: "S",
2322 kind: STRUCT_DEF,
2323 focus_range: Some( 2321 focus_range: Some(
2324 65..66, 2322 65..66,
2325 ), 2323 ),
2324 name: "S",
2325 kind: STRUCT_DEF,
2326 container_name: None, 2326 container_name: None,
2327 description: Some( 2327 description: Some(
2328 "struct S", 2328 "struct S",
@@ -2366,11 +2366,11 @@ fn main() { let s<|>t = test().get(); }
2366 1, 2366 1,
2367 ), 2367 ),
2368 full_range: 0..62, 2368 full_range: 0..62,
2369 name: "Foo",
2370 kind: TRAIT_DEF,
2371 focus_range: Some( 2369 focus_range: Some(
2372 6..9, 2370 6..9,
2373 ), 2371 ),
2372 name: "Foo",
2373 kind: TRAIT_DEF,
2374 container_name: None, 2374 container_name: None,
2375 description: Some( 2375 description: Some(
2376 "trait Foo", 2376 "trait Foo",