# `MingaEditor.State.LSP`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/state/lsp.ex#L1)

LSP coordination state for the Editor.

Groups the Editor's LSP-related fields into a focused sub-struct:
server status tracking, cached responses (code lenses, inlay hints,
selection ranges), and debounce timers for highlight and inlay hint
requests.

All mutations go through functions on this module. Other modules
read fields directly but never do `%{lsp | field: value}`.

# `server_status`

```elixir
@type server_status() :: :starting | :initializing | :ready | :crashed
```

# `t`

```elixir
@type t() :: %MingaEditor.State.LSP{
  code_lenses: [map()],
  highlight_debounce_timer: reference() | nil,
  inlay_hint_debounce_timer: reference() | nil,
  inlay_hints: [map()],
  last_inlay_viewport_top: non_neg_integer() | nil,
  selection_range_index: non_neg_integer(),
  selection_ranges: [map()] | nil,
  server_statuses: %{required(atom()) =&gt; server_status()},
  status: MingaEditor.Shell.Traditional.Modeline.lsp_status()
}
```

# `append_code_lens`

```elixir
@spec append_code_lens(t(), map()) :: t()
```

Appends a single resolved code lens entry.

# `cancel_highlight_timer`

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

Cancels the highlight debounce timer and clears the reference.

# `cancel_inlay_hint_timer`

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

Cancels the inlay hint debounce timer and clears the reference.

# `clear_highlight_timer`

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

Clears the highlight debounce timer reference without cancelling it.

# `clear_inlay_hint_timer`

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

Clears the inlay hint debounce timer reference without cancelling it.

# `clear_selection_ranges`

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

Clears the stored selection ranges and resets the index.

# `expand_selection`

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

Moves the selection range index forward (expand) by one step.

# `set_code_lenses`

```elixir
@spec set_code_lenses(t(), [map()]) :: t()
```

Replaces the stored code lenses.

# `set_highlight_timer`

```elixir
@spec set_highlight_timer(t(), reference()) :: t()
```

Sets the highlight debounce timer reference.

# `set_inlay_hint_timer`

```elixir
@spec set_inlay_hint_timer(t(), reference(), non_neg_integer()) :: t()
```

Sets the inlay hint debounce timer and records the viewport top.

# `set_inlay_hints`

```elixir
@spec set_inlay_hints(t(), [map()]) :: t()
```

Replaces the stored inlay hints.

# `set_selection_ranges`

```elixir
@spec set_selection_ranges(t(), [map()]) :: t()
```

Stores a selection range chain and resets the index to 0.

# `shrink_selection`

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

Moves the selection range index backward (shrink) by one step.

# `update_server_status`

```elixir
@spec update_server_status(t(), atom(), atom()) :: t()
```

Updates a single server's status and re-derives the aggregate status.

When `status` is `:stopped`, the server is removed from the map entirely.

---

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