mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
do not truncate display for hover
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
parent
c4d128e454
commit
550c629498
1 changed files with 42 additions and 1 deletions
|
@ -143,7 +143,7 @@ fn hover_text_from_name_kind(db: &RootDatabase, def: Definition) -> Option<Strin
|
||||||
ModuleDef::TypeAlias(it) => from_def_source(db, it, mod_path),
|
ModuleDef::TypeAlias(it) => from_def_source(db, it, mod_path),
|
||||||
ModuleDef::BuiltinType(it) => Some(it.to_string()),
|
ModuleDef::BuiltinType(it) => Some(it.to_string()),
|
||||||
},
|
},
|
||||||
Definition::Local(it) => Some(rust_code_markup(&it.ty(db).display_truncated(db, None))),
|
Definition::Local(it) => Some(rust_code_markup(&it.ty(db).display(db))),
|
||||||
Definition::TypeParam(_) | Definition::SelfType(_) => {
|
Definition::TypeParam(_) | Definition::SelfType(_) => {
|
||||||
// FIXME: Hover for generic param
|
// FIXME: Hover for generic param
|
||||||
None
|
None
|
||||||
|
@ -279,6 +279,47 @@ mod tests {
|
||||||
assert_eq!(trim_markup_opt(hover.info.first()), Some("u32"));
|
assert_eq!(trim_markup_opt(hover.info.first()), Some("u32"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn hover_shows_long_type_of_an_expression() {
|
||||||
|
check_hover_result(
|
||||||
|
r#"
|
||||||
|
//- /main.rs
|
||||||
|
struct Scan<A, B, C> {
|
||||||
|
a: A,
|
||||||
|
b: B,
|
||||||
|
c: C,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct FakeIter<I> {
|
||||||
|
inner: I,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct OtherStruct<T> {
|
||||||
|
i: T,
|
||||||
|
}
|
||||||
|
|
||||||
|
enum FakeOption<T> {
|
||||||
|
Some(T),
|
||||||
|
None,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn scan<A, B, C>(a: A, b: B, c: C) -> FakeIter<Scan<OtherStruct<A>, B, C>> {
|
||||||
|
FakeIter { inner: Scan { a, b, c } }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let num: i32 = 55;
|
||||||
|
let closure = |memo: &mut u32, value: &u32, _another: &mut u32| -> FakeOption<u32> {
|
||||||
|
FakeOption::Some(*memo + value)
|
||||||
|
};
|
||||||
|
let number = 5u32;
|
||||||
|
let mut iter<|> = scan(OtherStruct { i: num }, closure, number);
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
&["FakeIter<Scan<OtherStruct<OtherStruct<i32>>, |&mut u32, &u32, &mut u32| -> FakeOption<u32>, u32>>"],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn hover_shows_fn_signature() {
|
fn hover_shows_fn_signature() {
|
||||||
// Single file with result
|
// Single file with result
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue