# `Minga.Editing.Fold.Range`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga/editing/fold/range.ex#L1)

A foldable range within a buffer.

Value object representing a region that *can* be folded (collapsed).
Produced by fold providers, consumed by `FoldMap`. Two ranges must
not overlap; the fold map enforces this on insertion.

Both `start_line` and `end_line` are inclusive, 0-indexed buffer line
numbers. A range must span at least two lines (`end_line > start_line`).

# `kind`

```elixir
@type kind() :: :block | :comment | :import | :heading
```

Kind of fold range. Used by the renderer to pick icons and by
org-mode cycling to distinguish heading levels from generic blocks.

- `:block` — generic code block (function, class, if/for/while)
- `:comment` — comment block
- `:import` — import/use/require group
- `:heading` — org-mode or markdown heading

# `t`

```elixir
@type t() :: %Minga.Editing.Fold.Range{
  end_line: non_neg_integer(),
  kind: kind(),
  start_line: non_neg_integer(),
  summary: String.t() | nil
}
```

A foldable range.

- `start_line` — first line of the range (the "summary" line shown when folded)
- `end_line` — last line of the range (inclusive)
- `summary` — optional text shown after the fold line (e.g., "··· 12 lines")
- `kind` — the type of fold range

# `contains?`

```elixir
@spec contains?(t(), non_neg_integer()) :: boolean()
```

Returns true if the given buffer line falls within this range (inclusive).

# `hidden_count`

```elixir
@spec hidden_count(t()) :: pos_integer()
```

Returns the number of lines hidden when this range is folded (excludes the summary line).

# `hides?`

```elixir
@spec hides?(t(), non_neg_integer()) :: boolean()
```

Returns true if the given buffer line is hidden by this fold (inside but not the start line).

# `new`

```elixir
@spec new(non_neg_integer(), non_neg_integer(), keyword()) ::
  {:ok, t()} | {:error, String.t()}
```

Creates a new fold range.

Returns `{:ok, range}` if valid, or `{:error, reason}` if the range
is degenerate (end <= start).

# `new!`

```elixir
@spec new!(non_neg_integer(), non_neg_integer(), keyword()) :: t()
```

Creates a new fold range, raising on invalid input.

# `overlaps?`

```elixir
@spec overlaps?(t(), t()) :: boolean()
```

Returns true if two ranges overlap.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
