-
Notifications
You must be signed in to change notification settings - Fork 154
Undefined words are highlighted as keywords #308
Undefined words are highlighted as keywords #308
Comments
Just to clarify, we're highlighting it as a type, not a keyword. If you use that syntax, One concrete example is that you can do this: #ifdef WIN32
#define MyLibraryInteger __int32
#else
#define MyLibraryInteger int32_t
#endif
unsigned MyLibraryInteger MY_LIBRARY_VERSION; In that case, |
Ok, it shouldn't highlight the word unless its a defined type. The problem is this makes it harder to identify that the user typed an invalid type word if any word is highlighted as a type. The example I gave was a real mistake I had made; it would have been easier to spot if the grammar wasn't automatically highlighting the following word. |
It sounds like you want built-in types (like The reason that this "works" with VSCode and GitHub.com is that those syntax highlighters can only ever recognize built-in types, so user-defined types are generally not highlighted at all. |
Yes, that sounds good. Thanks, |
Workaround: uncheck "Use Tree Sitter Parsers" Between this and atom/language-todo#82, I'm going to avoid Tree Sitter for the time being. |
Hey @wesinator, thanks for raising this issue and providing good examples. The poor error recovery you're seeing in C is a symptom of a missing Tree-sitter feature. I've opened a PR to add that feature (tree-sitter/tree-sitter#246) and in the coming weeks I'll be updating our C parser to make use of it, eliminating this issue. |
Edit by @rsese: from Max in #308 (comment):
Prerequisites
Description
Steps to Reproduce
Consider the following code:
Expected behavior: 'integer' is not highlighted, as it is not a valid keyword
Words following preceding keyword are only highlighted if they are also actual keywords.
Github and VS Code C highlighting does this correctly.
Actual behavior: any word following a preceding keyword is highlighted as a keyword, even if it is not valid
Reproduces how often: Always
Versions
0.60.13
atom 1.32.2
The text was updated successfully, but these errors were encountered: