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
Missing contextual information when hovering over extension type declarations #5005
The issue is basically the "primary constructor" of an extension type, which has a small "codeRange". My change expands this to be the whole declaration (so it works the same as for an implied unnamed constructor on a class).
Activity
incendial commentedon Feb 24, 2024
Also noticed that for cmd + hover extension types have a bit confusing constructor (without the extension type name)

It gets a bit worse for named constructors

When classes, for example, have the name

Is it by design or you'd want this to be fixed?
incendial commentedon Feb 24, 2024
The example above is not for declaration, but for instantiation:
incendial commentedon Feb 24, 2024
And if the extension type is const, this info is not displayed (but for a class it's there):
[analyzer] Add element display string for extension types
DanTup commentedon Feb 28, 2024
Fixed by dart-lang/sdk@8a62f4a, but ships in an SDK release.
DanTup commentedon Feb 28, 2024
Oops, I missed some of the extra things noted above, I need to check if the fix covered them too.
DanTup commentedon Feb 28, 2024
@incendial do you have a complete code sample to trigger the bad preview on the named constructor of an extension type?
I can reproduce the issue for unnamed constructors:
And I understand the cause of this (which seems specific to the default constructor), however I can't reproduce for named constructors:
incendial commentedon Feb 28, 2024
DanTup commentedon Feb 28, 2024
Perfect - thanks! I didn't realise we could put the name there like that 😄
incendial commentedon Feb 28, 2024
It can also be const
DanTup commentedon Feb 28, 2024
With my new fix, that shows up too:
The issue is basically the "primary constructor" of an extension type, which has a small "codeRange". My change expands this to be the whole declaration (so it works the same as for an implied unnamed constructor on a class).
[analysis_server] Improve the target range for extension type primary…
DanTup commentedon Apr 18, 2024
Fixe dby dart-lang/sdk@c22f054. The change is in the Dart SDK so will ship in a future SDK release (rather than a Dart-Code release).