Skip to content

Include import prefixes on hover types when available #60107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
FMorschel opened this issue Feb 11, 2025 · 3 comments
Open

Include import prefixes on hover types when available #60107

FMorschel opened this issue Feb 11, 2025 · 3 comments
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-hover Issues related to hovers devexp-server Issues related to some aspect of the analysis server P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@FMorschel
Copy link
Contributor

Inspired by #33695, #56935 and #56350, I'm requesting that types on hovers, when applicable, should display the import prefix/alias to help differentiate.

image


When multiple aliases are available for one declaration:

  • If we can infer from the expression being hovered, use that
  • Use first

WDYT @srawlins, @bwilkerson?

@srawlins
Copy link
Member

I like it.

@srawlins srawlins added P3 A lower priority bug or feature request devexp-server Issues related to some aspect of the analysis server type-enhancement A request for a change that isn't a bug labels Feb 18, 2025
@bwilkerson
Copy link
Member

When do we think it would be possible to infer an import prefix? Obviously in an expression where there's a prefix, but when else?

If it's too inconsistent / unpredictable it might be confusing. I'd also like to have some understanding of how hard it would be to implement / maintain.

@FMorschel
Copy link
Contributor Author

When do we think it would be possible to infer an import prefix? Obviously in an expression where there's a prefix, but when else?
[...] I'd also like to have some understanding of how hard it would be to implement / maintain.

Since we already have the information on the library that defines the type, my guess (and I've looked arround once or twice at that code) is that the code handling this uses the element/fragment so looking at namespaces would be easy enough, I believe, for both implementing and maintaining.

If it's too inconsistent / unpredictable it might be confusing.

I would not expect that to happen, I don't have any numbers but my guess is that rarely users have more than one library that exposes the same things, and even more so, with different aliases. And in those cases, the expression would probably have a hint as to which import prefix should be used if we wanted to try and tackle that, but it might not be necessary.

@bwilkerson bwilkerson added area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. and removed legacy-area-analyzer Use area-devexp instead. labels Feb 21, 2025
@DanTup DanTup added the devexp-hover Issues related to hovers label Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-hover Issues related to hovers devexp-server Issues related to some aspect of the analysis server P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants