lspeasy / core/src / executeMiddlewarePipeline
Function: executeMiddlewarePipeline()
function executeMiddlewarePipeline(
registrations,
context,
finalHandler): Promise<void | MiddlewareResult>;Defined in: packages/core/src/middleware/pipeline.ts:64
Runs the registered middleware chain for a single JSON-RPC message, then calls finalHandler if no middleware short-circuits.
Parameters
| Parameter | Type | Description |
|---|---|---|
registrations | MiddlewareRegistration[] | undefined | The list of middleware or scoped-middleware to run. |
context | MiddlewareContext | The shared context for the current message. |
finalHandler | () => Promise<void | MiddlewareResult> | The handler to call after all middleware have run. |
Returns
Promise<void | MiddlewareResult>
The result of the first short-circuiting middleware, or the result of finalHandler.
Remarks
This is the core dispatch loop used by LSPClient and LSPServer. Each middleware receives context and a next callback; calling next() hands control to the following middleware. If a middleware returns a result with shortCircuit: true the remaining middleware and finalHandler are skipped.
Scoped middleware (created with createScopedMiddleware) is automatically filtered: it only executes when matchesFilter returns true for the current message.