Open hniksic opened 2 years ago
Note we do show the bounds when hovering the type parameter itself.
We can try experimenting with some changes to how hover messages for locals look by rendering a where clause if we have type parameters in the type of the local maybe.
Note we do show the bounds when hovering the type parameter itself.
I'm aware of that, but thanks for pointing it out - maybe I should have mentioned it in the description. The issue with that is that the type parameter is defined elsewhere, and I have to locate it and get back to where I was.
Here is another example:
fn foo1<I: Iterator<Item = u32>>(iter: I) {
// ... other code ...
for _ in iter {
}
}
fn foo2(iter: impl Iterator<Item = u32>) {
// ... other code ...
for _ in iter {
}
}
With foo2
hovering over iter
shows iter: impl Iterator<Item = u32>
, which gives me the info I need. With foo1
hovering over iter
only shows I
. I wish it showed something like impl Iterator<Item = u32> {I}
or something to that effect.
When I place the cursor over a variable defined with a generic type, I only get the name of the generic type, not its trait bounds (which is what I'm interested in, especially for types bounded by closure traits). For example, in a function defined like this:
I would expect hovering above
make_sessionizer
to tell me how I can call the function, e.g. something likeF: FnOnce(&Arc<Database>)
. What I actually get ismake_sessionizer: F
, which is technically correct, but not very useful on its own:I use Emacs with Rustic, but I believe the contents of the popup entirely comes from rust-analyzer. For example (taken on slightly different code, but showing the same thing):
Originally reported as brotzeit/rustic#311.