Scratches folder appearing in Find in Files search when using custom Scope

If I use anything but the Scope tab, the file doesn't show when a word in it matches my search.

However, I've defined custom scopes to exclude things like Tests (which PHPStorm will not exclude in files search when the folder is marked as excluded), or a vendor folder (like in Laravel) which excluding as a directory will prevent click-tracing to Laravel functions etc, and then I have a custom scope for both (as in, I have Exclude Recursively in the scope for the folders).

Scratches files are not supposed to show in search at all, as they're not part of the Project files, but I'm not seeing an option when using a custom scope to exclude the Scratches folder.

 

1
4 comments

What IDE version are you running?

Please share the custom scope in question. You can share the Pattern string here.

Please also attach a screenshot of your Find in Files window when the issue occur.

Just tested this on 2020.3.1 and this did not reproduce. 

0

I'm using PHPStorm 2020.3.1.

Before you check my design pattern... have you tested this yourself, and what were the results? Did everything work as expected? Was it a Laravel project, or something else? I think the version doesn't matter.

The below design pattern is my custom scope named "Exclude Tests and Vendors" (to recursively exclude the `tests` and `vendor` folders):

!file[Project]:tests//*&&!file[Project]:vendor//*

To create this, from the Scopes box, I simply clicked on the `tests` and `vendor` folders then click Exclude Recursively.

They work to exclude the selected folders, but suddenly `node_modules` results show up... if I don't use a custom scope, the `node_modules` folder is excluded (which makes sense because I selected the folder in Project panel to be Directory > Excluded). If you notice in the screenshot, `node_modules` doesn't even show up in the list of selectable folders.

Something just appears to be wrong with PHPStorm's logic here; I need to often do file text searches while excluding all three of those folders, but sometimes I want to include one of them (hence why I have multiple scopes). I've never needed to search `node_modules` though because I don't do the front-end work, so it's just insult to injury to have them show up after configuring scopes (injury because PHPStorm ignores normal Directory Excluded for folders with Unit/Integration-selected folders).

This is really frustrating. Please explain or let me know what I'm supposed to do.

0

Thanks for sharing the pattern, reproduced this.

I've surely tested this, but not on a Laravel project. I've used inclusive patterns though, not exclusive, e.g. file:src//*.php.

 

> If you notice in the screenshot, `node_modules` doesn't even show up in the list of selectable folders.

That's because "Non-project files are not shown", as hinted on a screenshot. IDE considers excluded folders as "non-project".

I would suggest to create a scope by including required folders, not excluding those that aren't required:

 

I also find the fact that scratches are included in an !file[Project]: pattern to be an undesired behavior. Unfortunately I can't see any workarounds to exclude scratches from those types of scopes. There also seems to be no related bug reports on our tracker. 

You could submit this issue to it at https://youtrack.jetbrains.com/newIssue for developers to address.

0

It started ignoring node_modules properly... not sure why.

0

Please sign in to leave a comment.