MingaEditor.Extension.EventHandler behaviour (minga_sdk v0.1.0)

Copy Markdown View Source

Contract for synchronous runtime editor events declared by an extension.

Returning :not_matched means the callback ran successfully and declined an editor action. Callback failures are reported by the host runtime and are not represented by this successful callback return type.

Summary

Types

A successful state transition or explicit decline.

Runtime editor events available to SDK consumers.

Runtime editor event categories available in the public DSL.

Callbacks

Handles one runtime editor event synchronously.

Types

callback_result()

@type callback_result() :: {:handled, state :: term()} | :not_matched

A successful state transition or explicit decline.

event()

@type event() ::
  {:buffer_saved, pid()}
  | {:editor_action, atom(), term()}
  | {:source_unload, {:extension, atom()}}

Runtime editor events available to SDK consumers.

event_kind()

@type event_kind() :: :buffer_saved | :editor_action | :source_unload

Runtime editor event categories available in the public DSL.

Callbacks

handle_editor_event(state, event)

@callback handle_editor_event(state :: term(), event()) :: callback_result()

Handles one runtime editor event synchronously.