-
Notifications
You must be signed in to change notification settings - Fork 30
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
C/C++ preprocessor if in enum #299
Comments
The simple fix of adding @jeff-hykin is there a reason that preprocessor statements try to find there Edit: one feature that would be lost is that the grammar treats #if 0
This is a comment
#endif as a multi line comment |
Legacy support is the only reason the preprocessor conditionals are treated as ranges. we can add a special pattern to find the #if 0 range and treat it as a comment. I think the shared pattern idea would work well. Everytime the :ever_present_context is included it could be replaced with a function call that generates a new preprocessor if range that includes the parent context. We'd basically have to create an extra pattern range for every existing range but I don't think that would be an issue. the only problem I'd be concerned about is if a start pattern is triggered inside of the if statement
The if statement should probably use a However, with an if-then-else statement at least one of the cases should be allowed to overflow since one of them is required. Given that textmate has no idea if it is and if or if-then-else statement, the first one should probably always be closed, and then the else statement should be left open. This doesn't seem too difficult and I think it would result in near perfect highlighting. I might try implementing it tonight. |
Sounds good 👍 |
The initial fix was posted with I'm somewhat concerned that the near-perfect solution will indirectly break a lot of code because of the external/upstream problems with I'm leaving tomorrow and won't have access to my computer until July 23rd. So I didn't want to push anything potentially breaking right before leaving. I will still be able to approve merges on my phone, but I won't have a good way to publish the syntax. |
From @pfaltynek-als in microsoft/vscode#77046
The scopes of the
#if
and#endif
in the enum are not correct:The text was updated successfully, but these errors were encountered: