void (@NotNull ASTNode node, @NotNull Document document, @NotNull List<FoldingDescriptor> descriptors) { final IElementType type = node.getElementType(); if ((type == JsonElementTypes.OBJECT || type == JsonElementTypes.ARRAY) && spanMultipleLines(node, document)) { descriptors.add(new FoldingDescriptor(node, node.getTextRange())); } else if (type == JsonElementTypes.BLOCK_COMMENT) { descriptors.add(new FoldingDescriptor(node, node.getTextRange())); } else if (type == JsonElementTypes.LINE_COMMENT) { final Couple<PsiElement> commentRange = expandLineCommentsRange(node.getPsi()); final int startOffset = commentRange.getFirst().getTextRange().getStartOffset(); final int endOffset = commentRange.getSecond().getTextRange().getEndOffset(); if (document.getLineNumber(startOffset) != document.getLineNumber(endOffset)) { descriptors.add(new FoldingDescriptor(node, new TextRange(startOffset, endOffset))); } } for (ASTNode child : node.getChildren(null)) { collectDescriptorsRecursively(child, document, descriptors); } }