MingaEditor.StatusBar.Data (Minga v0.1.0)

Copy Markdown View Source

Typed editor snapshot for the global status bar.

Computed once per frame from editor state and consumed by the semantic emit path, which encodes it as the 0x76 (gui_status_bar) structured opcode for every live frontend.

Summary

Types

Git diff summary: {added, modified, deleted} line counts.

Indentation display information.

Parser availability status.

Visual selection size display information.

t()

Functions

Returns the first diagnostic message on the given cursor line, formatted as a human-readable hint string (icon + message + source). Returns nil if no diagnostics exist on that line.

Returns the diagnostic count 4-tuple for the active buffer, or nil.

Builds the status bar data from the current editor state.

Returns true when the tracked repo's cached status is degraded for path.

Returns {branch_name | nil, diff_summary | nil} for the status bar.

Converts a StatusBar.Data.t() to the map shape expected by Modeline.render/5.

Attaches GUI-ready configured modeline segments to status bar data.

Types

git_diff_summary()

@type git_diff_summary() ::
  {non_neg_integer(), non_neg_integer(), non_neg_integer()} | nil

Git diff summary: {added, modified, deleted} line counts.

indent_type()

@type indent_type() :: :spaces | :tabs

Indentation display information.

parser_status()

@type parser_status() :: :available | :unavailable | :restarting

Parser availability status.

selection_info()

@type selection_info() :: {:chars, non_neg_integer()} | {:lines, pos_integer()} | nil

Visual selection size display information.

t()

@type t() :: %MingaEditor.StatusBar.Data{
  common: MingaEditor.StatusBar.Data.Common.t(),
  content:
    MingaEditor.StatusBar.Data.Buffer.t() | MingaEditor.StatusBar.Data.Agent.t()
}

Functions

cursor_line_diagnostic_hint(buf, line)

@spec cursor_line_diagnostic_hint(pid() | nil, non_neg_integer()) :: String.t() | nil

Returns the first diagnostic message on the given cursor line, formatted as a human-readable hint string (icon + message + source). Returns nil if no diagnostics exist on that line.

Used by the GUI status bar center segment to show diagnostic context when idle (no status message, no active minibuffer).

diagnostic_modeline_data(buf)

@spec diagnostic_modeline_data(pid() | nil) ::
  {non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer()}
  | nil

Returns the diagnostic count 4-tuple for the active buffer, or nil.

from_state(state)

@spec from_state(MingaEditor.State.t() | map()) :: t()

Builds the status bar data from the current editor state.

Inspects the active window's content type and returns the appropriate typed content marker. Called once per render frame before the Chrome stage.

git_degraded?(path)

@spec git_degraded?(String.t() | nil) :: boolean()

Returns true when the tracked repo's cached status is degraded for path.

Reads the repo's cache-only snapshot (no git shell-out). Degraded means the last git status was trimmed (e.g. timed out on a huge full checkout), so the modeline shows a visible indicator rather than implying the status is complete.

git_modeline_data(buf)

@spec git_modeline_data(pid() | nil) :: {String.t() | nil, git_diff_summary()}

Returns {branch_name | nil, diff_summary | nil} for the status bar.

to_modeline_data(data)

Converts a StatusBar.Data.t() to the map shape expected by Modeline.render/5.

Both variants carry the same common fields and produce identical modeline data.

with_modeline_segments(status_bar_data, theme, modeline_segments_table \\ ModelineSegments)

@spec with_modeline_segments(
  t(),
  MingaEditor.UI.Theme.t(),
  Minga.Config.ModelineSegments.table()
) ::
  t()

Attaches GUI-ready configured modeline segments to status bar data.