-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Colorize async
as keyword in some cases
#60558
Colorize async
as keyword in some cases
#60558
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about this classifying async
as keyword in cases where it doesn't.
src/Workspaces/CSharp/Portable/Classification/SyntaxClassification/NameSyntaxClassifier.cs
Outdated
Show resolved
Hide resolved
@Youssef1313 I classify it as a keyword only if there is no type with |
|
src/Workspaces/CSharp/Portable/Classification/SyntaxClassification/NameSyntaxClassifier.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/CSharp/Portable/Classification/SyntaxClassification/NameSyntaxClassifier.cs
Outdated
Show resolved
Hide resolved
If we colorize |
@sharwell Consider this piece of code: |
src/Workspaces/CSharp/Portable/Classification/SyntaxClassification/NameSyntaxClassifier.cs
Outdated
Show resolved
Hide resolved
If it doesn't bind as a symbol it is either the 'async' keyword, or it's an error case. In each case colorizing as a keyword is fine. |
I gave an opposite example above: |
It's code in error, i have no problem with code in error having some behavior that might be confusing to one person but not to another. For example, in reality it's much more likely that hte user intended to add Think about it this way. In literally 99.999% of these cases, it's going to be the keyword. So we have our code fallover to that in an error condition. For nearly all users that will be ok. The only user that will have an issue is hte 1 in a million user who actually defines a type called 'async'. From the IDE perspective, we do not cater to that user. They are already doing something well outside the norm and the behavior (in error conditions) should not consider their needs over the needs of everyone else who is doing things the normal way. |
@CyrusNajmabadi I have already implemented logic, that covers all currently known incomplete member cases. I think, your advice could be perfectly fine, if I knew it before touching the code. But should I reimplement it now, when all known cases are handled and tested, really? It doesn't seem to have any performance impact or somthing like this. It seems for me to be a downgrade. When I tried to do this on compiler layer, you said, that it is a breaking change and a lot of possible risks. Now you are telling me, that IDE can ignore users, for whome this could be a breaking change just because there are vanishingly few of those. |
Sure. I recommend in the future potentially running ideas past us to ensure that we're all in alignment on what to do.
You don't have to reimplement. I'm willing to do it for you.
Yes. Fundamentally, i would not be ok with a policy of: the code was written in a non-ideal way, but let's take it. We should code as per the designs and principles we have, and keep the codebase clean wrt to that. I do think this is painful since you've done the work, so i'm happy to take my time to revise the PR to get things there so you don't have to do that yourself. In the future though, we can likely avoid such back/forth with some up front discussions on the topic :)
I don't believe it's a downgrade. As i said, for 99.999% of users it's the better behavior.
Yes. That's the compiler. It has entirely different compat/maintainability concerns. The IDE follows entirely different rules and beliefs here precisely because we are not beholden to things like this with stuff like keyword classification.
Yes. And that's the normal case for us. We have limited resources and we invest in the 99.99% case so we deliver more value to the majority of the ecosystem versus expending extra effort for outliers. We think of this as the right investment of our resources. |
@DoctorKrolic are you ok with me pushing to your branch? |
Also, if you're available, i'd love to chat on discord. You can reach me at discord.gg/csharp, using the alias "Metasyntactic". Thanks! |
Yes, it's absolutely fine |
Working on this now. |
Just interesting: what is |
Thanks! |
It's where a lot of feature work has been done for the 17.3 release. I'd prefer your work go in there and not in the main branch so we don't have conflicts to deal when we merge main-vs-deps into main. |
Fixes: #60339