BeetleJuice
BeetleJuice

Reputation: 40936

Exclude folder from indexing in PhpStorm / WebStorm

Using PhpStorm 2017.3 to dev a node project; there are certain directories that I wish to exclude from indexing and auto-complete suggestions. I've seen elsewhere directions that I followed but still no dice. In the image below for example, the directory rxjs/add is one of them.

enter image description here

On the left side of the image, you can see that in the Project tree view, the directory is not excluded; I get auto-complete suggestions from its contents. However when I go to Settings > Directories, the same folder (see the right side of the image) is already listed as excluded. Not sure what to do. This is a node_modules/ directory for the rxjs 5.5 package.

The problem I'm actually trying to solve: this library has multiple functions with the same name from different files. So when I use a function and the IDE tries to automatically add the ES6 import statement, it shows me multiple options and every time I have to carefully read the file paths to select the correct import. Because the correct import always comes from the same two directories, I'd like to tell the IDE to stop looking into the others.

Upvotes: 9

Views: 9841

Answers (2)

Juanma Menendez
Juanma Menendez

Reputation: 20229

Open the IDE Settings > Directories -> Select the folders you want to exclude > click "Excluded" Button

enter image description here

Upvotes: 17

lena
lena

Reputation: 93868

WebStorm/PhpStorm auto-exclude node_modules folder from the project, but direct project dependencies listed in package.json are added to JavaScript libraries for completion/navigation and thus indexed. To exclude certain module, you can comment it out in the package.json; or, in File | Settings | Languages & Frameworks | JavaScript | Libraries, disable the <project_name>/node_modules library and create your own library (by pressing Add...) with only desired modules/files included

Upvotes: 6

Related Questions