@NotNull
  Collection<DisplayedFoldingAnchor> getAnchorsToDisplay(int firstVisibleOffset,
                                                         int lastVisibleOffset,
                                                         @NotNull List<FoldRegion> activeFoldRegions) {
    Int2ObjectMap<DisplayedFoldingAnchor> result = new Int2ObjectOpenHashMap<>();
    FoldRegion[] visibleFoldRegions = myEditor.getFoldingModel().fetchVisible();
    if (visibleFoldRegions != null) {
      for (FoldRegion region : visibleFoldRegions) {
        if (!region.isValid() || region.shouldNeverExpand()) continue;
        final int startOffset = region.getStartOffset();
        if (startOffset > lastVisibleOffset) continue;
        final int endOffset = region.getEndOffset();
        if (endOffset < firstVisibleOffset) continue;

        boolean singleLine = false;
        int startLogicalLine = myEditor.getDocument().getLineNumber(startOffset);
        int endLogicalLine = myEditor.getDocument().getLineNumber(endOffset);
        if (startLogicalLine == endLogicalLine) {
          singleLine = true;
          if (!region.isGutterMarkEnabledForSingleLine() &&
              (!myEditor.getSettings().isAllowSingleLogicalLineFolding() || (endOffset - startOffset) <= 1 ||
                myEditor.getSoftWrapModel().getSoftWrapsForRange(startOffset + 1, endOffset - 1).isEmpty())) {
            // unless requested, we don't display markers for single-line fold regions
            continue;
          }
        }

        if (skipFoldingAnchor(region)) {
          continue;
        }

        int foldStart = myEditor.offsetToVisualLine(startOffset);
        if (!region.isExpanded()) {
          tryAdding(result, region, foldStart, 0,
                    singleLine ? DisplayedFoldingAnchor.Type.COLLAPSED_SINGLE_LINE : DisplayedFoldingAnchor.Type.COLLAPSED,
                    activeFoldRegions);
        }
        else {
          int foldEnd = myEditor.offsetToVisualLine(endOffset);
          if (foldStart == foldEnd) {
            tryAdding(result, region, foldStart, 0, DisplayedFoldingAnchor.Type.EXPANDED_SINGLE_LINE, activeFoldRegions);
          }
          else {
            tryAdding(result, region, foldStart, foldEnd - foldStart, DisplayedFoldingAnchor.Type.EXPANDED_TOP, activeFoldRegions);
            tryAdding(result, region, foldEnd, foldEnd - foldStart, DisplayedFoldingAnchor.Type.EXPANDED_BOTTOM, activeFoldRegions);
          }
        }
      }
    }
    return result.values();
  }
@NotNull
  Collection<DisplayedFoldingAnchor> getAnchorsToDisplay(int firstVisibleOffset,
                                                         int lastVisibleOffset,
                                                         @NotNull List<FoldRegion> activeFoldRegions)