public static @Nullable FoldRegion findFoldRegionStartingAtLine(@NotNull Editor editor, int line){
    if (line < 0 || line >= editor.getDocument().getLineCount()) {
      return null;
    }
    FoldRegion result = null;
    FoldRegion[] regions = editor.getFoldingModel().getAllFoldRegions();
    for (FoldRegion region : regions) {
      if (!region.isValid()) {
        continue;
      }
      if (region.getDocument().getLineNumber(region.getStartOffset()) == line) {
        if (result != null) return null;
        result = region;
      }
    }
    return result;
  }
public static @Nullable FoldRegion findFoldRegionStartingAtLine(@NotNull Editor editor, int line)