void (final @NotNull Editor editor, final int offset) { FoldingModel foldingModel = editor.getFoldingModel(); while (true) { FoldRegion region = foldingModel.getCollapsedRegionAtOffset(offset); if (region == null || region.shouldNeverExpand()) break; foldingModel.runBatchFoldingOperation(() -> region.setExpanded(true)); } }