-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Hovers for import prefixes should show valid Dart code for the import #57020
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
Comments
The question then becomes, which imports to show. I'll repeat the comment I made on Discord (which assumes that we'll only display imports that have the prefix being hovered over:
When I said "in it's namespace" it might not have been clear what I meant. I meant that we could consider including only those imports from which the name being referenced through the prefix can be imported. I might misunderstand the purpose of the hover, but I assumed it was to help identify which import was being referenced in that case. If not, then my comments aren't relevant. |
As I wrote there as well:
I see your point in limiting it, I just don't think it would be as consistent because you can either hover the prefix on a declaration like a class or a function, but you could also hover it by itself or at the import line. I'd rather show all prefixed imports everywhere so that people are aware of what the actual prefix fully means. I would not expect real code to have multiple imports using the same prefix to be a really common thing but when they appear, I'd like to show the user that this is being done so that they are aware every time this might be causing some confusion.
Although I see some truth in this, it might not be the only reason why this hover would be relevant. I think for what you are talking about here, three other issues would fit this category better (I think in this specific order of relevance but the first and second don't have that much priority over one another): |
Here is the CL https://dart-review.googlesource.com/c/sdk/+/393382 |
#32735 improved the hovers for import prefixes, but the new text is in a field that usually contains valid Dart code and LSP wraps in triple backticks. This results in syntax highlighting being applied to English text:
To maintain consistency, rather than removing the backticks we should update the element descriptions for import prefixes to be the valid Dart code that adds the relevant imports instead.
(cc @FMorschel)
The text was updated successfully, but these errors were encountered: