-
Notifications
You must be signed in to change notification settings - Fork 48
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
typenames in casts are not syntax highlighted #114
Comments
Thanks for the report! I can definitely reproduce this, and don't I think writing a test-case for it will be too hard. From what I can tell If we're going to support this, we need to be able to do this on a mostly regexp-based basis, as we have no intelligence about what is actually types and what is not in our code. My first take at a pseudo-regexp for catching cases like this would be:
As far as I can see, that won't catch all valid syntaxes... For instance the following cases would not have the cast highlighted correctly: var res = (MyType)(a.b().c());
var nested = (MyType)(((SubType)foo).SubTypeMethod()) But looking at those generic examples, with generic names, that just looks like terrible code which nobody should be encouraged to write anyway :) Is everyone OK with not supporting cases like that? Or would anyone object to it? Or maybe even better: can someone come up with a more sophisticated regexp which correctly handles more complex cases without messing up "regular" grouping of variables? cc: @wasamasa |
|
I'm not sure I follow. Are you referring to use of the |
No, I'm referring to the redefinition of |
This one should be fixed in the rework branch. |
Tested and works for me. |
I wasn't quick enough to test it out. ;-) @josteink thanks for testing it, I'll trust that it works. Great job, everyone and nice to see you again a few years later. |
how to test:
M-x csharp-mode
)(MyType)
castexpected:
(MyType) should be syntax highlighted as a type name
actual:
(MyType) is not syntax highlighted as a type name
The text was updated successfully, but these errors were encountered: