diff options
author | Kirill Bulatov <[email protected]> | 2019-12-19 10:45:00 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2019-12-19 10:45:00 +0000 |
commit | 3969c7c85373554fcd80aee359cd0def14f7a528 (patch) | |
tree | f0b3a1840fd95e81bb483213570f3c67f9f305ac | |
parent | 14c167a9f6da07024a5101ffa04bc2f79ce64353 (diff) |
Ensure hover shows full type declaration
-rw-r--r-- | crates/ra_ide/src/hover.rs | 17 | ||||
-rw-r--r-- | crates/ra_ide/src/inlay_hints.rs | 4 |
2 files changed, 19 insertions, 2 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 51e320128..7d2f160e7 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -425,6 +425,23 @@ mod tests { | |||
425 | } | 425 | } |
426 | 426 | ||
427 | #[test] | 427 | #[test] |
428 | fn hover_default_generic_type() { | ||
429 | check_hover_result( | ||
430 | r#" | ||
431 | //- /main.rs | ||
432 | struct Test<K, T = u8> { | ||
433 | k: K, | ||
434 | t: T, | ||
435 | } | ||
436 | |||
437 | fn main() { | ||
438 | let zz<|> = Test { t: 23, k: 33 }; | ||
439 | }"#, | ||
440 | &["Test<i32, u8>"], | ||
441 | ); | ||
442 | } | ||
443 | |||
444 | #[test] | ||
428 | fn hover_some() { | 445 | fn hover_some() { |
429 | let (analysis, position) = single_file_with_position( | 446 | let (analysis, position) = single_file_with_position( |
430 | " | 447 | " |
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index 8674912a6..319ac0048 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -164,7 +164,7 @@ mod tests { | |||
164 | let (analysis, file_id) = single_file( | 164 | let (analysis, file_id) = single_file( |
165 | r#" | 165 | r#" |
166 | struct Test<K, T = u8> { | 166 | struct Test<K, T = u8> { |
167 | k: K, | 167 | k: K, |
168 | t: T, | 168 | t: T, |
169 | } | 169 | } |
170 | 170 | ||
@@ -176,7 +176,7 @@ fn main() { | |||
176 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None, false).unwrap(), @r###" | 176 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None, false).unwrap(), @r###" |
177 | [ | 177 | [ |
178 | InlayHint { | 178 | InlayHint { |
179 | range: [65; 67), | 179 | range: [69; 71), |
180 | kind: TypeHint, | 180 | kind: TypeHint, |
181 | label: "Test<i32>", | 181 | label: "Test<i32>", |
182 | }, | 182 | }, |