没有类型属性的 Intellij IDEA 和 WebStorm 中的内联 ES6 脚本

Inline ES6 Scripts in Intellij IDEA and WebStorm without type attribute

有没有办法让 IntelliJ IDEA 在内联 <script>...</script> 标签中支持 ECMAScript-6 语法而不指定 <script type="text/ecmascript-6">,较新的 Chrome 浏览器不支持它。

箭头函数尤其烦人,因为它弄乱了缩进并阻止了自动缩进。

我在最近的 polymer 项目中大量使用它,我绝对希望它是内联脚本,即使它在构建时被分离。

此问题与that question密切相关。

试了一下
WebStorm 2016.1.3
Build #WS-145.1616, built on May 27, 2016

IntelliJ IDEA 2016.1
Build #IU-145.258, built on March 17, 2016

针对此行为的临时解决方案,但不是针对 IDEA / WebStorm 中问题的完整解决方案是使用 <script type="text/ecmascript-6"> 标记并通过 crisper 将其过滤掉,这是默认构建过程的一部分在很多聚合物项目中。为此,有必要在 inlineScriptFinder() 方法 add

中向 crisper/index.js 添加一行
pred.hasAttrValue('type', 'text/ecmascript-6')

这仅在 dev-build 和 dist-build 在其构建管道中使用 crisper 时才有效。

我想有一个没有解决办法的解决方案。

更新 我刚刚看到,它已经存在于最新版本的 crisper 中(参见 commit

WEB-16444 已在 WebStorm 2016.2

中修复