diff options
author | vsrs <[email protected]> | 2020-06-10 20:56:49 +0100 |
---|---|---|
committer | vsrs <[email protected]> | 2020-06-18 08:15:43 +0100 |
commit | 283ec13fc06dda7ec4d22955e2d2eb96aaff95fd (patch) | |
tree | 9d51e0c0e3ff100524cab9bdbda3216429992aed /crates/ra_ide/src | |
parent | c50157f33025b6ff01809b975a3d12c0e43a0072 (diff) |
Fix type "items" order.
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/hover.rs | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index c434e5c8b..c4ee2ff79 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -234,9 +234,10 @@ fn runnable_action( | |||
234 | fn goto_type_action(db: &RootDatabase, def: Definition) -> Option<HoverAction> { | 234 | fn goto_type_action(db: &RootDatabase, def: Definition) -> Option<HoverAction> { |
235 | match def { | 235 | match def { |
236 | Definition::Local(it) => { | 236 | Definition::Local(it) => { |
237 | let ty = it.ty(db); | 237 | let targets = it |
238 | let v = ty.flattened_type_items(db); | 238 | .ty(db) |
239 | let targets = v.into_iter() | 239 | .flattened_type_items(db) |
240 | .into_iter() | ||
240 | .map(|it| HoverGotoTypeData { | 241 | .map(|it| HoverGotoTypeData { |
241 | mod_path: adt_or_trait_mod_path(db, &it), | 242 | mod_path: adt_or_trait_mod_path(db, &it), |
242 | nav: it.to_nav(db), | 243 | nav: it.to_nav(db), |
@@ -1980,7 +1981,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1980 | } | 1981 | } |
1981 | 1982 | ||
1982 | #[test] | 1983 | #[test] |
1983 | fn test_hover_arg_goto_type_action() { | 1984 | fn test_hover_goto_type_action_links_order() { |
1984 | let (_, actions) = check_hover_result( | 1985 | let (_, actions) = check_hover_result( |
1985 | " | 1986 | " |
1986 | //- /lib.rs | 1987 | //- /lib.rs |
@@ -1988,10 +1989,10 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
1988 | trait DynTrait<T> {} | 1989 | trait DynTrait<T> {} |
1989 | struct B<T> {} | 1990 | struct B<T> {} |
1990 | struct S {} | 1991 | struct S {} |
1991 | 1992 | ||
1992 | fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<S>>>) {} | 1993 | fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {} |
1993 | ", | 1994 | ", |
1994 | &["&impl ImplTrait<B<dyn DynTrait<S>>>"], | 1995 | &["&impl ImplTrait<B<dyn DynTrait<B<S>>>>"], |
1995 | ); | 1996 | ); |
1996 | assert_debug_snapshot!(actions, | 1997 | assert_debug_snapshot!(actions, |
1997 | @r###" | 1998 | @r###" |
@@ -2018,20 +2019,20 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
2018 | }, | 2019 | }, |
2019 | }, | 2020 | }, |
2020 | HoverGotoTypeData { | 2021 | HoverGotoTypeData { |
2021 | mod_path: "S", | 2022 | mod_path: "B", |
2022 | nav: NavigationTarget { | 2023 | nav: NavigationTarget { |
2023 | file_id: FileId( | 2024 | file_id: FileId( |
2024 | 1, | 2025 | 1, |
2025 | ), | 2026 | ), |
2026 | full_range: 58..69, | 2027 | full_range: 43..57, |
2027 | name: "S", | 2028 | name: "B", |
2028 | kind: STRUCT_DEF, | 2029 | kind: STRUCT_DEF, |
2029 | focus_range: Some( | 2030 | focus_range: Some( |
2030 | 65..66, | 2031 | 50..51, |
2031 | ), | 2032 | ), |
2032 | container_name: None, | 2033 | container_name: None, |
2033 | description: Some( | 2034 | description: Some( |
2034 | "struct S", | 2035 | "struct B", |
2035 | ), | 2036 | ), |
2036 | docs: None, | 2037 | docs: None, |
2037 | }, | 2038 | }, |
@@ -2056,20 +2057,20 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
2056 | }, | 2057 | }, |
2057 | }, | 2058 | }, |
2058 | HoverGotoTypeData { | 2059 | HoverGotoTypeData { |
2059 | mod_path: "B", | 2060 | mod_path: "S", |
2060 | nav: NavigationTarget { | 2061 | nav: NavigationTarget { |
2061 | file_id: FileId( | 2062 | file_id: FileId( |
2062 | 1, | 2063 | 1, |
2063 | ), | 2064 | ), |
2064 | full_range: 43..57, | 2065 | full_range: 58..69, |
2065 | name: "B", | 2066 | name: "S", |
2066 | kind: STRUCT_DEF, | 2067 | kind: STRUCT_DEF, |
2067 | focus_range: Some( | 2068 | focus_range: Some( |
2068 | 50..51, | 2069 | 65..66, |
2069 | ), | 2070 | ), |
2070 | container_name: None, | 2071 | container_name: None, |
2071 | description: Some( | 2072 | description: Some( |
2072 | "struct B", | 2073 | "struct S", |
2073 | ), | 2074 | ), |
2074 | docs: None, | 2075 | docs: None, |
2075 | }, | 2076 | }, |