From 3969c7c85373554fcd80aee359cd0def14f7a528 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 19 Dec 2019 12:45:00 +0200 Subject: Ensure hover shows full type declaration --- crates/ra_ide/src/hover.rs | 17 +++++++++++++++++ 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 @@ -424,6 +424,23 @@ mod tests { ); } + #[test] + fn hover_default_generic_type() { + check_hover_result( + r#" +//- /main.rs +struct Test { + k: K, + t: T, +} + +fn main() { + let zz<|> = Test { t: 23, k: 33 }; +}"#, + &["Test"], + ); + } + #[test] fn hover_some() { let (analysis, position) = single_file_with_position( 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 { let (analysis, file_id) = single_file( r#" struct Test { -k: K, + k: K, t: T, } @@ -176,7 +176,7 @@ fn main() { assert_debug_snapshot!(analysis.inlay_hints(file_id, None, false).unwrap(), @r###" [ InlayHint { - range: [65; 67), + range: [69; 71), kind: TypeHint, label: "Test", }, -- cgit v1.2.3