mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-19 11:35:16 +00:00
Show variance of parameters on hover
This commit is contained in:
parent
60e28c6bd9
commit
bb921fbe94
5 changed files with 69 additions and 12 deletions
|
|
@ -594,12 +594,21 @@ pub(super) fn definition(
|
|||
_ => None,
|
||||
};
|
||||
|
||||
let variance_info = || match def {
|
||||
Definition::GenericParam(it) => it.variance(db).as_ref().map(ToString::to_string),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
let mut extra = String::new();
|
||||
if hovered_definition {
|
||||
if let Some(notable_traits) = render_notable_trait(db, notable_traits, edition) {
|
||||
extra.push_str("\n___\n");
|
||||
extra.push_str(¬able_traits);
|
||||
}
|
||||
if let Some(variance_info) = variance_info() {
|
||||
extra.push_str("\n___\n");
|
||||
extra.push_str(&variance_info);
|
||||
}
|
||||
if let Some(layout_info) = layout_info() {
|
||||
extra.push_str("\n___\n");
|
||||
extra.push_str(&layout_info);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue