Skip to main content

Module features

Module features 

Source
Expand description

Typed wrappers around crate::ServerHandle::request_with_cancel for the LSP navigation features (DESIGN.md §5.4 + Phase 4.2).

Each method is a thin shim: build the typed *Params, call request_with_cancel(method_name, params, token), return a Pending<R> over the typed response. The wire formats live in lsp-types (textDocument/hover ↔ [Hover], etc.); the wrappers exist so call sites don’t sprinkle method-name strings and so cancellation is impossible to forget.

Cancellation discipline. Every wrapper takes a [lattice_protocol::CancellationToken]. The App passes a fresh token per request and flips it on motion / Esc / mode change so a stale response from a slow server can’t drop a popup over the user’s new cursor position. Local-only cancellation today (the server keeps computing; we drop its reply on arrival) – wire- level $/cancelRequest is a Phase 4.2 polish item.

Multi-server merge. Wrappers run per-server. The App’s per-feature dispatcher fires the same wrapper across every server attached to the buffer and merges according to the per-feature strategy (hover: concat with --- name --- sep; definition / references: concat + dedup by URI+range; symbols: concat; completion: concat + dedup by text).