yuezk / vim-js

💯The most accurate syntax highlighting plugin for JavaScript and Flow.js
MIT License
140 stars 8 forks source link

jsParensError with stage-3 "Class field declarations" #2

Closed davidsierradz closed 4 years ago

davidsierradz commented 4 years ago

Sorry if this is out of scope or maybe to soon to implement, for reference look: tc39/proposal-class-fields: Orthogonally-informed combination of public and private fields proposals, with a minimal init.vim:

call plug#begin('~/.config/nvim/plugged')
Plug 'yuezk/vim-js'
call plug#end()

And the following JavaScript file:

class Foo {
  foo = async x => {  
    try {
      console.log(x)   
      return x || {}
    } catch (e) {
      console.error(e)
    }
  }
}

There are some jsParensError syntax errors:

image

Just letting you know in case you want to check it, maybe we can wait until this gets in a official ES release, although currently is a wide supported feature:

Babel 7.0+ Node 12 Public fields are enabled by default in Chrome 72 / V8 7.2 Private fields are enabled by default in Chrome 74 / V8 7.4 Public instance fields are enabled by default in Firefox 69 Public static fields are enabled in Firefox Nightly 75 as of Febraury 22, 2020 Public instance fields are shipped behind a flag in Safari Technology Preview 101 Moddable XS QuickJS TypeScript 3.8

Thanks!

yuezk commented 4 years ago

@davidsierradz It seems to be a flaw caused by the anonymous async function. I have fixed it in the latest code and didn't break my test files. Let me know if you have any questions.