WebStorm 2017.3 EAP, 173.3188: better code completion and docs for JavaScript, new refactoring

This week the new WebStorm 2017.3 EAP build (173.3188.31) brings improved code completion and documentation for JavaScript and DOM APIs, a new refactoring for JavaScript and TypeScript classes, and improvements in webpack support.

You can update via Toolbox App, or download the build here and install it side by side with your stable WebStorm version.


Download WebStorm 2017.3 EAP

To learn more about the new features added in earlier WebStorm 2017.3 EAP builds, please see these blog posts.

Improved code completion and documentation for JavaScript and DOM APIs

WebStorm now uses the TypeScript definition files to power its code completion for standard JavaScript objects and methods. These files are now packaged inside WebStorm and we are going to regularly update them.

Previously we used and maintained our own definition files. Thanks to the transition to the new definition files, WebStorm now provides code completion for Web APIs that were previously unsupported.

Another good news is that the new definition files have documentation for many methods (which you can see if you press F1). If the documentation if not available there, WebStorm will fetch and show the summary from the corresponding MDN article.

mdn-docs

From the documentation popup, you can quickly jump to the full documentation on MDN by clicking the arrow icon. Or you can go directly to it from the code by pressing Shift-F1. Continue reading

Posted in Early Access Preview | Tagged , , , , | 2 Comments

WebStorm 2017.3 EAP, 173.2941: watch mode with Jest and Mocha

Please welcome the new EAP build of WebStorm 2017.3 (173.2941.6).

To get it, update via Toolbox App, or download it here and install side by side with your stable WebStorm version.


Download WebStorm 2017.3 EAP

You can learn more about the new features added earlier in the WebStorm 2017.3 EAP builds in these blog posts.

Improved integration with Jest

Good news for everyone who is using Jest for testing! We’ve been working on improving integration with Jest in WebStorm, and now it works seamlessly with Jest’s watch mode. That means that you will now get super-fast test results from Jest on changes in the WebStorm test tool window.

All you have to do is to add --watch flag to the options field in the Jest run configuration in WebStorm. If you want to always start tests (including single tests you can run from the editor) in the watch more, add --watch to the default Jest configuration (for that open the Edit configurations… dialog, select and edit Jest under the Defaults list on the left).

jest-watch

In addition to that, WebStorm can now work with Jest configuration files written in JavaScript.

And Mocha

In the same way, WebStorm now allows you to add --watch option to the Mocha run configuration to run it using Mocha’s own watch mode.

Notable Changes

  • Better performance when using Flow with enabled navigation.
  • JavaScript debugger doesn’t require JetBrains IDE Support extension now for all new debug configurations. More details on that are coming in the next blog post. Please note that if you’re using Live Edit, you will still need the browser extension.
  • Support for tagged template literals language injection. This can be useful if you’re working with some CSS-in-JS libraries like CSJS. You can learn how to configure it in this comment.
  • Better support for import() syntax in JavaScript and TypeScript
  • React className is now autocompleted without {} or “”. Type an opening brace or quote, depending on what you need in this particular case, and the closing one will be added automatically.

You can find a list of addressed issues in the Release notes.

Please share your feedback and report issues on our tracker. Thank you!

WebStorm Team

Posted in Early Access Preview | Tagged , , , | 6 Comments

Debugging Node.js apps in WebStorm

WebStorm makes it easier to debug Node.js apps. You can put breakpoints right in your source code (no more debugger and console.log() statements!), which can be written in JavaScript or TypeScript.

You can do many things that will help you explore the code and understand where the bug is. In the debugging tool window, you can see the call stack and the variables in their current state, evaluate expressions in the editor, and step through the code. And you can start debugging your app very quickly. Here’s how.

We’ll use a simple Express app as an example.

We need to do two things: first create a new Node.js run/debug configuration that will start the app, and then put a breakpoint.

  • To create a configuration, go to the Run menu and select Edit configurations… Click the + icon and select Node.js configuration type.
  • Now specify the path to the main file of the application that starts it. For the Express app it’s bin/www
  • Save the configuration. Put the breakpoints in your code. Now press Ctrl-D on macOS or Shift+F9 on Windows & Linux to debug the app (or click the green bug-like icon).

debug-local

