How to exclude files from a project in PhpStorm by model?


I'm using PhpStorm 10.0.1. I want to exclude files in directories that match a pattern. I want this exclusion to remove the excluded files from the set of files that PhpStorm uses when - for example - finding duplicate definitions of classes.

I've gotten part of the way through the solution, which involves Scopes:

  • Open a project in PhpStorm
  • Go to Settings (File -> Settings)
  • Navigate to Appearance & Behavior -> Scopes
  • Create a scope to exclude the appropriate file(s).
    • Click the + icon
    • Select either Local or Shared
    • Give the scope a name
    • Enter an appropriate pattern
      • For example, to exclude files in directories that match *-b0*, enter !file:*-b0*/*
    • Click Exclude Recursively
    • Verify in the tree view that the appropriate file(s) are excluded.
    • Click OK.

This is where I'm stuck. I can't find any reference anywhere in the UI to that named scope - except in the settings dialog where I created it.

The documentation is no help:

How do I apply that scope to the current project?

(It may be the case that scopes are applied automatically. In that case, the Scopes dialog and the rest of PhpStorm disagree on what is included and what excluded and I'll need to file a bug.)

Scopes can be used in Project tool window - click the Project popup in upper left corner and choose the desired scope. They can only be used for search filtering (in Edit/Find/Find in path dialog), in Inspections profiles, file watchers, etc.

But note that choosing your scope in Project window is just a view option, files excluded from scope are NOT excluded from project - they will still be indexed, used in completion/navigation, etc. If you like to exclude certain files/folders completely, so that they are not included in file index, you need adding them to 'Ignore files and folders' in Settings | Editor | File Types. Folders can also be excluded using Mark directory as/Excluded