PsiElement (PsiElement child, @NotNull List<? super FoldingDescriptor> descriptors) { PsiComment startComment = null; PsiComment endComment = null; int commentsCount = 0; while (child instanceof PsiComment) { commentsCount++; if (startComment == null) { startComment = (PsiComment)child; } endComment = (PsiComment)child; child = skipSpaceElementsUpToLine(child.getNextSibling()); } if (commentsCount > 2) { descriptors.add(new FoldingDescriptor(startComment, TextRange.create(startComment.getTextRange().getStartOffset(), endComment.getTextRange().getEndOffset() ) )); } return child; }