How to make JS code intelligence work for Node.js projects but exclude all the other `node_modules` files?

When developing a  Node.js application, including everything from

complicates matters with things like "Navigate to file" (I don't want the IDE to offer me tens of
s from
folder, for example). But excluding the
folder entirely has its own problems - there is no code completion etc.

So what's the "right" way to approach this in WebStorm? There aren't specific file include / exclude patterns, are they? Or should I use the concept of project or global libraries somehow?

Thanks for any hints.

Hi! Sorry I don't have a solution, in fact I have a very similar problem, and came in here to post a similar question.

I'd also like to know how to retain code introspection (i.e. code completion) in 3rd party JS source files, but stop WebStorm linting and inspecting the files etc.


Hi Borek,

I see. No, unfortunatelly there is no easy "right" way. You can exclude all node_modules directorories that are located inside top level node_modules directory.
It will make completion better but not ideal.
Can I ask you to create an issue in the and attach there archived example of a problem.


Hi Jed,

Why do you need code completion inside 3rd party source files?
This files are intended to be readonly aren't them?
Yes, linting and inspection running is unnecessary step here.


Thanks Sergey for confirming this. I have already created a couple of related issues like:

so hopefully that will be resolved in WebStorm v6.



Sorry maybe I wasn't clear ... I want WebStorm to introspect the 3rd party source files so I can code completion *from* them. In other words I want to get code completion and code hints based on the 3rd party source files, but I don't want them to be inspected or linted or highlighted with errors. How do you stop linting/inspecting on a per file or directory basis, but retain the ability to code complete *from* those files?


There is a way, but it is quite inconvenient to setup:

  1. Create custom scope (Settings | Scopes) to include (or exclude) only those files
  2. Settings | Inspections -- find inspection you are insterested in (or do this for whole branch), right click and chose "Add Scope"
  3. Now you can turn on/off inspection for that scope + whatever is outside that scope

Ah, OK. I was sort of hoping there'd be an easier way! Thanks though.

I did find another way ... click on the icon of the little man with a hat in the lower right and set highlighting level to "none". This seems to work on a per file basis at least. I'm not sure if its still hitting the CPU to do the inspections and just not highlighting though ...


Yes, this also should work (have not used it myself, ever) -- but you have to do this for every file individually. It's OK if the number of files are not big, but if you have few hundreds of them ...


Agreed. WebStorm is quite lacking in its support for 3rd party libraries at the moment. I know it has concepts of "scopes", "libaries", "inspections" etc. but they are poorly documented and confusingly implemented in the IDE settings. Ideally you should be able to simply define a local project folder as containing 3rd party library code and immediately exclude it from *any* inspections or linting, but of course retain the ability to code complete from it. I'm surprised this isn't a feature TBH, seems pretty basic.


Please sign in to leave a comment.