Set default syntax highlight (JS / Babel ES6)

Hi there!

After ~2 hours of researching I still haven’t figured out how to set a specific syntax highlight for a file-ending.

I work with JS and use ES6 syntax / React. I don’t want all my files to rename to .jsx or something similar to have “Babel ES6 JavaScript” syntax-highlighting per default. Instead I want this SH for every .js file as default and not “JavaScript”.

Maybe someone has a hint for me how to achieve this?


Here’s the part of the documentation that covers custom language recognition.

I already did that but it didn’t work:

      "source.js": [

I also tried “languagebabel”.
The SH is delivered by

It was set as default once but switched back to .js -> JavaScript higlighting after an atom update

Try saving a file as test.language-babel, and you’ll see that it does work.

In the example above, is the language’s scope name (see Finding a Language’s Scope Name for more information) and foo is the file extension to match without the period.

What you actually want to write is this:

      "source.js.jsx": [
1 Like

AH! I’ve understood the doc totaly wrong. Thank you, that worked! :slight_smile: