-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Improve hovers for patterns #59966
Comments
Can the hover appear differently (the same as today probably) if this code changed to the following? Also, would that be something we want to do? if (instance case Class(myGetter: var myGetter)) { |
Yeah, in the case where the getter/variable are both explicitly written, I think their hovers should continue to be individual. I think only in the case where the same string in the source is doing double-duty (and therefore there's no way to hover the two of them separately) should there by some kind of "combined" tooltip.
Today I don't think we show any information/documentation about patterns, so I think we should still improve what's there for your last code sample (for example explaining what kind of pattern this is and - if appropriate - a link to more detailed docs). |
That sgtm. As per #59943 (comment), I do think it would be beneficial to decide what information we want to show, and if we do that in this issue (rather than in a CL) then more of the community has the opportunity to weigh in. |
What about if we just tag some additional information to the end of existing hovers in the case where they are part of a pattern? For example in: if (instance case Class(:var myGetter)) { Hovering over
I don't know if implementing "dynamic" messages like this for each kind of pattern would be simple, but I think it could be helpful when reading code if you're not familiar with patterns (sometimes I get confused by the patterns I have written myself 😄). I don't know what such text would look like for something like this though: if (json case {'user': [String name, int age]}) {
print('User $name is $age years old.');
} If I hover over |
I like the idea. For the last example, with type-literals we could replace:
For something like:
If we can infer the type literal in here it would be great. I think the closer type literal would be better than |
It would be great if hovering over patterns in the editors showed some documentation/explanation of the pattern (and maybe some links to the website).
Additionally, in code like:
The hover for
myField
doesn't show any information about themyGetter
member onClass
but it would be useful to (because there's no other code you can hover to get it), either directly in the tooltip (but clear thatmyGetter
here is also a variable declaration), or some clickable link to get to the definition ofClass.myGetter
. There's some additional discussion about this here: #59943The text was updated successfully, but these errors were encountered: