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. Registry-loaded shells currently must implement the full presentation contract above because the editor still dispatches through each surface. Tab-less shells should return safe defaults from the tab query callbacks until the registry grows capability-aware validation.

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.

Structured GUI payload returned by a shell and encoded centrally by frontend protocol modules. Unknown tags are treated as unsupported extension payloads and logged by the GUI emitter.

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.

gui_payload()

@type gui_payload() :: {atom(), term()} | nil

Structured GUI payload returned by a shell and encoded centrally by frontend protocol modules. Unknown tags are treated as unsupported extension payloads and logged by the GUI emitter.

shell_state()

@type shell_state() :: term()

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

workspace()

@type workspace() :: MingaEditor.Session.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.