Expand description
LSP completion source (CSM.8a / CSM.8b).
LspCompletionSource is the AsyncCompletionSource impl
that the lsp-completion-mode contributes. It owns an
LspSupervisorHandle and is wired into the
ActiveCompletionSources cache via the mode’s
completion_sources() contribution. The source’s
produce_async future fans out across attached servers,
dedupes by (label, kind), and pushes one RawCandidate
per item into the supplied [CandidateSink]. Each
candidate carries an CandidateData::Extension payload
whose bytes are a JSON-encoded LspCompletionMeta; the
host decodes the payload at accept / docs / commit-char
time via decode_meta.
Structs§
- LspCompletion
Meta - LSP-sourced insert-completion candidate metadata. Carried
inside the
RawCandidate’sCandidateData::Extensionpayload as a JSON blob (seeencode_meta/decode_meta). Replaces the pre-CSM.8b host-side sidecar – the candidate IS the metadata; the host decodes on demand. - LspCompletion
Mode lsp-completion-mode– LSP-driven insert-mode completion (CSM.8a). M.6.0 declared it as a marker minor; CSM.8a makes it source-contributing. Holds theLspSupervisorHandleso the contributed source can fan out to attached servers.popup_filter_chord = Some('o')⇒<C-o>insidecompletion-popup-modenarrows the popup to LSP only (CSM.K2).- LspCompletion
Source - CSM.8a stub. Holds the supervisor handle so CSM.8b can move
the fan-out into
produce_asyncwithout changing the mode’s public surface. Today the future is a no-op.
Constants§
- LSP_
COMPLETION_ KIND_ ID Extension::kind_iddiscriminant for LSP-sourced candidates. Values 0-99 reserved for first-party host data (snippet uses 2); plugins use 1000+. The host’s decoder checks this id before attemptingdecode_meta.
Functions§
- decode_
meta - Decode a payload produced by
encode_meta. ReturnsNonewhen the bytes don’t deserialise asLspCompletionMeta– the candidate’skind_idmay not be ours (plugin source colliding on the kind, or a stray payload), or the wire format may have drifted across versions. - encode_
meta - Encode
metato a JSON byte blob suitable for embedding in aRawCandidate’sCandidateData::Extension::payload. Errors are caller-handled by panicking in the source’s produce path – a serialize failure on lsp-types output indicates a malformed item, which the supervisor should have rejected before we got here. - register_
lsp_ completion_ mode - Register
lsp-completion-modeagainstregistry. Called from the App’s boot path alongsidecrate::modes::register_lsp_log_modes; the supervisor handle is shared so source produce + host accept-path read the same data.