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.

About Andrey Cheptsov

Andrey Cheptsov is IntelliJ IDEA product marketing manager at JetBrains. He's passionate about productivity, programming languages and tools.
This entry was posted in EAP Releases and tagged , , . Bookmark the permalink.

4 Responses to New in 11.1: JavaScript.next syntax support

  1. Jim Cook says:

    Dont forget about us JS developers writing server side code for the Rhino platform. All the features of JS 1.8 and many from 1.9.

  2. Stephen Friedrich says:

    > Chromium project recently announced that implements some … features.
    > Firefox’s JavaScript engine already contains many

    See, that’s the problem: What I really, really would like to have is a way to select multiple browsers and versions, for example IE >= 8, FF >= 3, Chromium >= 14 and use that as the basis for language level checking.

    No browser is perfect in its support for a specific language version, and for fear of accidentally using a feature that some specific version of a supported browser does not implement, I usually stick to the most basic language features.

  3. Maxim Mossienko says:

    @Stephen For execution Harmony sources are translated into traditional JavaScript, this can happen via run time or compile time.

  4. Konstantin Ulitin says:

    @Jim What do you mean by JavaScript 1.9? I think setting version to 1.8.5 will perfectly suit your situation – it contains all contemporary mozilla-specific features, and implements ECMAScript 5.1.

    Thanks for report!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">