@Override
  public @Nullable FoldRegion createFoldRegion(int startOffset,
                                               int endOffset,
                                               @NotNull String placeholder,
                                               @Nullable FoldingGroup group,
                                               boolean neverExpands) {
    assertIsDispatchThreadForEditor();
    if (!myIsBatchFoldingProcessing) {
      LOG.error("Fold regions must be added or removed inside batchFoldProcessing() only.");
      return null;
    }
    if (!isFoldingEnabled() ||
        startOffset >= endOffset ||
        neverExpands && group != null ||
        DocumentUtil.isInsideCharacterPair(myEditor.getDocument(), startOffset) ||
        DocumentUtil.isInsideCharacterPair(myEditor.getDocument(), endOffset) ||
        !myFoldTree.checkIfValidToCreate(startOffset, endOffset, false, null)) {
      return null;
    }

    FoldRegionImpl region = new FoldRegionImpl(myEditor, startOffset, endOffset, placeholder, group, neverExpands);
    myRegionTree.addInterval(region, startOffset, endOffset, false, false, false, 0);
    LOG.assertTrue(region.isValid());
    if (neverExpands) {
      collapseFoldRegion(region, false);
      if (region.isExpanded()) {
        region.putUserData(DO_NOT_NOTIFY, Boolean.TRUE);
        myRegionTree.removeInterval(region);
        return null;
      }
    }
    myFoldRegionsProcessed = true;
    if (group != null) {
      myGroups.putValue(group, region);
    }
    onFoldRegionStateChange(region);
    LOG.assertTrue(region.isValid());
    return region;
  }
@Override
  public @Nullable FoldRegion createFoldRegion(int startOffset,
                                               int endOffset,
                                               @NotNull String placeholder,
                                               @Nullable FoldingGroup group,
                                               boolean neverExpands)