MingaEditor.State.LSP.FormatOperations (Minga v0.1.0)

Copy Markdown View Source

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.

Summary

Functions

Drops an operation by request reference.

Fetches an operation by its external request reference.

Returns the operation for one Buffer.

Returns an empty operation collection.

Returns the newest active operation.

Tracks an operation when its Buffer has no current request.

Types

t()

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

Functions

drop(operations, ref)

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

Drops an operation by request reference.

fetch(operations, ref)

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

Fetches an operation by its external request reference.

for_buffer(operations, buffer)

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

Returns the operation for one Buffer.

new()

@spec new() :: t()

Returns an empty operation collection.

newest(operations)

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

Returns the newest active operation.

track(operations, operation)

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

Tracks an operation when its Buffer has no current request.