-
Notifications
You must be signed in to change notification settings - Fork 83
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
Atom no longer defaulting to language-babel for .js files #510
Comments
This fixed for me, unchecking tree-sitter parsing in core settings (scroll near the end of the core settings page) |
Closing because the above fixes it for me |
That workaround isn't great - a) the package doesn't work properly with the new Atom default and b) I believe the point of tree-sitter parsers is for performance. Can we reopen? |
Another workaround is to add this to your config: "*":
core:
customFileTypes:
"source.js.jsx": [
"js"
] However, then other packages think the file is JSX too, so something like the Why is the scope for Babel ES6 JavaScript Grammar |
Thanks |
The main issue is not with the tree-sitter, but with language-typescript package. |
Did disabling |
It did it for me as well @Yurickh, I hope @maxbrunsfeld consider the comment I left in the issue, meanwhile there is a concensus of introducing a new flow grammar. |
Disabling |
Sorry to hear that @sinwailam193, in order to see what's going on in your case, could you tell us what grammar is selected? |
it selected |
It's for the same reason I wrote before @sinwailam193, instead of disabling both language-typescript and language-javascript, do what @zakini commented here and should set language-babel as default. (@Yurickh I reenabled language-typescript as setting that in config worked as well) |
yea, @zakini 's method worked for me, the only issue is that other plugins for some reason also think it is a jsx file. Thanks tho @mgtitimoli! |
I believe the reason behind all this is this one, but as I wrote there if anyone can give a hint about why language-javascript and language-typescript take precedence over language-babel that would be very appreciated. (np @sinwailam193, great that you were able to solve the issue on your side) |
The change is due to us enabling the new Tree-sitter parsing system by default. Sorry for the disruption, everyone. Just curious - why do folks want to use language-babel rather than the built-in parsers? Are there packages that aren't loading because they only work with the |
To me, EDIT: Also flow type annotations and graphql template strings. |
Thanks for jumping into this issue @maxbrunsfeld, language-babel IMO is currently the most complete grammar out there, it not only highlights correctly flow, but it also does the same for styled-components, graphql and obviously javascript, this is why I expressed my concern before, because a lot of people is using this setup. |
👍 I see, thanks. In case it matters to anyone, the built-in parsers now handle JSX and Flow. They do not yet handle graphql and styled components, although styled-component highlighting (via a CSS parser) is coming soon. For other folks who are wondering, I'm going to re-post a comment I made in response to your issue on the Tree-sitter repo: In the latest release of Atom, we've enabled our new parsing system by default, which means Atom will prefer to use the new parsers over the old TextMate grammars (which
"*":
core:
customFileTypes:
"source.js.jsx": [
"js"
] |
I edited the code snippet in my above comment ☝️ to fix an error. |
So new Atom is not going to be supported? I miss GraphQL syntax. |
Built-in styled-component highlighting has shipped in Atom 1.32.1. If you are interested, please give the built-in parsing system a try and report any issues you see with highlighting embedded CSS.
Yeah, we realize that GraphQL highlighting is very useful. We plan to eventually create a new-style Tree-sitter parser for GraphQL as well. Then, the built-in JavaScript and Flow parsing will support everything that |
Just chiming in here. I don't use styled components or GraphQL and I still see a marked difference in my React components with the built-in JavaScript parser compared to language-babel. Maybe I've just gotten used to the syntax highlighting with language-babel, but it feels like it "understands" my code much better. Notice the regex and the JSX attributes. Built in Parserlanguage-babel |
@dominic-p It looks like you're using 1.32.0; a few highlighting issues have been fixed in 1.32.1, which we published last night.
Overall, Atom is now parsing your code much, much more precisely than it ever did before. This is what allows us to provide the new syntax-aware selection feature (bound to Some of the changes are intentional: you should see that object properties (e.g. Other changes are not necessarily intentional. For example, it looks like we're using a different color for character classes in regexes than Thanks for chiming in with those screenshots! |
@maxbrunsfeld It would be great to have colored function parameters, currently they are white which kinda stands out from the rest and feels strange after using babel coloring. Same goes to variable declarations. |
Thanks for the detailed feedback @maxbrunsfeld I appreciate it. Most of my reaction is probably due to the fact that I have gotten so used to the I would echo @vladshcherbin on the white color. I understand from your previous comment that the change was intentional, but to me white kind of feels like the parser wasn't able to figure out what something was. Again, this is probably mostly personal preference. The only other comment I would make on the regex is that I see a lot more detail in the I probably should have posted all of this on the language-javascript repo you linked...sorry about that. |
I've been using Is this responsibility of the |
This and autocompleted tag closure is a time (and sanity) saver for me. It seems like these features could be separated from the syntax highlighting though? |
I have custom styles that highlighted all function names in a light green so they're easily noticeable. These are now broken for arrow functions and anonymous functions that are assigned to a variable, because variable names have no tag or style. They're just text nodes and so cannot be targeted with css. Is this something that could be fixed? If you're interested, my custom styles look like the below. The top one is for functions and the other for arrow functions. @function-color: lightgreen;
.syntax--storage.syntax--type.syntax--function + .syntax--entity.syntax--name.syntax--function {
color: @function-color;
}
.syntax--meta.syntax--function.syntax--arrow > .syntax--entity.syntax--name.syntax--function {
color: @function-color;
} |
There are three elements of the language-babel syntax highlighting in JS/JSX I like that the built in language-javascript doesn't do:
Compare the following. language-javascriptlanguage-babel |
Disabling Use Tree Sitter Parser only fixes the autocompletion of tags, but does not fix the commenting with {/* */}, this means I have to manually type that around my tags in order to render properly. Is there any known fixes for the commenting issue? I changed my theme and now the commenting works, I guess it's a theme styling issue as well?? |
I agree that the biggest reason for using language-babel were:
For now, I disabled the Tree Sitter parser, and seems to do the trick. Please lmk if I can be of any help in integrating this to the built-in parsers. |
@maxbrunsfeld curious if you think things like autocomplete and JSX commenting should be part of the language or a separate package, I can second (or third) these are the biggest things I miss using the built in grammar. |
Why not update language-babel to support tree-sitter? |
@whmountains I wouldn't even know where to start :( |
With the latest release of the atom beta 1.32.0-beta0 language-babel no longer auto detects for .js files and instead you have to manually select it as the language
The text was updated successfully, but these errors were encountered: