mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-24 05:33:41 +00:00
Merge #6234
6234: Fix hover over field pattern shorthand r=matklad a=Vlad-Shcherbina Instead of the information about the field, it now shows the information about the local. Fixes #6146 Co-authored-by: Vlad Shcherbina <vlad.shcherbina@gmail.com>
This commit is contained in:
commit
8090799aa2
@ -108,7 +108,7 @@ pub(crate) fn hover(
|
|||||||
let definition = match_ast! {
|
let definition = match_ast! {
|
||||||
match node {
|
match node {
|
||||||
ast::NameRef(name_ref) => classify_name_ref(&sema, &name_ref).map(|d| d.definition(sema.db)),
|
ast::NameRef(name_ref) => classify_name_ref(&sema, &name_ref).map(|d| d.definition(sema.db)),
|
||||||
ast::Name(name) => classify_name(&sema, &name).map(|d| d.definition(sema.db)),
|
ast::Name(name) => classify_name(&sema, &name).and_then(|d| d.into_definition(sema.db)),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -3232,4 +3232,27 @@ fn main() { let foo_test = name_with_dashes::wrapper::Thing::new<|>(); }
|
|||||||
"#]],
|
"#]],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn hover_field_pat_shorthand_ref_match_ergonomics() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
struct S {
|
||||||
|
f: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let s = S { f: 0 };
|
||||||
|
let S { f<|> } = &s;
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
*f*
|
||||||
|
|
||||||
|
```rust
|
||||||
|
&i32
|
||||||
|
```
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user