Hard to exclude node_modules from scope

Hey,

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:

file[site]:test//*

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:

file[site]:test//*&&!file[site]:node_modules//*

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

Thanks,

Eric

 

 

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

0

Please sign in to leave a comment.