if (!(root instanceof ErlangFile)) return FoldingDescriptor.EMPTY;
ErlangFile file = (ErlangFile) root;
final List<FoldingDescriptor> result = ContainerUtil.newArrayList();
for (ErlangFunction function : file.getFunctions()) {
result.add(new FoldingDescriptor(function, function.getTextRange()));
}
if (!quick) {
PsiTreeUtil.processElements(file, new PsiElementProcessor() {
@Override
public boolean execute(@NotNull PsiElement element) {
if (ErlangParserDefinition.COMMENTS.contains(element.getNode().getElementType()) && element.getTextRange().getLength() > 2) {
result.add(new FoldingDescriptor(element, element.getTextRange()));
}
return true;
}
});
}