Public API for buffer operations.
Extensions use this module to read buffer content, query cursor position, check file paths, and manage decorations.
This is a compile-time stub. At runtime, the real module in Minga's BEAM VM provides the implementation.
Summary
Functions
Returns the cursor, inclusive conflict regions, and their shared buffer version.
Returns content and its mutation version from the same buffer state.
Replaces the content only at the observed version, returning the new version.
Resolves one conflict at the observed version without saving.
Saves the file only when the buffer is still at the requested version.
Types
@type position() :: {line :: non_neg_integer(), col :: non_neg_integer()}
@type t() :: GenServer.server()
Functions
@spec conflict_count(t()) :: non_neg_integer()
@spec conflict_view(t()) :: Minga.Buffer.Conflict.view()
Returns the cursor, inclusive conflict regions, and their shared buffer version.
@spec content_with_version(t()) :: {String.t(), non_neg_integer()}
Returns content and its mutation version from the same buffer state.
@spec line_count(t()) :: pos_integer()
@spec lines(t(), non_neg_integer(), non_neg_integer()) :: [String.t()]
@spec replace_content_if_version(t(), non_neg_integer(), String.t()) :: {:ok, non_neg_integer()} | {:error, :read_only | :stale}
Replaces the content only at the observed version, returning the new version.
@spec resolve_conflict( t(), non_neg_integer(), Minga.Buffer.Conflict.target(), Minga.Buffer.Conflict.choice() ) :: {:ok, Minga.Buffer.Conflict.resolution()} | {:error, Minga.Buffer.Conflict.rejection()}
Resolves one conflict at the observed version without saving.
@spec save_if_version(t(), non_neg_integer()) :: :ok | {:error, term()}
Saves the file only when the buffer is still at the requested version.