mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Make goto definition/hover resolve constructors
This commit is contained in:
parent
dc8bcc1e42
commit
49da9a3e81
3 changed files with 87 additions and 7 deletions
|
@ -512,4 +512,26 @@ mod tests {
|
|||
let hover = analysis.hover(position).unwrap().unwrap();
|
||||
assert_eq!(trim_markup_opt(hover.info.first()), Some("Thing"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_infer_associated_method_exact() {
|
||||
let (analysis, position) = single_file_with_position(
|
||||
"
|
||||
struct Thing { x: u32 }
|
||||
|
||||
impl Thing {
|
||||
fn new() -> Thing {
|
||||
Thing { x: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let foo_test = Thing::new<|>();
|
||||
}
|
||||
",
|
||||
);
|
||||
let hover = analysis.hover(position).unwrap().unwrap();
|
||||
assert_eq!(hover.info.first(), Some("```rust\nfn new() -> Thing\n```"));
|
||||
assert_eq!(hover.info.is_exact(), true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue