How do I exclude a directory in a Scope that is already excluded in the Project?

I want to create a scope that excludes certain directories such as `node_modules` and some others. But when I try to use the scope `node_modules` is included in the search results, and there is no way to exclude it. 

It seems that scope setup does not show folders that it will itself include in use, but are excluded in a different context. This seems very odd. Is there a workaround?




1 comment

You must have faced the issue because node_modules are only partially excluded - direct dependencies listed in package.json are added to JavaScript libraries and thus included.

To exclude node_modules completely, use In Project scope for searching. JavaScript libraries are only included when using Directory scope with corresponding folder selected, or when using custom scope with explicit filters. Note that 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 for explanation

Related feature request: IDEA-103560


Please sign in to leave a comment.