Javascript Eclipse 中有没有办法更改 ECMAScript 合规性级别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31624174/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 06:55:46  来源:igfitidea点击:

Is there a way in Eclipse to change the ECMAScript compliance level?

javascripteclipseecmascript-6ecmascript-5

提问by Sebastian Zartner

In Eclipse 4.5 (Mars) with installed JavaScript Development Tools (JSDT), the default compliance level for ECMAScript is set to ECMAScript 3, which is already very outdated. And the related drop down list to change the compliance level is deactivated, so it's not possible to change the option. Is there a way to change those settings to a newer standard like ECMAScript 5or ECMAScript 2015?

在安装了JavaScript 开发工具 (JSDT) 的Eclipse 4.5 (Mars) 中,ECMAScript 的默认合规性级别设置为ECMAScript 3,这已经非常过时了。并且用于更改合规性级别的相关下拉列表已停用,因此无法更改该选项。有没有办法将这些设置更改为更新的标准,例如ECMAScript 5ECMAScript 2015

JavaScript validator preferences not allowing to change ECMAScript compliance level

JavaScript 验证器首选项不允许更改 ECMAScript 合规性级别

采纳答案by Jabberwock

There is no way to use a newer compliance level directly in JSDT, but with a plugin called tern-javayou can use ES5or ES2015(named before ES6).

没有办法直接在 JSDT 中使用更新的合规性级别,但是tern-java可以使用名为ES5or ES2015(之前命名为ES6)的插件。

I added this plugin via the installation of angular-eclipse. You can find this plugin on Eclipse Marketplace.

我通过安装 angular-eclipse 添加了这个插件。您可以在 Eclipse Marketplace 上找到此插件。

回答by Sebastian Zartner

Eclipse 4.6 (Neon) added support for ECMAScript 2015 syntax and removed the ECMAScript compliance leveloption from the Preferencesdialog.

Eclipse 4.6 (Neon) 添加了对 ECMAScript 2015 语法的支持,并从首选项对话框中删除了ECMAScript 合规级别选项。