Pure indexes for Editor-global LSP request correlations.
One response reference has exactly one semantic owner. Formatting keeps extra Buffer and newest indexes for cancellation while all request variants share the by_ref authority.
Summary
Functions
Drops pending workspace responses and generation state for a retired buffer.
Returns whether a workspace response generation is still current for its origin.
Types
@type operation_kind() :: :references | :rename
@type position() :: {non_neg_integer(), non_neg_integer()}
@type request() :: {:response, MingaEditor.State.LSP.current_origin_response_kind(), pid(), pid(), non_neg_integer(), MingaEditor.State.Tab.id() | nil, position() | nil} | {:inlay_hint, pid(), pid(), non_neg_integer(), MingaEditor.State.Tab.id() | nil, non_neg_integer(), pos_integer()} | {:completion_result, MingaEditor.CompletionTrigger.response_role(), pid(), pid(), non_neg_integer(), non_neg_integer(), position()} | {:completion_resolve, pid(), pid(), non_neg_integer(), non_neg_integer(), map()} | {:signature_help, pid(), pid(), non_neg_integer(), position()} | {:hover_mouse, non_neg_integer(), non_neg_integer(), pid(), non_neg_integer(), non_neg_integer(), non_neg_integer()} | {:semantic_tokens, pid(), pid(), non_neg_integer(), Minga.LSP.PositionEncoding.encoding(), {[String.t()], [String.t()]}} | {:operation, operation_kind(), MingaEditor.State.Operation.id(), MingaEditor.State.Tab.id() | nil} | {:workspace_operation, :rename, MingaEditor.State.Operation.id(), MingaEditor.State.Tab.id() | nil, Minga.LSP.DocumentContext.t()} | {:workspace_response, :code_action, workspace_generation(), Minga.LSP.DocumentContext.t(), MingaEditor.State.Tab.id() | nil, position()} | {:format, MingaEditor.State.LSP.FormatOperation.t()}
@type t() :: %MingaEditor.State.LSP.PendingRequests{ by_ref: %{required(reference()) => request()}, format_by_buffer: %{required(pid()) => reference()}, newest_formats: [reference()], next_workspace_generation: workspace_generation(), workspace_generations: %{required(workspace_key()) => workspace_generation()} }
@type workspace_generation() :: pos_integer()
@type workspace_key() :: {:code_action, pid()}
Functions
@spec fetch_format(t(), reference()) :: {:ok, MingaEditor.State.LSP.FormatOperation.t()} | :error
@spec format_for_buffer(t(), pid()) :: MingaEditor.State.LSP.FormatOperation.t() | nil
@spec new() :: t()
@spec newest_format(t()) :: MingaEditor.State.LSP.FormatOperation.t() | nil
Drops pending workspace responses and generation state for a retired buffer.
@spec take_operations_for_tab(t(), MingaEditor.State.Tab.id()) :: {[request()], t()}
@spec track_completion_resolve( t(), reference(), pid(), pid(), non_neg_integer(), non_neg_integer(), map() ) :: {:ok, t()} | {:error, :duplicate_ref}
@spec track_completion_result( t(), reference(), MingaEditor.CompletionTrigger.response_role(), pid(), pid(), non_neg_integer(), non_neg_integer(), position() ) :: {:ok, t()} | {:error, :duplicate_ref}
@spec track_format(t(), MingaEditor.State.LSP.FormatOperation.t()) :: {:ok, t()} | {:error, :duplicate_ref | :buffer_busy}
@spec track_hover_mouse( t(), reference(), non_neg_integer(), non_neg_integer(), pid(), non_neg_integer(), non_neg_integer(), non_neg_integer() ) :: {:ok, t()} | {:error, :duplicate_ref}
@spec track_inlay_hint( t(), reference(), pid(), pid(), non_neg_integer(), MingaEditor.State.Tab.id() | nil, non_neg_integer(), pos_integer() ) :: {:ok, t()} | {:error, :duplicate_ref}
@spec track_operation( t(), reference(), operation_kind(), MingaEditor.State.Operation.id(), MingaEditor.State.Tab.id() | nil ) :: {:ok, t()} | {:error, :duplicate_ref}
@spec track_response( t(), reference(), MingaEditor.State.LSP.current_origin_response_kind(), pid(), pid(), non_neg_integer(), MingaEditor.State.Tab.id() | nil, {non_neg_integer(), non_neg_integer()} | nil ) :: {:ok, t()} | {:error, :duplicate_ref}
@spec track_semantic_tokens( t(), reference(), pid(), pid(), non_neg_integer(), Minga.LSP.PositionEncoding.encoding(), {[String.t()], [String.t()]} ) :: {:ok, t()} | {:error, :duplicate_ref}
@spec track_workspace_operation( t(), reference(), :rename, MingaEditor.State.Operation.id(), MingaEditor.State.Tab.id() | nil, Minga.LSP.DocumentContext.t() ) :: {:ok, t()} | {:error, :duplicate_ref}
@spec track_workspace_response( t(), reference(), :code_action, Minga.LSP.DocumentContext.t(), MingaEditor.State.Tab.id() | nil, position() ) :: {:ok, t()} | {:error, :duplicate_ref}
@spec workspace_generation_current?( t(), :code_action, pid(), workspace_generation() ) :: boolean()
Returns whether a workspace response generation is still current for its origin.