mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Merge #10798
10798: ide: show go to for function hover return type r=Veykril a=jhgg I've found myself wanting this... adds to the hover quick go-to for a function's return type:  This is particularly useful when you are hovering over a function in a long chain, like: ```rust foo.bar().b$0az().some_trait_fn(); ``` where `baz`'s return type is not immediately obvious, but the chain is not long enough to trigger chain inlay hints... i guess I could just select `foo.bar().baz()` too to get the types too... Co-authored-by: Jake Heinz <jh@discordapp.com>
This commit is contained in:
commit
cfa26c3ac3
2 changed files with 32 additions and 28 deletions
|
@ -314,6 +314,7 @@ fn goto_type_action_for_def(db: &RootDatabase, def: Definition) -> Option<HoverA
|
||||||
Definition::Local(it) => it.ty(db),
|
Definition::Local(it) => it.ty(db),
|
||||||
Definition::GenericParam(hir::GenericParam::ConstParam(it)) => it.ty(db),
|
Definition::GenericParam(hir::GenericParam::ConstParam(it)) => it.ty(db),
|
||||||
Definition::Field(field) => field.ty(db),
|
Definition::Field(field) => field.ty(db),
|
||||||
|
Definition::Function(function) => function.ret_type(db),
|
||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1750,6 +1750,9 @@ fn foo_$0test() {}
|
||||||
cfg: None,
|
cfg: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
GoToType(
|
||||||
|
[],
|
||||||
|
),
|
||||||
]
|
]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue