Coder Perfect

Remove a folder from the search results but not from the project list.

Problem

I’m working on a few distinct projects that all share the same core.

To avoid searching through them (basic search, shift + cmd + n, etc. ), I simply need to set all non-current projects as excluded.

To put it another way, I’d like to get search results from both the core and current projects.

Is there a method to close some projects but keep them available in the project list so that they may be reopened as easily as they were closed? Or perhaps you’ve had a different experience?

Asked by Vitalii Petrychuk

Solution #1

Use Scopes Settings/Preferences > Appearance & Behavior > Scopes to apply custom search to Find in Path or Replace in Path. I recommend reorganizing your directories such that there are no extraneous files in the project directory. You can also add extra folders to the Source Root by heading to Settings > Project Settings > Directories.

Answered by Justinas

Solution #2

This is the most effective method for removing directories from your search results. I’m working on a large Magento project that has a lot of directories that I don’t want to show up in search results. This was the solution to my problem. If your project contains a /vendor directory, PHPStorm will index it faster because it is ignored.

To access the following options, right-click on any folder.

Answered by TheRealJAG

Solution #3

This may be found under Settings > Appearance & Behavior > Scopes in version 2016.3.

Alternatively, go to Settings and type “scopes” into the search box at the top, regardless of the version.

Then, to add the scope, click the + symbol, choose the folder you want to exclude, and then click Exclude Recursively and apply.

Then, when you search with CTRL+SHIFT+F, pick Custom under Options > Scope and select the scope you just made (thanks commenters).

Answered by Andrew

Solution #4

You might create a custom scope and bother yourself every time you use Find in Path (and similar) by selecting that custom scope because PhpStorm does not utilise that custom scope by default.

In any case, excluding the node modules directory disables autocompletion and other code aid features. That’s something you don’t want to do.

However, I discovered a solution that does not require node modules directory exclusion or a custom scope:

JetBrains’ inclusion of dependent storage directories like node modules for JavaScript/TypeScript and vendor for PHP by default strikes me as amateurish. There’s almost no reason to include those directories in find & replace, let alone refactoring functionality.

Answered by RoestVrijStaal

Post is based on https://stackoverflow.com/questions/16559203/exclude-folder-from-search-but-not-from-the-project-list