-
Notifications
You must be signed in to change notification settings - Fork 235
Syntax inconsistencies using tree-sitter #558
Comments
Thank you for testing out tree-sitter 🙇♂️ @maxbrunsfeld Here is some great early feedback on tree-sitter and the differences to the old textmate grammar 👀 |
Thanks for the feedback @mmcbride1007!
Yeah, this was something I intentionally ditched because I want to avoid as much as possible having a given entity appear in different colors in different places. It's not feasible for us to track which variables are
Yeah, in general I've gotten rid of special highlighting for globals that are defined in specific environments (e.g. node.js). Things like
These were not intentional! I will fix them shortly.
I agree, we should really highlight ☝️ That's a lotta red. I would want to highlight |
Thanks for the response! Totally makes sense with the decisions for consistency on those items. re: Not sure if that's too hacky, but it seemed to work pretty consistently in my experience. Could be a starting point for a discussion. |
Another difference is that the tree-sitter grammar currently supports highlighting JSX by default, while this previously has been rejected for this repository. I can see the arguments in favour of doing so, but it must also be noted that the inclusion of one unofficial extension to the language sets a precedence for adding more of them, should another framework rise to equally great prominence in the future. |
Other than |
@50Wliu That 'object' highlighting never really made sense to me. For one thing it didn't actually correctly identify objects (as opposed to other data types like numbers, strings or arrays). It also caused entities to appear in different colors in different places. For example:
At no point is |
Good point, I've never thought about it like that. Something still seems "missing" to me though, I guess I'll think about it some more. |
Alright, we've addressed most of the inconsistencies. #587 adds distinct highlighting for There are certain differences with the TextMate grammar that we currently don't plan to address:
|
Prerequisites
Description
When enabling the experimental
tree-sitter
parsing system, there are some inconsistencies in the syntax highlighting.Steps to Reproduce
Expected behavior: For the most part, I would expect consistency in the syntax highlighting.
Actual behavior: There are quite a few inconsistencies between the old and new.
Reproduces how often: 100%
Versions
Atom version: 1.25.0-beta0
APM version: 1.19.0
OS: macOS Sierra 10.12.6
Additional Information
Here's a screenshot, with the old on the left and the new on the right:
My apologies if this is actually expected behavior - I do realize that tree-sitter aims to generate a more accurate syntax tree and that would inevitably cause some highlighting differences. Some of these things do seem to provide extra consistency, but I'm unsure if others are intended behavior or missing features. More specifically, I am curious about the following:
const
declarations are no longer highlighted. This one seems like it's probably an improvement in consistency sincelet
andvar
are not highlighted orange.module
keyword is no longer highlighted=
sign is no longer highlighted (missing thesyntax--assignment
class in the markup that enables this)require
is highlighted a different color. This one I could also see being an improvement, as function names in this color scheme are also blue, but withrequire
being a special case, I wasn't sure.=>
arrow function symbol is no longer highlightedthis
keyword is no longer highlightedAny insight on the above mentioned items is much appreciated. I am still familiarizing myself with tree-sitter, so my apologies if this is all intentional behavior. I also realize this is an experimental feature, and I am running on the Beta version, so there may be bugs. If this is indeed an issue and I can be of any assistance in troubleshooting, let me know, I'd be happy to help!
The text was updated successfully, but these errors were encountered: