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).
Summary
Types
Kind of fold range. Used by the renderer to pick icons and by org-mode cycling to distinguish heading levels from generic blocks.
A foldable range.
Functions
Returns true if the given buffer line falls within this range (inclusive).
Returns the number of lines hidden when this range is folded (excludes the summary line).
Returns true if the given buffer line is hidden by this fold (inside but not the start line).
Creates a new fold range.
Creates a new fold range, raising on invalid input.
Returns true if two ranges overlap.
Types
@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
@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
Functions
@spec contains?(t(), non_neg_integer()) :: boolean()
Returns true if the given buffer line falls within this range (inclusive).
@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).
@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).
@spec new!(non_neg_integer(), non_neg_integer(), keyword()) :: t()
Creates a new fold range, raising on invalid input.
Returns true if two ranges overlap.