# `MingaEditor.Extension.EventHandler`
[🔗](https://github.com/jsmestad/minga/blob/main/sdk/lib/minga_editor/extension/event_handler.ex#L1)

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.

# `callback_result`

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

A successful state transition or explicit decline.

# `event`

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

Runtime editor events available to SDK consumers.

# `event_kind`

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

Runtime editor event categories available in the public DSL.

# `handle_editor_event`

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

Handles one runtime editor event synchronously.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
