@ApiStatus.Internal
  @SuppressWarnings("unchecked")
  public static @Nullable Iterator<VirtualFile> extractSingleFileOrEmpty(@Nullable GlobalSearchScope scope) {
    if (scope == null) return null;

    VirtualFileEnumeration enumeration = VirtualFileEnumeration.extract(scope);
    Iterable<VirtualFile> scopeAsFileIterable = enumeration != null ? enumeration.getFilesIfCollection() :
                                                scope instanceof Iterable<?> ? (Iterable<VirtualFile>)scope :
                                                null;
    if (scopeAsFileIterable == null) return null;

    VirtualFile result = null;
    boolean isFirst = true;

    for (VirtualFile file : scopeAsFileIterable) {
      if (!isFirst) return null;
      result = file;
      isFirst = false;
    }

    return isFirst ? Collections.emptyIterator() :
           result instanceof VirtualFileWithId ? ObjectIterators.singleton(result) :
           null;
  }
@ApiStatus.Internal
  @SuppressWarnings("unchecked")
  public static @Nullable Iterator<VirtualFile> extractSingleFileOrEmpty(@Nullable GlobalSearchScope scope)