mooz / js2-mode

Improved JavaScript editing mode for GNU Emacs
GNU General Public License v3.0
1.33k stars 186 forks source link

es7 binding operator doesn't work #427

Open shevchuk opened 7 years ago

shevchuk commented 7 years ago

There is a new bind syntax introduced in ES7:

// Binding a function to a context
let log = ::console.log;

Which currently generates error:

line 2: syntax error
line 2: missing ; before statement
fxfactorial commented 7 years ago

that isn't JS though, its a babel plugin and hopefully never becomes real JS.

carlosyslas commented 7 years ago

I agree it should not be supported officially by js2-mode but some of us have to deal with already existing code that uses that syntax. Is there any easy hack for at least prevent the syntax highlighting to get broken?

dgutov commented 7 years ago

I don't know how we'd do that. The parser here is not made to be especially forgiving.

gomain commented 4 years ago

This (and other @babel features) will become a no-go for adopting js2-mode. There needs to be a mechanism in altering how the parser works.

dgutov commented 4 years ago

If somebody wants to try their hand at adding an extensibility framework, please be my guest.

Otherwise, js-mode is still an option when you have to work with more complex syntaxes, though it's not as feature-rich.

shevchuk commented 4 years ago

not fully related to this topic but still worth to mention, the js2-mode is also not working if flow types are used in the file. So I think all these may have a common solution with this extensibility framework that Dmitry mentioned