aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide/src/hover.rs1338
1 files changed, 667 insertions, 671 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index f7a0af037..78a661c85 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -17,7 +17,7 @@ use ra_ide_db::{
17 RootDatabase, 17 RootDatabase,
18}; 18};
19use ra_syntax::{ 19use ra_syntax::{
20 ast, ast::{Path, MacroCall}, match_ast, AstNode, SyntaxKind::*, SyntaxNode, SyntaxToken, TokenAtOffset, 20 ast, ast::Path, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset,
21}; 21};
22use ra_tt::{Ident, Leaf, Literal, TokenTree}; 22use ra_tt::{Ident, Leaf, Literal, TokenTree};
23use url::Url; 23use url::Url;
@@ -534,10 +534,7 @@ fn try_resolve_intra(
534 let link_target = strip_prefixes_suffixes(link_target); 534 let link_target = strip_prefixes_suffixes(link_target);
535 535
536 // Parse link as a module path 536 // Parse link as a module path
537 // This expects a full document, which a single path isn't, but we can just ignore the errors. 537 let path = Path::parse(link_target).ok()?;
538 let parsed = SyntaxNode::new_root(ra_syntax::parse_text(link_target).0);
539 // TODO: Proper parsing
540 let path = parsed.descendants().filter_map(Path::cast).next()?;
541 let modpath = ModPath::from_src(path, &Hygiene::new_unhygienic()).unwrap(); 538 let modpath = ModPath::from_src(path, &Hygiene::new_unhygienic()).unwrap();
542 539
543 // Resolve it relative to symbol's location (according to the RFC this should consider small scopes 540 // Resolve it relative to symbol's location (according to the RFC this should consider small scopes
@@ -613,7 +610,6 @@ fn get_doc_url(db: &RootDatabase, krate: &Crate) -> Option<Url> {
613 let attrs = db.attrs(AttrDef::from(krate.root_module(db)?).into()); 610 let attrs = db.attrs(AttrDef::from(krate.root_module(db)?).into());
614 let doc_attr_q = attrs.by_key("doc"); 611 let doc_attr_q = attrs.by_key("doc");
615 612
616 // TODO: Tests for this parsing
617 let doc_url = if doc_attr_q.exists() { 613 let doc_url = if doc_attr_q.exists() {
618 doc_attr_q.tt_values().map(|tt| { 614 doc_attr_q.tt_values().map(|tt| {
619 let name = tt.token_trees.iter() 615 let name = tt.token_trees.iter()
@@ -1830,32 +1826,32 @@ fn func(foo: i32) { if true { <|>foo; }; }
1830 ); 1826 );
1831 assert_debug_snapshot!(actions, 1827 assert_debug_snapshot!(actions,
1832 @r###" 1828 @r###"
1833 [ 1829 [
1834 GoToType( 1830 GoToType(
1835 [ 1831 [
1836 HoverGotoTypeData { 1832 HoverGotoTypeData {
1837 mod_path: "S", 1833 mod_path: "test::S",
1838 nav: NavigationTarget { 1834 nav: NavigationTarget {
1839 file_id: FileId( 1835 file_id: FileId(
1840 1, 1836 1,
1841 ), 1837 ),
1842 full_range: 0..19, 1838 full_range: 0..19,
1843 name: "S", 1839 name: "S",
1844 kind: STRUCT_DEF, 1840 kind: STRUCT_DEF,
1845 focus_range: Some( 1841 focus_range: Some(
1846 7..8, 1842 7..8,
1847 ), 1843 ),
1848 container_name: None, 1844 container_name: None,
1849 description: Some( 1845 description: Some(
1850 "struct S", 1846 "struct S",
1851 ), 1847 ),
1852 docs: None, 1848 docs: None,
1853 },
1854 }, 1849 },
1855 ], 1850 },
1856 ), 1851 ],
1857 ] 1852 ),
1858 "###); 1853 ]
1854 "###);
1859 } 1855 }
1860 1856
1861 #[test] 1857 #[test]
@@ -1874,51 +1870,51 @@ fn func(foo: i32) { if true { <|>foo; }; }
1874 ); 1870 );
1875 assert_debug_snapshot!(actions, 1871 assert_debug_snapshot!(actions,
1876 @r###" 1872 @r###"
1877 [ 1873 [
1878 GoToType( 1874 GoToType(
1879 [ 1875 [
1880 HoverGotoTypeData { 1876 HoverGotoTypeData {
1881 mod_path: "S", 1877 mod_path: "test::S",
1882 nav: NavigationTarget { 1878 nav: NavigationTarget {
1883 file_id: FileId( 1879 file_id: FileId(
1884 1, 1880 1,
1885 ), 1881 ),
1886 full_range: 17..37, 1882 full_range: 17..37,
1887 name: "S", 1883 name: "S",
1888 kind: STRUCT_DEF, 1884 kind: STRUCT_DEF,
1889 focus_range: Some( 1885 focus_range: Some(
1890 24..25, 1886 24..25,
1891 ), 1887 ),
1892 container_name: None, 1888 container_name: None,
1893 description: Some( 1889 description: Some(
1894 "struct S", 1890 "struct S",
1895 ), 1891 ),
1896 docs: None, 1892 docs: None,
1897 },
1898 }, 1893 },
1899 HoverGotoTypeData { 1894 },
1900 mod_path: "Arg", 1895 HoverGotoTypeData {
1901 nav: NavigationTarget { 1896 mod_path: "test::Arg",
1902 file_id: FileId( 1897 nav: NavigationTarget {
1903 1, 1898 file_id: FileId(
1904 ), 1899 1,
1905 full_range: 0..16, 1900 ),
1906 name: "Arg", 1901 full_range: 0..16,
1907 kind: STRUCT_DEF, 1902 name: "Arg",
1908 focus_range: Some( 1903 kind: STRUCT_DEF,
1909 7..10, 1904 focus_range: Some(
1910 ), 1905 7..10,
1911 container_name: None, 1906 ),
1912 description: Some( 1907 container_name: None,
1913 "struct Arg", 1908 description: Some(
1914 ), 1909 "struct Arg",
1915 docs: None, 1910 ),
1916 }, 1911 docs: None,
1917 }, 1912 },
1918 ], 1913 },
1919 ), 1914 ],
1920 ] 1915 ),
1921 "###); 1916 ]
1917 "###);
1922 } 1918 }
1923 1919
1924 #[test] 1920 #[test]
@@ -1937,51 +1933,51 @@ fn func(foo: i32) { if true { <|>foo; }; }
1937 ); 1933 );
1938 assert_debug_snapshot!(actions, 1934 assert_debug_snapshot!(actions,
1939 @r###" 1935 @r###"
1940 [ 1936 [
1941 GoToType( 1937 GoToType(
1942 [ 1938 [
1943 HoverGotoTypeData { 1939 HoverGotoTypeData {
1944 mod_path: "S", 1940 mod_path: "test::S",
1945 nav: NavigationTarget { 1941 nav: NavigationTarget {
1946 file_id: FileId( 1942 file_id: FileId(
1947 1, 1943 1,
1948 ), 1944 ),
1949 full_range: 17..37, 1945 full_range: 17..37,
1950 name: "S", 1946 name: "S",
1951 kind: STRUCT_DEF, 1947 kind: STRUCT_DEF,
1952 focus_range: Some( 1948 focus_range: Some(
1953 24..25, 1949 24..25,
1954 ), 1950 ),
1955 container_name: None, 1951 container_name: None,
1956 description: Some( 1952 description: Some(
1957 "struct S", 1953 "struct S",
1958 ), 1954 ),
1959 docs: None, 1955 docs: None,
1960 },
1961 }, 1956 },
1962 HoverGotoTypeData { 1957 },
1963 mod_path: "Arg", 1958 HoverGotoTypeData {
1964 nav: NavigationTarget { 1959 mod_path: "test::Arg",
1965 file_id: FileId( 1960 nav: NavigationTarget {
1966 1, 1961 file_id: FileId(
1967 ), 1962 1,
1968 full_range: 0..16, 1963 ),
1969 name: "Arg", 1964 full_range: 0..16,
1970 kind: STRUCT_DEF, 1965 name: "Arg",
1971 focus_range: Some( 1966 kind: STRUCT_DEF,
1972 7..10, 1967 focus_range: Some(
1973 ), 1968 7..10,
1974 container_name: None, 1969 ),
1975 description: Some( 1970 container_name: None,
1976 "struct Arg", 1971 description: Some(
1977 ), 1972 "struct Arg",
1978 docs: None, 1973 ),
1979 }, 1974 docs: None,
1980 }, 1975 },
1981 ], 1976 },
1982 ), 1977 ],
1983 ] 1978 ),
1984 "###); 1979 ]
1980 "###);
1985 } 1981 }
1986 1982
1987 #[test] 1983 #[test]
@@ -2003,70 +1999,70 @@ fn func(foo: i32) { if true { <|>foo; }; }
2003 ); 1999 );
2004 assert_debug_snapshot!(actions, 2000 assert_debug_snapshot!(actions,
2005 @r###" 2001 @r###"
2006 [ 2002 [
2007 GoToType( 2003 GoToType(
2008 [ 2004 [
2009 HoverGotoTypeData { 2005 HoverGotoTypeData {
2010 mod_path: "A", 2006 mod_path: "test::A",
2011 nav: NavigationTarget { 2007 nav: NavigationTarget {
2012 file_id: FileId( 2008 file_id: FileId(
2013 1, 2009 1,
2014 ), 2010 ),
2015 full_range: 0..14, 2011 full_range: 0..14,
2016 name: "A", 2012 name: "A",
2017 kind: STRUCT_DEF, 2013 kind: STRUCT_DEF,
2018 focus_range: Some( 2014 focus_range: Some(
2019 7..8, 2015 7..8,
2020 ), 2016 ),
2021 container_name: None, 2017 container_name: None,
2022 description: Some( 2018 description: Some(
2023 "struct A", 2019 "struct A",
2024 ), 2020 ),
2025 docs: None, 2021 docs: None,
2026 },
2027 }, 2022 },
2028 HoverGotoTypeData { 2023 },
2029 mod_path: "B", 2024 HoverGotoTypeData {
2030 nav: NavigationTarget { 2025 mod_path: "test::B",
2031 file_id: FileId( 2026 nav: NavigationTarget {
2032 1, 2027 file_id: FileId(
2033 ), 2028 1,
2034 full_range: 15..29, 2029 ),
2035 name: "B", 2030 full_range: 15..29,
2036 kind: STRUCT_DEF, 2031 name: "B",
2037 focus_range: Some( 2032 kind: STRUCT_DEF,
2038 22..23, 2033 focus_range: Some(
2039 ), 2034 22..23,
2040 container_name: None, 2035 ),
2041 description: Some( 2036 container_name: None,
2042 "struct B", 2037 description: Some(
2043 ), 2038 "struct B",
2044 docs: None, 2039 ),
2045 }, 2040 docs: None,
2046 }, 2041 },
2047 HoverGotoTypeData { 2042 },
2048 mod_path: "M::C", 2043 HoverGotoTypeData {
2049 nav: NavigationTarget { 2044 mod_path: "test::M::C",
2050 file_id: FileId( 2045 nav: NavigationTarget {
2051 1, 2046 file_id: FileId(
2052 ), 2047 1,
2053 full_range: 42..60, 2048 ),
2054 name: "C", 2049 full_range: 42..60,
2055 kind: STRUCT_DEF, 2050 name: "C",
2056 focus_range: Some( 2051 kind: STRUCT_DEF,
2057 53..54, 2052 focus_range: Some(
2058 ), 2053 53..54,
2059 container_name: None, 2054 ),
2060 description: Some( 2055 container_name: None,
2061 "pub struct C", 2056 description: Some(
2062 ), 2057 "pub struct C",
2063 docs: None, 2058 ),
2064 }, 2059 docs: None,
2065 }, 2060 },
2066 ], 2061 },
2067 ), 2062 ],
2068 ] 2063 ),
2069 "###); 2064 ]
2065 "###);
2070 } 2066 }
2071 2067
2072 #[test] 2068 #[test]
@@ -2086,32 +2082,32 @@ fn func(foo: i32) { if true { <|>foo; }; }
2086 ); 2082 );
2087 assert_debug_snapshot!(actions, 2083 assert_debug_snapshot!(actions,
2088 @r###" 2084 @r###"
2089 [ 2085 [
2090 GoToType( 2086 GoToType(
2091 [ 2087 [
2092 HoverGotoTypeData { 2088 HoverGotoTypeData {
2093 mod_path: "Foo", 2089 mod_path: "test::Foo",
2094 nav: NavigationTarget { 2090 nav: NavigationTarget {
2095 file_id: FileId( 2091 file_id: FileId(
2096 1, 2092 1,
2097 ), 2093 ),
2098 full_range: 0..12, 2094 full_range: 0..12,
2099 name: "Foo", 2095 name: "Foo",
2100 kind: TRAIT_DEF, 2096 kind: TRAIT_DEF,
2101 focus_range: Some( 2097 focus_range: Some(
2102 6..9, 2098 6..9,
2103 ), 2099 ),
2104 container_name: None, 2100 container_name: None,
2105 description: Some( 2101 description: Some(
2106 "trait Foo", 2102 "trait Foo",
2107 ), 2103 ),
2108 docs: None, 2104 docs: None,
2109 },
2110 }, 2105 },
2111 ], 2106 },
2112 ), 2107 ],
2113 ] 2108 ),
2114 "###); 2109 ]
2110 "###);
2115 } 2111 }
2116 2112
2117 #[test] 2113 #[test]
@@ -2132,51 +2128,51 @@ fn func(foo: i32) { if true { <|>foo; }; }
2132 ); 2128 );
2133 assert_debug_snapshot!(actions, 2129 assert_debug_snapshot!(actions,
2134 @r###" 2130 @r###"
2135 [ 2131 [
2136 GoToType( 2132 GoToType(
2137 [ 2133 [
2138 HoverGotoTypeData { 2134 HoverGotoTypeData {
2139 mod_path: "Foo", 2135 mod_path: "test::Foo",
2140 nav: NavigationTarget { 2136 nav: NavigationTarget {
2141 file_id: FileId( 2137 file_id: FileId(
2142 1, 2138 1,
2143 ), 2139 ),
2144 full_range: 0..15, 2140 full_range: 0..15,
2145 name: "Foo", 2141 name: "Foo",
2146 kind: TRAIT_DEF, 2142 kind: TRAIT_DEF,
2147 focus_range: Some( 2143 focus_range: Some(
2148 6..9, 2144 6..9,
2149 ), 2145 ),
2150 container_name: None, 2146 container_name: None,
2151 description: Some( 2147 description: Some(
2152 "trait Foo", 2148 "trait Foo",
2153 ), 2149 ),
2154 docs: None, 2150 docs: None,
2155 },
2156 }, 2151 },
2157 HoverGotoTypeData { 2152 },
2158 mod_path: "S", 2153 HoverGotoTypeData {
2159 nav: NavigationTarget { 2154 mod_path: "test::S",
2160 file_id: FileId( 2155 nav: NavigationTarget {
2161 1, 2156 file_id: FileId(
2162 ), 2157 1,
2163 full_range: 16..25, 2158 ),
2164 name: "S", 2159 full_range: 16..25,
2165 kind: STRUCT_DEF, 2160 name: "S",
2166 focus_range: Some( 2161 kind: STRUCT_DEF,
2167 23..24, 2162 focus_range: Some(
2168 ), 2163 23..24,
2169 container_name: None, 2164 ),
2170 description: Some( 2165 container_name: None,
2171 "struct S", 2166 description: Some(
2172 ), 2167 "struct S",
2173 docs: None, 2168 ),
2174 }, 2169 docs: None,
2175 }, 2170 },
2176 ], 2171 },
2177 ), 2172 ],
2178 ] 2173 ),
2179 "###); 2174 ]
2175 "###);
2180 } 2176 }
2181 2177
2182 #[test] 2178 #[test]
@@ -2197,51 +2193,51 @@ fn func(foo: i32) { if true { <|>foo; }; }
2197 ); 2193 );
2198 assert_debug_snapshot!(actions, 2194 assert_debug_snapshot!(actions,
2199 @r###" 2195 @r###"
2200 [ 2196 [
2201 GoToType( 2197 GoToType(
2202 [ 2198 [
2203 HoverGotoTypeData { 2199 HoverGotoTypeData {
2204 mod_path: "Foo", 2200 mod_path: "test::Foo",
2205 nav: NavigationTarget { 2201 nav: NavigationTarget {
2206 file_id: FileId( 2202 file_id: FileId(
2207 1, 2203 1,
2208 ), 2204 ),
2209 full_range: 0..12, 2205 full_range: 0..12,
2210 name: "Foo", 2206 name: "Foo",
2211 kind: TRAIT_DEF, 2207 kind: TRAIT_DEF,
2212 focus_range: Some( 2208 focus_range: Some(
2213 6..9, 2209 6..9,
2214 ), 2210 ),
2215 container_name: None, 2211 container_name: None,
2216 description: Some( 2212 description: Some(
2217 "trait Foo", 2213 "trait Foo",
2218 ), 2214 ),
2219 docs: None, 2215 docs: None,
2220 },
2221 }, 2216 },
2222 HoverGotoTypeData { 2217 },
2223 mod_path: "Bar", 2218 HoverGotoTypeData {
2224 nav: NavigationTarget { 2219 mod_path: "test::Bar",
2225 file_id: FileId( 2220 nav: NavigationTarget {
2226 1, 2221 file_id: FileId(
2227 ), 2222 1,
2228 full_range: 13..25, 2223 ),
2229 name: "Bar", 2224 full_range: 13..25,
2230 kind: TRAIT_DEF, 2225 name: "Bar",
2231 focus_range: Some( 2226 kind: TRAIT_DEF,
2232 19..22, 2227 focus_range: Some(
2233 ), 2228 19..22,
2234 container_name: None, 2229 ),
2235 description: Some( 2230 container_name: None,
2236 "trait Bar", 2231 description: Some(
2237 ), 2232 "trait Bar",
2238 docs: None, 2233 ),
2239 }, 2234 docs: None,
2240 }, 2235 },
2241 ], 2236 },
2242 ), 2237 ],
2243 ] 2238 ),
2244 "###); 2239 ]
2240 "###);
2245 } 2241 }
2246 2242
2247 #[test] 2243 #[test]
@@ -2264,89 +2260,89 @@ fn func(foo: i32) { if true { <|>foo; }; }
2264 ); 2260 );
2265 assert_debug_snapshot!(actions, 2261 assert_debug_snapshot!(actions,
2266 @r###" 2262 @r###"
2267 [ 2263 [
2268 GoToType( 2264 GoToType(
2269 [ 2265 [
2270 HoverGotoTypeData { 2266 HoverGotoTypeData {
2271 mod_path: "Foo", 2267 mod_path: "test::Foo",
2272 nav: NavigationTarget { 2268 nav: NavigationTarget {
2273 file_id: FileId( 2269 file_id: FileId(
2274 1, 2270 1,
2275 ), 2271 ),
2276 full_range: 0..15, 2272 full_range: 0..15,
2277 name: "Foo", 2273 name: "Foo",
2278 kind: TRAIT_DEF, 2274 kind: TRAIT_DEF,
2279 focus_range: Some( 2275 focus_range: Some(
2280 6..9, 2276 6..9,
2281 ), 2277 ),
2282 container_name: None, 2278 container_name: None,
2283 description: Some( 2279 description: Some(
2284 "trait Foo", 2280 "trait Foo",
2285 ), 2281 ),
2286 docs: None, 2282 docs: None,
2287 },
2288 }, 2283 },
2289 HoverGotoTypeData { 2284 },
2290 mod_path: "Bar", 2285 HoverGotoTypeData {
2291 nav: NavigationTarget { 2286 mod_path: "test::Bar",
2292 file_id: FileId( 2287 nav: NavigationTarget {
2293 1, 2288 file_id: FileId(
2294 ), 2289 1,
2295 full_range: 16..31, 2290 ),
2296 name: "Bar", 2291 full_range: 16..31,
2297 kind: TRAIT_DEF, 2292 name: "Bar",
2298 focus_range: Some( 2293 kind: TRAIT_DEF,
2299 22..25, 2294 focus_range: Some(
2300 ), 2295 22..25,
2301 container_name: None, 2296 ),
2302 description: Some( 2297 container_name: None,
2303 "trait Bar", 2298 description: Some(
2304 ), 2299 "trait Bar",
2305 docs: None, 2300 ),
2306 }, 2301 docs: None,
2307 }, 2302 },
2308 HoverGotoTypeData { 2303 },
2309 mod_path: "S1", 2304 HoverGotoTypeData {
2310 nav: NavigationTarget { 2305 mod_path: "test::S1",
2311 file_id: FileId( 2306 nav: NavigationTarget {
2312 1, 2307 file_id: FileId(
2313 ), 2308 1,
2314 full_range: 32..44, 2309 ),
2315 name: "S1", 2310 full_range: 32..44,
2316 kind: STRUCT_DEF, 2311 name: "S1",
2317 focus_range: Some( 2312 kind: STRUCT_DEF,
2318 39..41, 2313 focus_range: Some(
2319 ), 2314 39..41,
2320 container_name: None, 2315 ),
2321 description: Some( 2316 container_name: None,
2322 "struct S1", 2317 description: Some(
2323 ), 2318 "struct S1",
2324 docs: None, 2319 ),
2325 }, 2320 docs: None,
2326 }, 2321 },
2327 HoverGotoTypeData { 2322 },
2328 mod_path: "S2", 2323 HoverGotoTypeData {
2329 nav: NavigationTarget { 2324 mod_path: "test::S2",
2330 file_id: FileId( 2325 nav: NavigationTarget {
2331 1, 2326 file_id: FileId(
2332 ), 2327 1,
2333 full_range: 45..57, 2328 ),
2334 name: "S2", 2329 full_range: 45..57,
2335 kind: STRUCT_DEF, 2330 name: "S2",
2336 focus_range: Some( 2331 kind: STRUCT_DEF,
2337 52..54, 2332 focus_range: Some(
2338 ), 2333 52..54,
2339 container_name: None, 2334 ),
2340 description: Some( 2335 container_name: None,
2341 "struct S2", 2336 description: Some(
2342 ), 2337 "struct S2",
2343 docs: None, 2338 ),
2344 }, 2339 docs: None,
2345 }, 2340 },
2346 ], 2341 },
2347 ), 2342 ],
2348 ] 2343 ),
2349 "###); 2344 ]
2345 "###);
2350 } 2346 }
2351 2347
2352 #[test] 2348 #[test]
@@ -2361,32 +2357,32 @@ fn func(foo: i32) { if true { <|>foo; }; }
2361 ); 2357 );
2362 assert_debug_snapshot!(actions, 2358 assert_debug_snapshot!(actions,
2363 @r###" 2359 @r###"
2364 [ 2360 [
2365 GoToType( 2361 GoToType(
2366 [ 2362 [
2367 HoverGotoTypeData { 2363 HoverGotoTypeData {
2368 mod_path: "Foo", 2364 mod_path: "test::Foo",
2369 nav: NavigationTarget { 2365 nav: NavigationTarget {
2370 file_id: FileId( 2366 file_id: FileId(
2371 1, 2367 1,
2372 ), 2368 ),
2373 full_range: 0..12, 2369 full_range: 0..12,
2374 name: "Foo", 2370 name: "Foo",
2375 kind: TRAIT_DEF, 2371 kind: TRAIT_DEF,
2376 focus_range: Some( 2372 focus_range: Some(
2377 6..9, 2373 6..9,
2378 ), 2374 ),
2379 container_name: None, 2375 container_name: None,
2380 description: Some( 2376 description: Some(
2381 "trait Foo", 2377 "trait Foo",
2382 ), 2378 ),
2383 docs: None, 2379 docs: None,
2384 },
2385 }, 2380 },
2386 ], 2381 },
2387 ), 2382 ],
2388 ] 2383 ),
2389 "###); 2384 ]
2385 "###);
2390 } 2386 }
2391 2387
2392 #[test] 2388 #[test]
@@ -2404,70 +2400,70 @@ fn func(foo: i32) { if true { <|>foo; }; }
2404 ); 2400 );
2405 assert_debug_snapshot!(actions, 2401 assert_debug_snapshot!(actions,
2406 @r###" 2402 @r###"
2407 [ 2403 [
2408 GoToType( 2404 GoToType(
2409 [ 2405 [
2410 HoverGotoTypeData { 2406 HoverGotoTypeData {
2411 mod_path: "Foo", 2407 mod_path: "test::Foo",
2412 nav: NavigationTarget { 2408 nav: NavigationTarget {
2413 file_id: FileId( 2409 file_id: FileId(
2414 1, 2410 1,
2415 ), 2411 ),
2416 full_range: 0..12, 2412 full_range: 0..12,
2417 name: "Foo", 2413 name: "Foo",
2418 kind: TRAIT_DEF, 2414 kind: TRAIT_DEF,
2419 focus_range: Some( 2415 focus_range: Some(
2420 6..9, 2416 6..9,
2421 ), 2417 ),
2422 container_name: None, 2418 container_name: None,
2423 description: Some( 2419 description: Some(
2424 "trait Foo", 2420 "trait Foo",
2425 ), 2421 ),
2426 docs: None, 2422 docs: None,
2427 },
2428 }, 2423 },
2429 HoverGotoTypeData { 2424 },
2430 mod_path: "Bar", 2425 HoverGotoTypeData {
2431 nav: NavigationTarget { 2426 mod_path: "test::Bar",
2432 file_id: FileId( 2427 nav: NavigationTarget {
2433 1, 2428 file_id: FileId(
2434 ), 2429 1,
2435 full_range: 13..28, 2430 ),
2436 name: "Bar", 2431 full_range: 13..28,
2437 kind: TRAIT_DEF, 2432 name: "Bar",
2438 focus_range: Some( 2433 kind: TRAIT_DEF,
2439 19..22, 2434 focus_range: Some(
2440 ), 2435 19..22,
2441 container_name: None, 2436 ),
2442 description: Some( 2437 container_name: None,
2443 "trait Bar", 2438 description: Some(
2444 ), 2439 "trait Bar",
2445 docs: None, 2440 ),
2446 }, 2441 docs: None,
2447 }, 2442 },
2448 HoverGotoTypeData { 2443 },
2449 mod_path: "S", 2444 HoverGotoTypeData {
2450 nav: NavigationTarget { 2445 mod_path: "test::S",
2451 file_id: FileId( 2446 nav: NavigationTarget {
2452 1, 2447 file_id: FileId(
2453 ), 2448 1,
2454 full_range: 29..39, 2449 ),
2455 name: "S", 2450 full_range: 29..39,
2456 kind: STRUCT_DEF, 2451 name: "S",
2457 focus_range: Some( 2452 kind: STRUCT_DEF,
2458 36..37, 2453 focus_range: Some(
2459 ), 2454 36..37,
2460 container_name: None, 2455 ),
2461 description: Some( 2456 container_name: None,
2462 "struct S", 2457 description: Some(
2463 ), 2458 "struct S",
2464 docs: None, 2459 ),
2465 }, 2460 docs: None,
2466 }, 2461 },
2467 ], 2462 },
2468 ), 2463 ],
2469 ] 2464 ),
2470 "###); 2465 ]
2466 "###);
2471 } 2467 }
2472 2468
2473 #[test] 2469 #[test]
@@ -2483,51 +2479,51 @@ fn func(foo: i32) { if true { <|>foo; }; }
2483 ); 2479 );
2484 assert_debug_snapshot!(actions, 2480 assert_debug_snapshot!(actions,
2485 @r###" 2481 @r###"
2486 [ 2482 [
2487 GoToType( 2483 GoToType(
2488 [ 2484 [
2489 HoverGotoTypeData { 2485 HoverGotoTypeData {
2490 mod_path: "Foo", 2486 mod_path: "test::Foo",
2491 nav: NavigationTarget { 2487 nav: NavigationTarget {
2492 file_id: FileId( 2488 file_id: FileId(
2493 1, 2489 1,
2494 ), 2490 ),
2495 full_range: 0..15, 2491 full_range: 0..15,
2496 name: "Foo", 2492 name: "Foo",
2497 kind: TRAIT_DEF, 2493 kind: TRAIT_DEF,
2498 focus_range: Some( 2494 focus_range: Some(
2499 6..9, 2495 6..9,
2500 ), 2496 ),
2501 container_name: None, 2497 container_name: None,
2502 description: Some( 2498 description: Some(
2503 "trait Foo", 2499 "trait Foo",
2504 ), 2500 ),
2505 docs: None, 2501 docs: None,
2506 },
2507 }, 2502 },
2508 HoverGotoTypeData { 2503 },
2509 mod_path: "S", 2504 HoverGotoTypeData {
2510 nav: NavigationTarget { 2505 mod_path: "test::S",
2511 file_id: FileId( 2506 nav: NavigationTarget {
2512 1, 2507 file_id: FileId(
2513 ), 2508 1,
2514 full_range: 16..27, 2509 ),
2515 name: "S", 2510 full_range: 16..27,
2516 kind: STRUCT_DEF, 2511 name: "S",
2517 focus_range: Some( 2512 kind: STRUCT_DEF,
2518 23..24, 2513 focus_range: Some(
2519 ), 2514 23..24,
2520 container_name: None, 2515 ),
2521 description: Some( 2516 container_name: None,
2522 "struct S", 2517 description: Some(
2523 ), 2518 "struct S",
2524 docs: None, 2519 ),
2525 }, 2520 docs: None,
2526 }, 2521 },
2527 ], 2522 },
2528 ), 2523 ],
2529 ] 2524 ),
2530 "###); 2525 ]
2526 "###);
2531 } 2527 }
2532 2528
2533 #[test] 2529 #[test]
@@ -2555,7 +2551,7 @@ fn func(foo: i32) { if true { <|>foo; }; }
2555 GoToType( 2551 GoToType(
2556 [ 2552 [
2557 HoverGotoTypeData { 2553 HoverGotoTypeData {
2558 mod_path: "B", 2554 mod_path: "test::B",
2559 nav: NavigationTarget { 2555 nav: NavigationTarget {
2560 file_id: FileId( 2556 file_id: FileId(
2561 1, 2557 1,
@@ -2574,7 +2570,7 @@ fn func(foo: i32) { if true { <|>foo; }; }
2574 }, 2570 },
2575 }, 2571 },
2576 HoverGotoTypeData { 2572 HoverGotoTypeData {
2577 mod_path: "Foo", 2573 mod_path: "test::Foo",
2578 nav: NavigationTarget { 2574 nav: NavigationTarget {
2579 file_id: FileId( 2575 file_id: FileId(
2580 1, 2576 1,
@@ -2610,32 +2606,32 @@ fn func(foo: i32) { if true { <|>foo; }; }
2610 ); 2606 );
2611 assert_debug_snapshot!(actions, 2607 assert_debug_snapshot!(actions,
2612 @r###" 2608 @r###"
2613 [ 2609 [
2614 GoToType( 2610 GoToType(
2615 [ 2611 [
2616 HoverGotoTypeData { 2612 HoverGotoTypeData {
2617 mod_path: "Foo", 2613 mod_path: "test::Foo",
2618 nav: NavigationTarget { 2614 nav: NavigationTarget {
2619 file_id: FileId( 2615 file_id: FileId(
2620 1, 2616 1,
2621 ), 2617 ),
2622 full_range: 0..12, 2618 full_range: 0..12,
2623 name: "Foo", 2619 name: "Foo",
2624 kind: TRAIT_DEF, 2620 kind: TRAIT_DEF,
2625 focus_range: Some( 2621 focus_range: Some(
2626 6..9, 2622 6..9,
2627 ), 2623 ),
2628 container_name: None, 2624 container_name: None,
2629 description: Some( 2625 description: Some(
2630 "trait Foo", 2626 "trait Foo",
2631 ), 2627 ),
2632 docs: None, 2628 docs: None,
2633 },
2634 }, 2629 },
2635 ], 2630 },
2636 ), 2631 ],
2637 ] 2632 ),
2638 "###); 2633 ]
2634 "###);
2639 } 2635 }
2640 2636
2641 #[test] 2637 #[test]
@@ -2651,51 +2647,51 @@ fn func(foo: i32) { if true { <|>foo; }; }
2651 ); 2647 );
2652 assert_debug_snapshot!(actions, 2648 assert_debug_snapshot!(actions,
2653 @r###" 2649 @r###"
2654 [ 2650 [
2655 GoToType( 2651 GoToType(
2656 [ 2652 [
2657 HoverGotoTypeData { 2653 HoverGotoTypeData {
2658 mod_path: "Foo", 2654 mod_path: "test::Foo",
2659 nav: NavigationTarget { 2655 nav: NavigationTarget {
2660 file_id: FileId( 2656 file_id: FileId(
2661 1, 2657 1,
2662 ), 2658 ),
2663 full_range: 0..15, 2659 full_range: 0..15,
2664 name: "Foo", 2660 name: "Foo",
2665 kind: TRAIT_DEF, 2661 kind: TRAIT_DEF,
2666 focus_range: Some( 2662 focus_range: Some(
2667 6..9, 2663 6..9,
2668 ), 2664 ),
2669 container_name: None, 2665 container_name: None,
2670 description: Some( 2666 description: Some(
2671 "trait Foo", 2667 "trait Foo",
2672 ), 2668 ),
2673 docs: None, 2669 docs: None,
2674 },
2675 }, 2670 },
2676 HoverGotoTypeData { 2671 },
2677 mod_path: "S", 2672 HoverGotoTypeData {
2678 nav: NavigationTarget { 2673 mod_path: "test::S",
2679 file_id: FileId( 2674 nav: NavigationTarget {
2680 1, 2675 file_id: FileId(
2681 ), 2676 1,
2682 full_range: 16..27, 2677 ),
2683 name: "S", 2678 full_range: 16..27,
2684 kind: STRUCT_DEF, 2679 name: "S",
2685 focus_range: Some( 2680 kind: STRUCT_DEF,
2686 23..24, 2681 focus_range: Some(
2687 ), 2682 23..24,
2688 container_name: None, 2683 ),
2689 description: Some( 2684 container_name: None,
2690 "struct S", 2685 description: Some(
2691 ), 2686 "struct S",
2692 docs: None, 2687 ),
2693 }, 2688 docs: None,
2694 }, 2689 },
2695 ], 2690 },
2696 ), 2691 ],
2697 ] 2692 ),
2698 "###); 2693 ]
2694 "###);
2699 } 2695 }
2700 2696
2701 #[test] 2697 #[test]
@@ -2714,89 +2710,89 @@ fn func(foo: i32) { if true { <|>foo; }; }
2714 ); 2710 );
2715 assert_debug_snapshot!(actions, 2711 assert_debug_snapshot!(actions,
2716 @r###" 2712 @r###"
2717 [ 2713 [
2718 GoToType( 2714 GoToType(
2719 [ 2715 [
2720 HoverGotoTypeData { 2716 HoverGotoTypeData {
2721 mod_path: "ImplTrait", 2717 mod_path: "test::ImplTrait",
2722 nav: NavigationTarget { 2718 nav: NavigationTarget {
2723 file_id: FileId( 2719 file_id: FileId(
2724 1, 2720 1,
2725 ), 2721 ),
2726 full_range: 0..21, 2722 full_range: 0..21,
2727 name: "ImplTrait", 2723 name: "ImplTrait",
2728 kind: TRAIT_DEF, 2724 kind: TRAIT_DEF,
2729 focus_range: Some( 2725 focus_range: Some(
2730 6..15, 2726 6..15,
2731 ), 2727 ),
2732 container_name: None, 2728 container_name: None,
2733 description: Some( 2729 description: Some(
2734 "trait ImplTrait", 2730 "trait ImplTrait",
2735 ), 2731 ),
2736 docs: None, 2732 docs: None,
2737 },
2738 }, 2733 },
2739 HoverGotoTypeData { 2734 },
2740 mod_path: "B", 2735 HoverGotoTypeData {
2741 nav: NavigationTarget { 2736 mod_path: "test::B",
2742 file_id: FileId( 2737 nav: NavigationTarget {
2743 1, 2738 file_id: FileId(
2744 ), 2739 1,
2745 full_range: 43..57, 2740 ),
2746 name: "B", 2741 full_range: 43..57,
2747 kind: STRUCT_DEF, 2742 name: "B",
2748 focus_range: Some( 2743 kind: STRUCT_DEF,
2749 50..51, 2744 focus_range: Some(
2750 ), 2745 50..51,
2751 container_name: None, 2746 ),
2752 description: Some( 2747 container_name: None,
2753 "struct B", 2748 description: Some(
2754 ), 2749 "struct B",
2755 docs: None, 2750 ),
2756 }, 2751 docs: None,
2757 }, 2752 },
2758 HoverGotoTypeData { 2753 },
2759 mod_path: "DynTrait", 2754 HoverGotoTypeData {
2760 nav: NavigationTarget { 2755 mod_path: "test::DynTrait",
2761 file_id: FileId( 2756 nav: NavigationTarget {
2762 1, 2757 file_id: FileId(
2763 ), 2758 1,
2764 full_range: 22..42, 2759 ),
2765 name: "DynTrait", 2760 full_range: 22..42,
2766 kind: TRAIT_DEF, 2761 name: "DynTrait",
2767 focus_range: Some( 2762 kind: TRAIT_DEF,
2768 28..36, 2763 focus_range: Some(
2769 ), 2764 28..36,
2770 container_name: None, 2765 ),
2771 description: Some( 2766 container_name: None,
2772 "trait DynTrait", 2767 description: Some(
2773 ), 2768 "trait DynTrait",
2774 docs: None, 2769 ),
2775 }, 2770 docs: None,
2776 }, 2771 },
2777 HoverGotoTypeData { 2772 },
2778 mod_path: "S", 2773 HoverGotoTypeData {
2779 nav: NavigationTarget { 2774 mod_path: "test::S",
2780 file_id: FileId( 2775 nav: NavigationTarget {
2781 1, 2776 file_id: FileId(
2782 ), 2777 1,
2783 full_range: 58..69, 2778 ),
2784 name: "S", 2779 full_range: 58..69,
2785 kind: STRUCT_DEF, 2780 name: "S",
2786 focus_range: Some( 2781 kind: STRUCT_DEF,
2787 65..66, 2782 focus_range: Some(
2788 ), 2783 65..66,
2789 container_name: None, 2784 ),
2790 description: Some( 2785 container_name: None,
2791 "struct S", 2786 description: Some(
2792 ), 2787 "struct S",
2793 docs: None, 2788 ),
2794 }, 2789 docs: None,
2795 }, 2790 },
2796 ], 2791 },
2797 ), 2792 ],
2798 ] 2793 ),
2799 "###); 2794 ]
2795 "###);
2800 } 2796 }
2801 2797
2802 #[test] 2798 #[test]
@@ -2828,31 +2824,31 @@ fn func(foo: i32) { if true { <|>foo; }; }
2828 ); 2824 );
2829 assert_debug_snapshot!(actions, 2825 assert_debug_snapshot!(actions,
2830 @r###" 2826 @r###"
2831 [ 2827 [
2832 GoToType( 2828 GoToType(
2833 [ 2829 [
2834 HoverGotoTypeData { 2830 HoverGotoTypeData {
2835 mod_path: "Foo", 2831 mod_path: "test::Foo",
2836 nav: NavigationTarget { 2832 nav: NavigationTarget {
2837 file_id: FileId( 2833 file_id: FileId(
2838 1, 2834 1,
2839 ), 2835 ),
2840 full_range: 0..62, 2836 full_range: 0..62,
2841 name: "Foo", 2837 name: "Foo",
2842 kind: TRAIT_DEF, 2838 kind: TRAIT_DEF,
2843 focus_range: Some( 2839 focus_range: Some(
2844 6..9, 2840 6..9,
2845 ), 2841 ),
2846 container_name: None, 2842 container_name: None,
2847 description: Some( 2843 description: Some(
2848 "trait Foo", 2844 "trait Foo",
2849 ), 2845 ),
2850 docs: None, 2846 docs: None,
2851 },
2852 }, 2847 },
2853 ], 2848 },
2854 ), 2849 ],
2855 ] 2850 ),
2856 "###); 2851 ]
2852 "###);
2857 } 2853 }
2858} 2854}