MingaEditor.Shell behaviour (Minga v0.1.0)

Copy Markdown View Source

Umbrella behaviour for pluggable presentation shells.

A shell owns layout, chrome, input routing, buffer lifecycle, and tab queries. Each responsibility is a focused sub-behaviour:

This umbrella declares only init/1 (the constructor every shell needs); all other callbacks live on their respective sub-behaviours. Existing shells (Traditional, Board) implement the umbrella plus every sub-behaviour. A future tab-less shell can implement just the sub-behaviours it cares about (e.g., skip TabQueries entirely if no tab UI is rendered) and EditorState/AgentAccess callers that go through Shell.active_session/1 will continue to work because they read through the field, not the type.

Implementation

Implement init/1 plus the sub-behaviours your shell needs, then set the module as the :shell field on MingaEditor.State. The Editor GenServer dispatches to the active shell for presentation concerns.

Available shells

Summary

Types

Why a buffer was added — re-exported here from Shell.BufferLifecycle so existing call sites that use MingaEditor.Shell.buffer_add_context/0 keep compiling.

Shell-specific state. Each shell defines its own struct.

Workspace state (the editing context shared by all shells).

Callbacks

Initialize shell state from config. Called once during Editor startup. Returns the shell's initial state.

Types

buffer_add_context()

Why a buffer was added — re-exported here from Shell.BufferLifecycle so existing call sites that use MingaEditor.Shell.buffer_add_context/0 keep compiling.

shell_state()

@type shell_state() :: term()

Shell-specific state. Each shell defines its own struct.

workspace()

@type workspace() :: MingaEditor.Workspace.State.t()

Workspace state (the editing context shared by all shells).

Callbacks

init(opts)

@callback init(opts :: keyword()) :: shell_state()

Initialize shell state from config. Called once during Editor startup. Returns the shell's initial state.