NodeJS Autocomplete In IDEA and WebStorm

The Story

Today we had a discussion in NodeJS UA community chat. The discussion was around the topic "Why don't we have the hinting in those IDEs for NodeJS?".

It would be really great to have a code completion like this:
http completion

We have poked around the idea to add JSDoc types annotations but it turns out not working as we wish.

I remember the special JSDoc annotation files for jQuery I used a couple years ago, but they are not very usable.

After spending some time wondering, I have found the workaround for IntelliJ IDEA and other JetBrains tools (Webstorm, PHPStorm)!

The Recipe

We will use typescript community stubs to make the magic!

JetBrains IDEs are clever enough to unite Javascript and TypeScript. Thanks, JetBrains!

The steps you need to accomplish:

  1. Go to Preferences - Javascript - Libraries in your IDE.
    Silvrback blog image
  2. Click the Download button and select TypeScript community stubs
    Silvrback blog image
  3. Locate the node entry and hit Download and Install button!
    Silvrback blog image
  4. Verify that library is installed and enabled and has the Global scope.
    Silvrback blog image
  5. And now, at last, you can enjoy hacking NodeJS with type hints and autocompletion!
    Silvrback blog image Silvrback blog image

Have fun!