public static @Nullable SearchScope findScopeByName(@NotNull Project project, @NotNull String scopeName) {
    // can't use ScopeChooserUtils.findScopeByName() because it returns intersection scopes that can't be presented the user
    // and doesn't return all predefined scopes
    final List<? extends SearchScope> predefinedScopes =
      PredefinedSearchScopeProvider.getInstance().getPredefinedScopes(project, null, true, false, true, true, true);
    for (SearchScope predefinedScope : predefinedScopes) {
      if (predefinedScope.getDisplayName().equals(scopeName)) {
        return predefinedScope;
      }
    }

    for (FindInProjectExtension extension : FindInProjectExtension.EP_NAME.getExtensionList()) {
      for (NamedScope scope : extension.getFilteredNamedScopes(project)) {
        if (scope.getScopeId().equals(scopeName)) {
          return GlobalSearchScopesCore.filterScope(project, scope);
        }
      }
    }

    for (NamedScopesHolder holder: NamedScopesHolder.getAllNamedScopeHolders(project)) {
      for (NamedScope scope: holder.getEditableScopes()) {
        if (scope.getScopeId().equals(scopeName)) {
          return GlobalSearchScopesCore.filterScope(project, scope);
        }
      }
    }
    return null;
  }
public static @Nullable SearchScope findScopeByName(@NotNull Project project, @NotNull String scopeName)