You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inlay hints should display inferred type argument #4366
Is your feature request related to a problem? Please describe.
It's hard to navigate to inferred type of generics. You have to lookup relevant argument and find type from it.
For now it's only possible to see inferred type from hover popup, but it's just plain text.
Describe the solution you'd like
Inlay hints should show clickable inferred types of generics.
Describe alternatives you've considered
Make hovers interactive? (But that's likely out of scope).
The change is in the Dart analysis server in the SDK, so once the review is done and the code landed, it'll be available in main channel builds of the SDK usually within a few hours or so (and Flutter's master branch probably within a few days). I wouldn't recommend using those versions for production work but they're good for testing. Of course the change will also then show up in future dev/beta/stable releases of the SDKs.
@Zekfad Oof, yes, I hadn't noticed that (and apparently I didn't write tests when there are both type args and parameter names at the same offset). I will fix, thanks!
Activity
DanTup commentedon Jan 28, 2023
Do you mean in cases like this?
Zekfad commentedon Jan 28, 2023
Hi @DanTup, thanks for fast reply, yes, that's what I meant.
DanTup commentedon Feb 21, 2023
I've a change open to add this for type arguments and also list/map/set literals where it was missing before.
https://dart-review.googlesource.com/c/sdk/+/284143
Zekfad commentedon Feb 21, 2023
Hi @DanTup, thank you for your work!
Is there ETA for Preview version with this feature?
On your screenshot, it infers
<int>a: [1,2], shouldn't it bea: <int>[1,2]?DanTup commentedon Feb 21, 2023
The change is in the Dart analysis server in the SDK, so once the review is done and the code landed, it'll be available in main channel builds of the SDK usually within a few hours or so (and Flutter's
masterbranch probably within a few days). I wouldn't recommend using those versions for production work but they're good for testing. Of course the change will also then show up in future dev/beta/stable releases of the SDKs.[analysis_server] Include Type inlay hints for inferred type argument…
DanTup commentedon Feb 21, 2023
Landed in dart-lang/sdk@e8a8e10.
Zekfad commentedon Feb 21, 2023
Hi @DanTup, on your screenshot, it infers
<int>a: [1,2], shouldn't it bea: <int>[1,2]?DanTup commentedon Feb 21, 2023
@Zekfad Oof, yes, I hadn't noticed that (and apparently I didn't write tests when there are both type args and parameter names at the same offset). I will fix, thanks!
DanTup commentedon Feb 22, 2023
Got a fix open at https://dart-review.googlesource.com/c/sdk/+/284641.
DanTup commentedon Feb 22, 2023
Fix landed in dart-lang/sdk@658e34e.