aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-05-06 10:08:50 +0100
committerBenjamin Coenen <[email protected]>2020-05-06 10:08:50 +0100
commit550c62949829c16861aefd6c1aea240709343ac8 (patch)
tree4859212d919e7f7ce4a97b3b343db36a1dc59798 /crates/ra_ide
parentc4d128e454448191c4b21d8e151c673e4c42376e (diff)
do not truncate display for hover
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/hover.rs43
1 files changed, 42 insertions, 1 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index df8451af2..d52f22157 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -143,7 +143,7 @@ fn hover_text_from_name_kind(db: &RootDatabase, def: Definition) -> Option<Strin
143 ModuleDef::TypeAlias(it) => from_def_source(db, it, mod_path), 143 ModuleDef::TypeAlias(it) => from_def_source(db, it, mod_path),
144 ModuleDef::BuiltinType(it) => Some(it.to_string()), 144 ModuleDef::BuiltinType(it) => Some(it.to_string()),
145 }, 145 },
146 Definition::Local(it) => Some(rust_code_markup(&it.ty(db).display_truncated(db, None))), 146 Definition::Local(it) => Some(rust_code_markup(&it.ty(db).display(db))),
147 Definition::TypeParam(_) | Definition::SelfType(_) => { 147 Definition::TypeParam(_) | Definition::SelfType(_) => {
148 // FIXME: Hover for generic param 148 // FIXME: Hover for generic param
149 None 149 None
@@ -280,6 +280,47 @@ mod tests {
280 } 280 }
281 281
282 #[test] 282 #[test]
283 fn hover_shows_long_type_of_an_expression() {
284 check_hover_result(
285 r#"
286 //- /main.rs
287 struct Scan<A, B, C> {
288 a: A,
289 b: B,
290 c: C,
291 }
292
293 struct FakeIter<I> {
294 inner: I,
295 }
296
297 struct OtherStruct<T> {
298 i: T,
299 }
300
301 enum FakeOption<T> {
302 Some(T),
303 None,
304 }
305
306 fn scan<A, B, C>(a: A, b: B, c: C) -> FakeIter<Scan<OtherStruct<A>, B, C>> {
307 FakeIter { inner: Scan { a, b, c } }
308 }
309
310 fn main() {
311 let num: i32 = 55;
312 let closure = |memo: &mut u32, value: &u32, _another: &mut u32| -> FakeOption<u32> {
313 FakeOption::Some(*memo + value)
314 };
315 let number = 5u32;
316 let mut iter<|> = scan(OtherStruct { i: num }, closure, number);
317 }
318 "#,
319 &["FakeIter<Scan<OtherStruct<OtherStruct<i32>>, |&mut u32, &u32, &mut u32| -> FakeOption<u32>, u32>>"],
320 );
321 }
322
323 #[test]
283 fn hover_shows_fn_signature() { 324 fn hover_shows_fn_signature() {
284 // Single file with result 325 // Single file with result
285 check_hover_result( 326 check_hover_result(