-
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
Repeated scopes and incorrect macro scope #350
Comments
This also exists in the stable branch. I don't want to cause you to have to scramble to get a fix. I'll roll back this time, and we can use the stable branch for the next release. |
This section does not close its ranges.
Scope of line below this block:
|
created Problem 1Ah I see one of several problems happening here.
This means the while pattern might not be viable, which would destroy a lot of the theoretical near-perfect macro behavior :/ Problem 2
This problem will likely be present since function definition was added (many updates ago). It would also get fixed by the bailout pattern. @alexr00 The only guaranteed full fix for this will probably be the bailout pattern, which is going to be a complex fix, so a rollback would've likely been needed anyways. Summary of changes to be made (this will get edited/updated)
|
If non-preprocessor stuff closes on a lookahead for |
Yeah, the bailout should work. We'll have to switch from |
I think part of the issue is that the behavior of while is underspecified. It looks like vscode-textmate tests while patterns going up the stack rather than down the stack. This results in the outer pattern closing itself and any nested patterns at the first |
I think I have a solution to this, hopefully also provides correct near-perfect syntax highlighting. The only time that you can be sure that there is not another alternate highlighting is with So Caveats:
|
It sounds like there is still discussion on what needs to be done. VS Code is in endgame this week so I'll change the version we use to be the version we last shipped with. |
Sorry things have been going slower on my end, school is picking back up for me. @alexr00 pushed a solid fix for problem #2 just now, and I basically reverted the code for problem #1. Its okay if this change doesn't make it into VS Code though, this is a complex fix. The downside to this solution is that it adds an entire duplicate grammar. There's no performance implications as far as I can tell, and the user shouldn't ever notice the difference (other than the lack of bugs), the only reason I mention it is because it means the ~19,000 line grammar has effectively become ~40,000 lines. There are still discussions to be had, but its very likely this is the only foolproof fix due to the limitations of TextMate. LaTeX is going to need its own copy of the C++ grammar for effectively the same fundamental reason. @matter123, I used the npm |
In particular, https://github.com/microsoft/vscode/blob/master/extensions/cpp/package.json needs to be modified to contribute the grammar, |
Good call @matter123 I forgot that needs to be a manual change on the VS Code end. |
Sample file
testh.txt
Checkout the
{
on line 564. It is incorrectly scoped as a macro, and has duplicate scopes.Scopes:
The text was updated successfully, but these errors were encountered: