Skip to content

lspeasy / server/src / PartialResultSender

Class: PartialResultSender

Defined in: packages/server/src/progress/partial-result-sender.ts:28

Emits typed $/progress partial-result batches from server-side request handlers.

Remarks

Use PartialResultSender inside a RequestHandler when the client has supplied a partialResultToken (e.g. for textDocument/references or workspace/symbol). Call send(token, value) to stream result batches before returning the final response.

Use When

The client sets partialResultToken in the request params and you want to stream intermediate results (e.g. symbols found so far) rather than waiting for the complete set.

Never

NEVER call send after the handler has already returned a response — the $/progress notification will arrive after the client has closed the partial-result channel, and the client will silently discard or error on it.

NEVER send partial results without a partialResultToken — the client has no way to correlate the $/progress notification to the pending request.

Constructors

Constructor

ts
new PartialResultSender(server): PartialResultSender;

Defined in: packages/server/src/progress/partial-result-sender.ts:29

Parameters

ParameterType
serverBaseLSPServer

Returns

PartialResultSender

Methods

send()

ts
send<T>(token, value): Promise<void>;

Defined in: packages/server/src/progress/partial-result-sender.ts:37

Send a batch of partial results to the client.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
tokenProgressTokenThe partialResultToken from the originating request params.
valueTThe partial result batch to stream to the client via $/progress.

Returns

Promise<void>

Released under the MIT License.