void () { runWithReparseDelay(0, () -> { @Language("JAVA") String text = """ class Foo { void m() { } }"""; configureByText(JavaFileType.INSTANCE, text); EditorTestUtil.buildInitialFoldingsInBackground(myEditor); waitForDaemon(); EditorTestUtil.executeAction(myEditor, IdeActions.ACTION_COLLAPSE_ALL_REGIONS); waitForDaemon(); checkFoldingState("[FoldRegion +(25:33), placeholder='{}']"); WriteCommandAction.runWriteCommandAction(myProject, () -> myEditor.getDocument().insertString(0, "/*")); waitForDaemon(); checkFoldingState("[FoldRegion -(0:37), placeholder='/.../', FoldRegion +(27:35), placeholder='{}']"); EditorTestUtil.executeAction(myEditor, IdeActions.ACTION_EXPAND_ALL_REGIONS); waitForDaemon(); checkFoldingState("[FoldRegion -(0:37), placeholder='/.../']"); }); }