@Override
  public void afterArrangement(final @NotNull List<ArrangementMoveInfo> moveInfos) {
    // Restore state for the PSI elements not affected by arrangement.
    Project project = myEditor.getProject();
    if (project != null) {
      final FoldRegion[] regions = myEditor.getFoldingModel().getAllFoldRegions();
      final List<FoldRegionInfo> foldRegionsInfo = new ArrayList<>();
      for (FoldRegion region : regions) {
        final FoldRegionInfo info = new FoldRegionInfo(region.getStartOffset(), region.getEndOffset(), region.isExpanded());
        foldRegionsInfo.add(info);
      }

      final CodeFoldingManager foldingManager = CodeFoldingManager.getInstance(project);
      foldingManager.updateFoldRegions(myEditor);
      myEditor.getFoldingModel().runBatchFoldingOperation(() -> {
        for (FoldRegionInfo info : foldRegionsInfo) {
          final FoldRegion foldRegion = foldingManager.findFoldRegion(myEditor, info.myStart, info.myEnd);
          if (foldRegion != null) {
            foldRegion.setExpanded(info.myIsExpanded);
          }
        }
      });
    }
  }
@Override
  public void afterArrangement(final @NotNull List<ArrangementMoveInfo> moveInfos)