# `MingaEditor.SignatureHelp`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/signature_help.ex#L1)

State and rendering for LSP signature help tooltips.

When the user types `(` or `,` inside a function call, a floating
window appears above the cursor showing the function signature with
the active parameter highlighted. Supports multiple overloaded
signatures with cycling via C-j/C-k.

## Lifecycle

1. User types `(` or `,` in insert mode
2. `CompletionHandling.maybe_handle/4` detects the trigger character
3. `textDocument/signatureHelp` request sent to LSP
4. Response parsed into `SignatureHelp` state
5. Rendered as an overlay in the Chrome stage
6. Dismissed on `)`, Escape, or cursor movement outside the call

# `parameter`

```elixir
@type parameter() :: %{label: String.t(), documentation: String.t()}
```

A parsed parameter.

# `signature`

```elixir
@type signature() :: %{
  label: String.t(),
  documentation: String.t(),
  parameters: [parameter()]
}
```

A parsed signature.

# `t`

```elixir
@type t() :: %MingaEditor.SignatureHelp{
  active_parameter: non_neg_integer(),
  active_signature: non_neg_integer(),
  anchor_col: non_neg_integer(),
  anchor_row: non_neg_integer(),
  signatures: [signature()]
}
```

Signature help state.

# `from_response`

```elixir
@spec from_response(map(), non_neg_integer(), non_neg_integer()) :: t() | nil
```

Creates a new signature help state from an LSP SignatureHelp response.

# `next_signature`

```elixir
@spec next_signature(t()) :: t()
```

Cycle to the next signature overload.

# `prev_signature`

```elixir
@spec prev_signature(t()) :: t()
```

Cycle to the previous signature overload.

# `render`

```elixir
@spec render(t(), {pos_integer(), pos_integer()}, map()) :: [
  MingaEditor.DisplayList.draw()
]
```

Renders the signature help as display list draws for an overlay.

Shows the active signature label with the active parameter highlighted.
If there are multiple signatures, shows a "1/3" counter.

---

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