简体   繁体   中英

How to make Eclipse neon format Javascript with ES6 class definition

I try to work with eclipse Neon and JavaScript sadly JSDT seems to be broken in a few ways. I like to use the new ES6 classes like:

class MyClass {
  constructor(name) {
    this.name = name;
  }

  //...

  static getClassName () {
    return 'MyClass'
  }

With this, I get a more or less working outline. What doesn't work anymore is the code formatter. The code just doesn't get formatted.

Is there anything to do to make eclipse format such code?

If not an alternative would be another coding style without class . But I haven't found one where formatting and outline work both. Do you know in which version formatting and outline work?

Eclipse's support for ecmascript is poor. You can try ternjs

http://ternjs.net/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM