Hard to exclude node_modules from scope


I created a scope to include just the test folder of my project. Using the Scopes window, I pointed to the test folder and said Include Recursively.  The scope regex became:


Looks good, but when I do a search with that scope, it includes files from my node_modules folder.  And, presumably because node_modules is excluded in Settings | Directoriesnode_modules does not appear in the tree so that can select it and say Exclude Recursively.  The only way to do it is to manually add this to the regex:


Why make this so difficult?  Why isn't node_modules just automatically excluded?





1 comment
Comment actions Permalink

node_modules are only partially excluded - direct dependencies listed in package.json are added to JavaScript libraries and thus included.

Excluding libraries from custom scope is a bit tricky... To make it work, you need to prefix your scope pattern with file[your_project_name]:*/&& to overwrite the default scope - see https://youtrack.jetbrains.com/issue/IDEA-145142#comment=27-1156171 for explanation

Related feature request: https://youtrack.jetbrains.com/issue/IDEA-103560, please feel free to vote


Please sign in to leave a comment.