Searching in custom scope is very slow

PhpStorm 7

I have a php project with many directories. There are two directories (vendor and node_modules) which I want to exclude from search. I created a custom scope including all dirs except the dirs starting with vendor and node_module, so as a result, it says my scope contains 208 of total 45030 files.

But searching this scope takes very long. I think it somehow re-creates the index of those files every time. On the other hand, if I search manually in every directory (other than the two), the results are immediate. Is it possible to define a scope so that searching scope files is reasonably quick (like searching in 208 files)?

2 comments
Comment actions Permalink

Hi,

Have tried to reproduce, but it works OK for me with the following scope pattern:
file[project_directory]:*/&&!file[project_directory]:directory_to_exclude1//*&&!file[project_directory]:directory_to_exclude2//*

May I ask how exactly you manage those exclusions?

0
Comment actions Permalink

I first created the scope by clicking and shift-clicking (to mark a range of subdirs) in the tree visible in Scope dialog. As a result, the file pattern contained 88 matches (because the tree displays all sub-sub-... dirs). That's far from optimal. By the way, it was even much worse when I tried to explicitly exclude the two ranges of subdirs (because they contain thousands of nested subdirs).

So, the tree is useless for my purpose. But following your example, I deleted these useless scopes and created a scope like this (manually typing the scope pattern instead of choosing from the tree):

!file:node_modules//*&&!file:vendor//* (you can add file:*|| or file:*/|| to it but they appear all the same)

This still doesn't work as expected. In the dialog it says the scope contains 178 files, that's ok. It searches inside my project where it should search, but unfortunately, it also searches in things like xampp/php/pear/* , which are outside of my project (pear is inside External Libraries, which are below my project in the project explorer). This adds to search time and makes the result less readible.

By the way, if you "Find in Path" and then choose "Whole project" or "Directory" as scope, it doesn't search in pear.

So, how to make a pattern to search only inside my project files and except the two directories?

0

Please sign in to leave a comment.