简体   繁体   English

如何使用ES6类定义制作Eclipse霓虹灯格式的Javascript

[英]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. 我尝试使用Eclipse Neon和JavaScript进行操作,可悲的是JSDT似乎在某些方面被破坏了。 I like to use the new ES6 classes like: 我喜欢使用新的ES6类,例如:

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? 有什么办法可以使eclipse格式成为这样的代码?

If not an alternative would be another coding style without class . 如果不是这样,那就是没有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. Eclipse对ecmascript的支持很差。 You can try ternjs 你可以尝试ternjs

http://ternjs.net/ http://ternjs.net/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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