void (@NotNull Editor editor) { FoldRegion[] allRegions = editor.getFoldingModel().getAllFoldRegions(); TextRange range = getRangeToUnfoldOnNavigation(editor); editor.getFoldingModel().runBatchFoldingOperation(() -> { for (FoldRegion region : allRegions) { if (!region.isExpanded() && range.intersects(region)) { region.setExpanded(true); } } }); }