Early Access Program

New in 11.1: JavaScript.next syntax support

This is a cross-post from WebStorm & PhpStorm blog, originally posted by Konstantin Ulitin.

As you may know, there are different versions of the JavaScript language. Each JavaScript engine implementation adds some nice features that others don’t have. To make sure that you only use features suitable for targeted environments, choose the appropriate one in Settings | Javascript.

JavaScript Language version setting

When you use language feature that isn’t supported by the currently selected JavaScript version, IntelliJ IDEA will notify you and suggest a Quick-Fix:

QuickFix suggestion

For those who prefer to stay one step ahead, IDE presents experimental support of a new ongoing ECMAScript version code-named Harmony. New language features are poorly supported natively by browsers [1], but there are third-party tools for translating new syntax constructs into their JavaScript equivalents.

We take Traceur compiler as a basis. The full list of supported features can be found on its wiki.

To try out new features, set ECMAScript Harmony to be the JavaScript language version in settings. There are two ways to use new language features with your web project. One is to compile ecmascript harmony files before deployment. Another is to provide link on your html page to javascript sources of Traceur compiler, so that ecmascript harmony files are translated to JavaScript on each request. Instructions and an example can be found here.

To help you with the new syntax, we’ve added the possibility to preview files compiled with Traceur. Simply right-click in the editor and select Compile ES6 file with Traceur:

Traceur compiled preview

Download IntelliJ IDEA 11.1 EAP. We’d also love to get your feedback in the issue tracker ;)

Chromium project recently announced that implements some ECMAScript Harmony features. Firefox’s JavaScript engine already contains many of them and some more.

Discover more