Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I exclude node_modules wherever this path occurs in find in path searches in IntelliJ

I created a scope that has !file[myproj]:/node_modules// and also tried !file[myproj]://node_modules// to not include any subdirectories that is under node_modules i.e. not include any files in any of these :

  • /node_modules/*
  • a/node_modules/*
  • b/c/node_modules/*
  • e/f/g/node_modules/*
  • anything/preceding/the/folder/node_modules/*

but the search still shows matches in the node_module files. What is the correct pattern to use?

like image 747
claya Avatar asked Oct 17 '22 23:10

claya


1 Answers

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 https://youtrack.jetbrains.com/issue/IDEA-145142#comment=27-1156171 for explanation

Related feature request: IDEA-103560

like image 140
lena Avatar answered Oct 20 '22 23:10

lena