MingaEditor.UI.Picker.Context (Minga v0.1.0)

Copy Markdown View Source

Picker context struct — what picker sources need from MingaEditor.State.

This struct decouples picker sources from the full MingaEditor.State, allowing sources to depend only on the subset of state they actually use. This makes sources easier to test, easier to reason about, and prevents the cyclic dependency between UI.Picker and MingaEditor.State.

Fields

  • buffers — buffer list and active buffer (MingaEditor.State.Buffers.t())
  • editing — vim state (marks, registers, jump positions, mode)
  • file_tree — file tree state (if available)
  • search — search state (buffer search, project search results)
  • viewport — viewport dimensions
  • tab_bar — tab bar state (tabs, active tab, workspaces)
  • agent_session — agent session PID (if available)
  • picker_ui — picker UI state (context map for sources)
  • document_symbols — tree-sitter document symbols for the active window
  • capabilities — frontend capabilities (GUI detection, etc.)
  • keymap_server — keymap server used by this editor instance
  • options_server — options server used by this editor instance
  • theme — active theme

Summary

Functions

Builds a picker context from the full editor state.

Returns a copy of the picker context with source-specific context data.

Types

t()

@type t() :: %MingaEditor.UI.Picker.Context{
  agent_session: pid() | nil,
  buffers: MingaEditor.State.Buffers.t(),
  capabilities: map(),
  document_symbols: [Minga.Language.Symbol.t()],
  editing: MingaEditor.VimState.t(),
  file_tree: MingaEditor.State.FileTree.t() | nil,
  keymap_server: MingaEditor.State.keymap_server() | nil,
  options_server: MingaEditor.State.options_server() | nil,
  picker_ui: map(),
  search: MingaEditor.State.Search.t(),
  tab_bar: MingaEditor.State.TabBar.t(),
  theme: MingaEditor.UI.Theme.t(),
  viewport: MingaEditor.Viewport.t()
}

Functions

from_editor_state(state, extra_context \\ nil)

@spec from_editor_state(MingaEditor.State.t(), map() | nil) :: t()

Builds a picker context from the full editor state.

The optional extra_context is stored in picker_ui.context so that sources invoked from PickerUI.open/3 can read it before the picker modal has been opened (i.e. when shell_state.modal is still :none).

with_picker_context(ctx, context)

@spec with_picker_context(t(), map() | nil) :: t()

Returns a copy of the picker context with source-specific context data.