New in 4.0: JavaScript.next syntax support

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 an appropriate one in Settings | JavaScript.

JavaScript Language version setting

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

QuickFix suggestion

For those who prefer to stay one step ahead, WebStorm presents an 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 of using the new language features with your web project. One is to compile ECMAScript Harmony files before the deployment. Another is to provide a 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 a possibility to preview files compiled with Traceur. Simply right-click in the editor and select Compile ES6 file with Traceur:

Traceur compiled preview

Download PhpStorm & WebStorm 4.0 EAP. We’d also love to get your feedback in the issue tracker ;)

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

This blog is permanently closed.

For up-to-date information please follow to corresponding WebStorm blog or PhpStorm blog.

 
This entry was posted in Cool Feature, PhpStorm, WebStorm and tagged , , , , . Bookmark the permalink.

3 Responses to New in 4.0: JavaScript.next syntax support

  1. Zyava says:

    What about php version selector? You added javascript version selector to support not yet approved Harmony. But don’t wish to do the same for php 5.2/5.3. Why you dislike php so much?

Comments are closed.