FoldingDescriptor (@NotNull PsiComment comment, @NotNull Document document, @NotNull Set<? super PsiElement> processedComments, @NotNull Predicate<? super PsiElement> isCustomRegionFunc, boolean isCollapse) { if (!processedComments.add(comment)) return null; final Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(comment.getLanguage()); if (!(commenter instanceof CodeDocumentationAwareCommenter)) return null; final CodeDocumentationAwareCommenter docCommenter = (CodeDocumentationAwareCommenter)commenter; final IElementType commentType = comment.getTokenType(); final TextRange commentRange = getCommentRange(comment, processedComments, isCustomRegionFunc, docCommenter); if (commentRange == null) return null; final String placeholder = getCommentPlaceholder(document, commentType, commentRange); if (placeholder == null) return null; return new FoldingDescriptor(comment.getNode(), commentRange, null, placeholder, isCollapse, Collections.emptySet()); }