Modal-overlay payload for the completion menu.
The completion menu is logically per-tab: it tracks the cursor position of
the buffer that triggered it. The owner field carries the tab identifier
so the tab-switch hook (MingaEditor.Shell.Traditional.ModalWorkflow.dismiss_if_stale/1) can auto-dismiss
completion that no longer belongs to the active tab.
Trigger lifecycle
The completion trigger (debounce/pending-ref machinery) is part of the modal's lifecycle: it only matters while completion is being driven, and resets when completion dismisses. Carrying the trigger on the payload — rather than as an independent field on workspace state — keeps the modal's lifecycle self-contained and removes a per-tab field that other callers had to know about.
Summary
Types
The user-visible completion menu, or nil while a request is pending.
Identifier of the tab that triggered completion.
Functions
Records a completion value selected by explicit user navigation.
Builds a completion payload bound to owner (typically a tab id).
Returns the opaque generation of this completion presentation lifecycle.
Replaces the inner Completion.t() on the payload while preserving lifecycle ownership.
Replaces the inner trigger on the payload. The only sanctioned way to update the trigger from outside this module.
Types
@type completion_or_nil() :: Minga.Editing.Completion.t() | nil
The user-visible completion menu, or nil while a request is pending.
nil represents the brief window between the trigger firing an LSP
request and the response arriving. The render layer paints nothing
while completion is nil; the modal exists so the trigger's debounce/
pending-ref state has a home.
@type owner() :: MingaEditor.State.Tab.id() | nil
Identifier of the tab that triggered completion.
Tab IDs are the positive integer keys of MingaEditor.State.TabBar's tab map. nil is valid while completion-trigger work starts before a tab is available.
@type t() :: %MingaEditor.State.ModalOverlay.Completion{ completion: completion_or_nil(), opened_at: integer(), owner: owner(), presentation_generation: pos_integer(), trigger: MingaEditor.CompletionTrigger.t() }
Functions
Builds a completion payload bound to owner (typically a tab id).
Pass :completion to seed an already-resolved completion menu, or
omit to open a payload that just tracks the trigger lifecycle while
an LSP request is in flight.
@spec presentation_generation(t()) :: pos_integer()
Returns the opaque generation of this completion presentation lifecycle.
@spec put_completion(t(), completion_or_nil()) :: t()
Replaces the inner Completion.t() on the payload while preserving lifecycle ownership.
Automatic ranking, filtering, and resolve updates use this transition. They must not turn the current default into a user-owned selection.
@spec put_trigger(t(), MingaEditor.CompletionTrigger.t()) :: t()
Replaces the inner trigger on the payload. The only sanctioned way to update the trigger from outside this module.