LocalSearchScope (@NotNull LocalSearchScope scope, @NotNull LanguageMatcher matcher) { if (scope == EMPTY) { return EMPTY; } return ReadAction.compute(() -> { List<PsiElement> result = ContainerUtil.filter( scope.getScope(), element -> matcher.matchesLanguage(element.getContainingFile().getLanguage()) ); return result.isEmpty() ? EMPTY : new LocalSearchScope(PsiUtilCore.toPsiElementArray(result), scope.getDisplayName(), scope.isIgnoreInjectedPsi()); }); }