Typed per-tab workspace snapshot stored on MingaEditor.State.Tab.
Contexts replace the old free-form map while still accepting legacy maps at API boundaries. present_fields records which workspace fields were actually present in a legacy map so partial migration inputs do not overwrite live workspace state with nil defaults.
Summary
Types
A document highlight range from the LSP server.
Workspace fields carried by a tab context.
Legacy map persisted or built before tab contexts became typed structs.
Functions
Returns the active buffer pid represented by this context, when present.
Returns live buffer pids represented by this context.
Returns an empty context for a brand-new tab with no saved workspace yet.
Returns true when the context has no workspace fields to restore.
Returns the workspace field names represented by this context.
Normalizes a legacy context map into a typed context struct.
Creates a tab context directly from a workspace struct, without intermediate map conversion.
Builds the initial context for a semantic agent tab.
Builds an agent context around an already-constructed semantic window set.
Builds the initial context for a new file tab from the current workspace and viewport.
Returns a context with valid workspace field overrides applied.
Returns a context with every exact reference to the dead buffer retired when present.
Captures a complete tab snapshot, including a non-default shared agent projection.
Returns a workspace map containing only fields present in this context.
Returns workspace fields intentionally excluded from per-tab snapshotting.
Types
@type document_highlight() :: Minga.LSP.DocumentHighlight.t()
A document highlight range from the LSP server.
@type field_name() ::
:keymap_scope
| :buffers
| :windows
| :file_tree
| :viewport
| :mouse
| :lsp_pending
| :search
| :editing
| :feature_state
| :document_highlights
| :agent_ui
Workspace fields carried by a tab context.
@type legacy() :: map()
Legacy map persisted or built before tab contexts became typed structs.
@type t() :: %MingaEditor.State.Tab.Context{ agent_ui: MingaEditor.Agent.UIState.t() | nil, buffers: MingaEditor.State.Buffers.t() | nil, document_highlights: [document_highlight()] | nil, editing: MingaEditor.VimState.t() | nil, feature_state: MingaEditor.FeatureState.t() | nil, file_tree: MingaEditor.State.FileTree.t() | nil, keymap_scope: Minga.Keymap.Scope.scope_name() | nil, lsp_pending: %{required(reference()) => atom() | tuple()} | nil, mouse: MingaEditor.State.Mouse.t() | nil, present_fields: [field_name()], search: MingaEditor.State.Search.t() | nil, version: pos_integer(), viewport: MingaEditor.Viewport.t() | nil, windows: MingaEditor.State.Windows.t() | nil }
Functions
Returns the active buffer pid represented by this context, when present.
Returns live buffer pids represented by this context.
@spec empty() :: t()
Returns an empty context for a brand-new tab with no saved workspace yet.
Returns true when the context has no workspace fields to restore.
@spec field_names() :: [field_name()]
Returns the workspace field names represented by this context.
Normalizes a legacy context map into a typed context struct.
@spec from_workspace(MingaEditor.Session.State.t()) :: t()
Creates a tab context directly from a workspace struct, without intermediate map conversion.
@spec new_agent(MingaEditor.Viewport.t(), String.t() | nil) :: t()
Builds the initial context for a semantic agent tab.
@spec new_agent( MingaEditor.Viewport.t(), String.t() | nil, MingaEditor.State.Windows.t() ) :: t()
Builds an agent context around an already-constructed semantic window set.
@spec new_file(MingaEditor.Session.State.t(), MingaEditor.Viewport.t()) :: t()
Builds the initial context for a new file tab from the current workspace and viewport.
Returns a context with valid workspace field overrides applied.
Returns a context with every exact reference to the dead buffer retired when present.
@spec snapshot(MingaEditor.Session.State.t()) :: t()
Captures a complete tab snapshot, including a non-default shared agent projection.
Returns a workspace map containing only fields present in this context.
@spec transient_fields() :: [atom()]
Returns workspace fields intentionally excluded from per-tab snapshotting.
These are transient pointer/frame state (#2630), never persisted or restored.
Together with field_names/0 they must account for every Session.State
field; the feature_state_test guard enforces that.