Now if you do the actions that trigger the code where the breakpoint is, the app will pause on the breakpoint. Explore the call stack and the variables in the debugging tool window, hover over the expressions in the editor to see their current state, step through the code, or put new breakpoints to help you debug further. Continue reading

Posted in Tutorials | Tagged , | 18 Comments

WebStorm 2017.3 EAP, 173.2463: multiple JavaScript versions in project, ESLint improvements

Please welcome the second EAP build of WebStorm 2017.3 (173.2463.22).

To get it, update via Toolbox App, or download it here and install side by side with your stable WebStorm version.


Download WebStorm 2017.3 EAP

We started the WebStorm 2017.3 Early Access Program last week. If you’ve missed the announcement, check out this blog post.

Here are the new features you can try in this week’s EAP build (173.2463.22).

Advanced import of ESLint code style rules

Previously, in WebStorm 2017.2, you could only import code style rules that were explicitly written in ESLint JSON configuration files.

Now, it’s also possible to apply rules from more complex configuration files written in JavaScript and YAML, as well as from configurations that use extends. To do so, use the action Apply ESLint code style rules, which is available in the context menu of the config file.

eslint-apply

WebStorm will send a special command to ESLint asking for a full summary of the applied rules in JSON. It will then parse the output and apply the rules to the IDE settings. You will see the list of applied rules in the IDE log.

eslint-log

Please note that this action requires ESLint to be installed in your project. It also means that the import won’t happen automatically, as it happens for the .eslintrc JSON configs.

New Emmet syntax for JSX

Now you can generate JSX tags with Emmet that will have text inside the tag or value in curly braces.

div{Title} will expand into the tag with the content Title, and div{{title}} will expand into the tag with title in the curly braces.

emmet-in-jsx

By the way, the tag{} syntax can also be very useful in HTML and other template files. Continue reading

Posted in Early Access Preview | Tagged , , | 11 Comments

WebStorm 2017.3 Early Access Preview: new and improved refactorings, better Vue.js support, new REST Client

Today we’re starting the Early Access Program for WebStorm 2017.3, the big update that will be released the end of November 2017.

Toolbox App is the easiest way to get the EAP builds. You can also subscribe to the EAP updates option in the IDE (Preferences | Appearance & Behavior | System Settings | Updates) and get notifications when a new build is available.


Download WebStorm 2017.3 EAP

If you’re not yet familiar with our Early Access Programs, here are some details:

  • Every week we publish a fresh build for the upcoming version of WebStorm.
  • EAP builds provide access to the newest features we’re currently developing.
  • EAP builds are free but expire 30 days after they’re built.
  • You can install an EAP build side-by-side with a stable WebStorm version.
  • We welcome your feedback in our issue tracker, youtrack.jetbrains.com/issues/WEB. Please don’t forget to mention the build number you’re using.

Important: WebStorm EAP builds are not fully tested and may be unstable.

WebStorm 2017.3 is going to bring many significant updates. Here are the highlights of what you can already try in this week’s EAP build (173.2290.2):

New and updated refactorings

Extract type alias in TypeScript

The new Extract type alias refactoring allows you to create an alias for a complex type.

Put the cursor on the type and call the Refactor this popup (Ctrl-T on macOS / Ctrl-Alt-Shift-T on Windows & Linux). Then select Extract Type Alias from the list and name the alias.

extract-type-alias

And if the type is used multiple times, the IDE will spot this and suggest automatically replacing all the instances with the new name. Continue reading

Posted in Early Access Preview | Tagged , , , | 5 Comments

WebStorm 2017.2.4 is now available

WebStorm 2017.2.4 is now available!

You can download WebStorm 2017.2.4 (172.4155.35) on our website or update in Toolbox App or in the IDE. The patch-update is available for WebStorm 2017.2.2, 2017.2.3 and 2017.2.4 EAP.

What is fixed in WebStorm 2017.2.4:

  • Support for the Optional catch binding ES proposal (WEB-28073)
  • Support for React 16 RC (WEB-28328)
  • Go to definition for the AngularJS injected dependencies now works again (WEB-28192)
  • Running tasks with Yarn 1.0 from the IDE (WEB-28685)

WebStorm Team

Posted in Release Announcements | Tagged | 2 Comments

WebStorm 2017.2.3 is now available

