WebStorm 2019.2 EAP #3: detect duplicate code, use Node.js version from .nvmrc

WebStorm 2019.2 Early Preview build #3 is now available!

If you’re unfamiliar with our Early Access Program or if you want to catch up on all the new features, check out the previous EAP blog posts.

The Toolbox App is the easiest way to get the EAP builds and keep both your stable WebStorm version and any EAP versions up to date. Or you can download the EAP builds from our website. You can also get notified right from the IDE when a new EAP build is available: go to Preferences | Appearance & Behavior | System Settings | Updates and select “Automatically check updates for Early Access Program”.

DOWNLOAD WEBSTORM 2019.2 EAP

Important! WebStorm EAP builds are not fully tested and might be unstable.

Here are some of the highlights of WebStorm 2019.2 EAP #3 (build 192.5118.44). For the full list of issues fixed in this update, see the Release Notes.

Searching for duplicate code

WebStorm 2019.2 adds a new inspection that allows you to find code duplicates in your project. Enabled by default, the inspection checks your code on the fly and immediately highlights potential duplicates in the editor. It works for JavaScript, TypeScript, CSS, Sass, SCSS, and Less.

Highlighted duplicate code in the editor

Select Show all duplicates like this in the inspection tooltip to see the potential duplicates and compare your code with them.

See duplicates with diff

If you want to scan the whole project for code duplicates, call up Run inspection by name using the Find Action popup (Cmd/Ctrl-Shift-A) and then select Duplicate code fragment to run the inspection.

The inspection has a few additional configuration options, which you can toggle in Preferences | Editor | Inspections – General – Duplicate code fragment. For example, you can disable the inspection for some languages, or increase/decrease the minimum size of code duplicates that you want the inspection to warn you about.

To prevent the inspection from finding duplicates in compiled code, we’ve limited it to processing only files of the same file type. This means the IDE will not warn you about code duplicates in .css and .scss files, for example. (We’ll do the same for .ts and .js files in the next EAP build).

If you have a folder with the compiled app, e.g. build or dist, we highly recommend that you exclude it from the project. To do so, right-click it in the Project view and then select Mark as excluded. Not only will this help avoid some false positive warnings from the Duplicate code inspection, but it will also speed up indexing and improve navigation in your project.

Improvements in Angular support

In Angular template files, WebStorm now shows parameter hints inside method calls.

Angular template parameter hints

You can fine-tune when the hints are shown – go to Preferences / Settings | Editor | General | Appearance – Show parameter name hints – Configure.

One more improvement is that now WebStorm provides code completion for Angular components, directives, and pipes defined in modules that are not direct dependencies of your project (e.g. it is added as a dependency of another library you use).

Use Node.js version from .nvmrc on macOS and Linux

nvm helps manage node versions. On macOS and Linux, it allows you to create .nvmrc files in your project where you can specify the node version that should be used with it (but the nvm implementation for Windows doesn’t support this feature).

Now, when you open a project with a .nvmrc file in the project root, WebStorm will automatically set the Node.js version in the IDE preferences (Languages & Frameworks | Node.js and npm) to the one specified in the .nvmrc file if it’s already available on your machine.

Please report any issues on our issue tracker. And stay tuned for the next week’s update!

WebStorm Team

About Ekaterina Prigara

Ekaterina Prigara is WebStorm product marketing manager at JetBrains. She's passionate about new technologies, UX and coffee.
This entry was posted in Early Access Preview and tagged , , , , . Bookmark the permalink.

2 Responses to WebStorm 2019.2 EAP #3: detect duplicate code, use Node.js version from .nvmrc

  1. Nazar Aziz says:

    WebStorm 2019.2 EAP #3 is looking REALLY good Ekatrina. I’ve been using it in anger for the last couple of days and some of my annoyances with 2019.1 are gone (i.e. editor cursor losing focus)

    Looking forward to the proper release and congratulations to the WebStorm team.

Leave a Reply to Ekaterina Prigara Cancel reply

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