protected static FoldRegion addCollapsedFoldRegion(final int startOffset, final int endOffset, final String placeholder) {
FoldRegion region = addFoldRegion(startOffset, endOffset, placeholder);
toggleFoldRegionState(region, false);
return region;
}
<BUG>protected static void toggleFoldRegionState(final FoldRegion foldRegion, final boolean expanded) {
myEditor.getFoldingModel().runBatchFoldingOperation(new Runnable() {
@Override
public void run() {
foldRegion.setExpanded(expanded);
}
});</BUG>
}

protected static FoldRegion addCollapsedFoldRegion(final int startOffset, final int endOffset, final String placeholder) {
FoldRegion region = addFoldRegion(startOffset, endOffset, placeholder);
toggleFoldRegionState(region, false);
return region;
}
protected static void toggleFoldRegionState(final FoldRegion foldRegion, final boolean expanded) {
myEditor.getFoldingModel().runBatchFoldingOperation(() -> foldRegion.setExpanded(expanded));
}
