boolean (@NotNull PsiElement element, @NotNull SearchScope searchScope, @NotNull String stringToSearch, boolean includeReferences, @NotNull PairProcessor<? super PsiElement, ? super TextRange> processor) { PsiSearchHelper helper = PsiSearchHelper.getInstance(element.getProject()); SearchScope scope = helper.getUseScope(element); scope = scope.intersectWith(searchScope); Processor<PsiElement> commentOrLiteralProcessor = literal -> processTextIn(literal, stringToSearch, includeReferences, processor); return processStringLiteralsContainingIdentifier(stringToSearch, scope, helper, commentOrLiteralProcessor) && helper.processCommentsContainingIdentifier(stringToSearch, scope, commentOrLiteralProcessor); }