Frontend communication domain facade.
External callers tell the frontend WHAT to do through semantic operations. The Frontend domain handles HOW (binary encoding, batching, protocol versioning) internally.
Render frames
The Editor builds a Frame struct (display list of styled text
runs). send_render_frame/2 encodes and sends it to the frontend.
Parser commands
Tree-sitter parsing runs in a separate Zig process. Parser commands (setup_buffer, update_buffer, set_queries) encode the appropriate wire messages and send them to the parser port.
Configuration
Font, title, theme, and window background are set through individual semantic operations.
Summary
Functions
Returns the frontend capabilities struct.
Sends a clipboard write command to the GUI frontend.
Closes a parser buffer.
Configures the editor font.
Decodes a binary event from the frontend or parser process.
Returns the default capabilities struct.
Sends an incremental edit to a buffer.
Returns true if the frontend supports GUI chrome opcodes.
Loads a tree-sitter grammar from a shared library.
Sends a full reparse of a buffer's content.
Returns true if the frontend is ready to receive commands.
Requests textobject positions for a buffer location.
Returns true if the frontend supports semantic render-model opcodes.
Sends a list of pre-encoded commands to the frontend process.
Sends a bare, content-free frame transaction to the frontend (#2219).
Sends the per-frame render batch and stamps a monotonic send time so the
frontend emits a [:minga, :render, :hop_latency] (hop: :send_commands)
sample for the Renderer.Server → Port.Manager scheduling delay.
Sets the language for a parser buffer.
Sets tree-sitter queries for a parser buffer.
Sets the window title.
Sets the window background color.
Sets up a buffer in the parser with language and initial content.
Subscribes the calling process to frontend events.
Returns the terminal dimensions {width, height}.
Functions
@spec capabilities(GenServer.server()) :: MingaEditor.Frontend.Capabilities.t()
Returns the frontend capabilities struct.
@spec clipboard_write(GenServer.server(), String.t(), atom()) :: :ok
Sends a clipboard write command to the GUI frontend.
@spec close_parser_buffer(GenServer.server(), non_neg_integer()) :: :ok
Closes a parser buffer.
@spec configure_font( GenServer.server(), String.t(), pos_integer(), boolean(), atom(), [String.t()] ) :: :ok
Configures the editor font.
@spec decode_event(binary()) :: {:ok, MingaEditor.Frontend.Protocol.input_event()} | {:error, :unknown_opcode | :malformed}
Decodes a binary event from the frontend or parser process.
@spec default_capabilities() :: MingaEditor.Frontend.Capabilities.t()
Returns the default capabilities struct.
@spec edit_buffer(GenServer.server(), non_neg_integer(), non_neg_integer(), [map()]) :: :ok
Sends an incremental edit to a buffer.
@spec gui?(MingaEditor.Frontend.Capabilities.t()) :: boolean()
Returns true if the frontend supports GUI chrome opcodes.
@spec load_grammar(GenServer.server(), String.t(), String.t()) :: :ok
Loads a tree-sitter grammar from a shared library.
@spec parse_buffer( GenServer.server(), non_neg_integer(), non_neg_integer(), String.t() ) :: :ok
Sends a full reparse of a buffer's content.
@spec ready?(GenServer.server()) :: boolean()
Returns true if the frontend is ready to receive commands.
@spec request_textobject( GenServer.server(), non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer(), String.t() ) :: :ok
Requests textobject positions for a buffer location.
@spec semantic_ui?(MingaEditor.Frontend.Capabilities.t()) :: boolean()
Returns true if the frontend supports semantic render-model opcodes.
@spec send_commands(GenServer.server(), [binary()]) :: :ok
Sends a list of pre-encoded commands to the frontend process.
@spec send_frame_boundary( GenServer.server(), non_neg_integer(), non_neg_integer(), non_neg_integer() ) :: :ok
Sends a bare, content-free frame transaction to the frontend (#2219).
Used by frame-synchronization contracts that must emit a frame boundary without
re-rendering (the operator-pending no-op optimization). Brackets nothing with
begin_frame ++ commit_frame. frame_seq is the strictly monotonic global frame
sequence; base_frame_seq names the previously emitted frame (0 for the first).
input_seq is the echoed input correlation sequence (ticket #2215, default 0).
@spec send_render_commands(GenServer.server(), [binary()]) :: :ok
Sends the per-frame render batch and stamps a monotonic send time so the
frontend emits a [:minga, :render, :hop_latency] (hop: :send_commands)
sample for the Renderer.Server → Port.Manager scheduling delay.
@spec set_buffer_language(GenServer.server(), non_neg_integer(), String.t()) :: :ok
Sets the language for a parser buffer.
@spec set_parser_queries(GenServer.server(), non_neg_integer(), keyword()) :: :ok
Sets tree-sitter queries for a parser buffer.
Accepts a keyword list of query types and their text:
[highlight: "...", injection: "...", fold: "...", textobject: "..."]
@spec set_title(GenServer.server(), String.t()) :: :ok
Sets the window title.
@spec set_window_bg(GenServer.server(), non_neg_integer()) :: :ok
Sets the window background color.
@spec setup_parser_buffer( GenServer.server(), non_neg_integer(), String.t(), String.t(), non_neg_integer() ) :: :ok
Sets up a buffer in the parser with language and initial content.
Combines set_language + parse_buffer into a single batch.
@spec subscribe(GenServer.server()) :: :ok
Subscribes the calling process to frontend events.
@spec terminal_size(GenServer.server()) :: {pos_integer(), pos_integer()} | nil
Returns the terminal dimensions {width, height}.