gandm / language-babel

ES2017, flow, React JSX and GraphQL grammar and transpilation for ATOM
https://atom.io/packages/language-babel
MIT License
476 stars 83 forks source link

Nullish coalescing operator (stage-1 proposal) treated as ternary, breaks highlighting #495

Closed MiracleBlue closed 6 years ago

MiracleBlue commented 6 years ago

Howdy!

I've been making heavy use of some recent early-stage ES proposals, such as Nullish Coalescing. Currently, language-babel is treating the operator as 2 ternaries, and as such, highlighting in the rest of a function block after this operator is a bit broken.

Example: screen shot 2018-04-29 at 9 18 31 am

The first two functions in that screenshot use the nullish coalescing operator, and the closing brackets and parenthesise don't seem to be tokenized anymore (evidenced by the absence of highlighting and absence of scope classes in the inspector for those pieces)

From inspecting the scopes applied to the operator, each ? is wrapped with these scopes: keyword operator ternary js

Atom: 1.26.1 language-babel: 2.84.0 OS: macOS 10.13.4

xixixao commented 6 years ago

Came here to post the same 👍

MiracleBlue commented 6 years ago

WOW that was fast. Thanks so much @gandm for your efforts!