LocalSearchScope (@NotNull LocalSearchScope scope, FileType @NotNull ... fileTypes) { if (fileTypes.length == 0) throw new IllegalArgumentException("empty fileTypes"); if (scope == EMPTY) { return EMPTY; } return ReadAction.compute(() -> { PsiElement[] elements = scope.getScope(); List<PsiElement> result = new ArrayList<>(elements.length); for (PsiElement element : elements) { PsiFile containingFile = element.getContainingFile(); FileType fileType = containingFile.getFileType(); if (ArrayUtil.contains(fileType, fileTypes)) { result.add(element); } } return result.isEmpty() ? EMPTY : new LocalSearchScope(PsiUtilCore.toPsiElementArray(result), scope.getDisplayName(), scope.isIgnoreInjectedPsi()); }); }