WebStorm 2017.2.3 is now available!

You can download WebStorm 2017.2.3 (172.3968.27) on our website or update in Toolbox App or in the IDE. The patch-update is available for WebStorm 2017.2.1, 2017.2.2 and 2017.2.3 EAP.

What is fixed in WebStorm 2017.2.3:

  • Wrong position of the context menu on the HiDPI screens on Windows (JRE-453)
  • Navigate to class or file popup doesn’t suddenly disappear anymore on Linux (IDEA-173000)
  • Auto compilation now works again with TypeScript 2.5+ (WEB-28374)
  • Support for webpack aliases when using webpack.babel.config.js (WEB-28162)
  • All React attributes are now auto completed with {} by default (WEB-27989)
    and a new intention that wraps value with {} was added (WEB-21351)
  • Create method quick-fix now works inside JSX (WEB-18052)
  • Error when inspecting arrays in Karma tests (WEB-27884)
  • Debugging React Native apps with Node.js 8.4+ (with node as a debugging backend)(WEB-27303)
  • and over 20 other issues.

WebStorm Team

Posted in Release Announcements | Tagged | 11 Comments

Developing Ionic apps in WebStorm

Ionic is a framework for developing mobile apps in TypeScript. Since Ionic uses Angular, WebStorm can be of a great help when working on your next Ionic application.

Let’s go through the Ionic tutorial in WebStorm. But first, make sure that you’ve installed Cordova and Ionic and configured your environment for iOS or Android development as described here.

ionic-emulate
Continue reading

Posted in Tutorials | Tagged , , , | 13 Comments

WebStorm 2017.2.2 is now available

WebStorm 2017.2.2 is now available for download on our website and in Toolbox App.

What is fixed in WebStorm 2017.2.2:

  • Support for imports with ~ in SCSS and Less when using webpack (WEB-23707 and
    WEB-25321)
  • Support for CSS Modules with Less and Sass (WEB-27344 and
    WEB-27547)
  • Emmet abbreviations for React components now expand into self-closing tags only if you add / at the end of the abbreviation  (WEB-26468)
  • Completion for React component properties when using require (WEB-27896)
  • spy-js now works with Node.js 7 and above (WEB-24103)
  • Scaling on HiDPI monitors on Windows 10 (JRE-431)
  • and over 40 other issues.

WebStorm Team

Posted in Release Announcements | Tagged | 24 Comments

How to configure code completion in full-stack JavaScript projects?

If you’re working on a full-stack JavaScript application in WebStorm, you’ve probably noticed that code completion suggests some Node.js APIs in your client-side code and DOM APIs in the Node.js code. Here’s how to fix that.

What is Library in WebStorm?

All the objects defined in your application are automatically added to the WebStorm completion suggestions, but for adding Node.js and DOM APIs as well as symbols from the project’s dependencies to the code completion WebStorm uses a mechanism called External JavaScript Libraries or just Libraries.

You can see a list of Libraries configured for your project in Preferences | Languages & Frameworks | JavaScript | Libraries.

For every library, you can configure the scope where it works in the project. And that’s exactly what we need!

Configuring HTML and Node.js Core Libraries

The library called HTML contains all DOM APIs and by default is enabled for the whole project (hence the checked icon under Enabled). And so is the Node.js Core library with Node.js APIs (we enabled it before in Preferences | Languages & Frameworks | JavaScript | Node.js and npm).

html-node-libs

Uncheck HTML and Node.js Core libraries to disable them completely for now.

Now click on the Manage Scopes… button to start the configuration. Click + and select the folders with the client-side code – now select HTML library from the drop-down list next to them.

Click + again, select the folders or files with the server-side code and enable Node.js Core library for them.

manage-lib-scope

So now items from the HTML and Node.js Core libraries are resolved and shown in the code completion only in files in these specific project folders.

In the same way, we can configure the scope of the library that is automatically created for the node_modules folder.

For specific files, we can quickly manage the libraries with the Use JavaScript Libraries action in the file context menu in the editor. For example, we can enable Node.js Core library for our webpack configuration files.

enable-lib-for-file

By the way, the IDE inspections can be configured in a similar way using scopes in Preferences | Editor | Inspections.

WebStorm Team

Posted in Tutorials | Tagged | 7 Comments