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

Pure indexes for current Editor-global LSP formatting operations.

One operation may be current per Buffer. The newest active operation is tracked for Esc cancellation while requests for unrelated buffers remain independent.

# `t`

```elixir
@type t() :: %MingaEditor.State.LSP.FormatOperations{
  by_buffer: %{required(pid()) =&gt; reference()},
  by_ref: %{required(reference()) =&gt; MingaEditor.State.LSP.FormatOperation.t()},
  newest_first: [reference()]
}
```

# `drop`

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

Drops an operation by request reference.

# `fetch`

```elixir
@spec fetch(t(), reference()) ::
  {:ok, MingaEditor.State.LSP.FormatOperation.t()} | :error
```

Fetches an operation by its external request reference.

# `for_buffer`

```elixir
@spec for_buffer(t(), pid()) :: MingaEditor.State.LSP.FormatOperation.t() | nil
```

Returns the operation for one Buffer.

# `new`

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

Returns an empty operation collection.

# `newest`

```elixir
@spec newest(t()) :: MingaEditor.State.LSP.FormatOperation.t() | nil
```

Returns the newest active operation.

# `track`

```elixir
@spec track(t(), MingaEditor.State.LSP.FormatOperation.t()) ::
  {:ok, t()} | {:error, :buffer_busy}
```

Tracks an operation when its Buffer has no current request.

---

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