@Override
    public @NotNull GlobalSearchScope uniteWith(@NotNull GlobalSearchScope scope) {
      if (equals(scope)) return this;
      if (scope instanceof DirectoryScope other) {
        if (containsScope(other)) return this;
        if (other.containsScope(this)) return other;
        return new DirectoriesScope(Objects.requireNonNull(getProject()),
                                    union(!myWithSubdirectories, myDirectory, !other.myWithSubdirectories, other.myDirectory),
                                    union(myWithSubdirectories, myDirectory, other.myWithSubdirectories, other.myDirectory));
      }
      return super.uniteWith(scope);
    }
@Override
    public @NotNull GlobalSearchScope uniteWith(@NotNull GlobalSearchScope scope)