js2-mode icon indicating copy to clipboard operation
js2-mode copied to clipboard

es7 binding operator doesn't work

Open shevchuk opened this issue 8 years ago • 6 comments

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

shevchuk avatar May 18 '17 23:05 shevchuk

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

fxfactorial avatar Jul 23 '17 16:07 fxfactorial

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?

carlosyslas avatar Aug 18 '17 12:08 carlosyslas

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

dgutov avatar Aug 18 '17 13:08 dgutov

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.

gomain avatar Oct 09 '19 07:10 gomain

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.

dgutov avatar Oct 09 '19 08:10 dgutov

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

shevchuk avatar Oct 11 '19 13:10 shevchuk