-
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
Inheritance access specifier not colorized at linebreak #14
Comments
Just for reference (for other people) fixing this issue also would fix the issue posted here atom/language-c#245 I've got bad news though :/ TextMate grammars have basically two ways of matching things
The caveat is, the Regex match for TextMate cannot match newlines. (This is something inherently limiting about the TextMate implementation.) If something contains newlines, say a class definition:
then you're supposed to use a Range. Right now the range start is basically Now, their might be a clever way to get a make-shift solution and get around this which I'll try to work on, but the root problem is that the syntax highlighting is inherently limited. This is something a Tree Sitter would fix and this issue should additionally be logged on the VS Code repo. Ideas for a hacky solution:
|
Thanks for the response! Perhaps waiting for tree sitter is the right way to go. It seems like it may appear in VS code in the future. I'll report the issue there as well, which may speed up the process. |
Good news. I've been refactoring the code the last few days and I discovered a way to do it. It turns out the legacy code is not actually using a range, they're instead just using a very long normal pattern matcher for only the beginning of the class. It is still going to take a bit to implement the fix, but at least it's possible. 👍 |
I published a fix this with version |
incorporates: atom/language-c#252 Note that this particular change was modified. `class public virtual : public virtual Example` is invalid I think, but I don't see a good way to prevent that because the detection must be moved into `patterns > include` because textmate is not multiline regex. See also jeff-hykin/better-cpp-syntax#14 (In fact that whole repostory probably has some improvements) I changed it to include the angle brackets because types can have those atom/language-c#263 atom/language-c#311 atom/language-c#368 For tree-sitter, kinda fix the Discord reported issue (In #support M1 Mac C++ Syntax highlighting) Note that I syntax color only the last function name and not the namespace or colon. But that could easily be changed. For future me, the relevant tree-sitter namespace identifier scopes are: `call_expression > qualified_identifier > identifier` and `function_declarator > qualified_identifier > identifier` I don't know anything about template functions so I left that untouched. So this is probably an incomplete fix. Finally, add the `static_assert` operator. It's technically a directive so it'll appear purple, not blue. Again this could easily be changed so don't hesitate about feedback, idk anything about c++
Describe the bug
To Reproduce
Expected behavior
The 'public' keyword should be colorized regardless if there is a linebreak or not.
Screenshots
Additional context
This issue exists with default VS code highlighting as well.
The text was updated successfully, but these errors were encountered: