Skip to content

lspeasy / server/src / NotificationHandler

Type Alias: NotificationHandler<Params> ​

ts
type NotificationHandler<Params> = (params, context) => void | Promise<void>;

Defined in: packages/server/src/types.ts:230

Signature for LSP notification handlers registered via LSPServer.onNotification.

Type Parameters ​

Type ParameterDefault typeDescription
ParamsunknownThe notification params type, inferred from method name.

Parameters ​

ParameterType
paramsParams
contextNotificationContext

Returns ​

void | Promise<void>

Remarks ​

Notifications are fire-and-forget — the framework does not wait for the returned promise in any protocol-observable way, but unhandled rejections are forwarded to server.onError().

Never ​

NEVER send a server-to-client notification inside a handler for the LSP initialize request. The initialize response has not yet been sent at that point; notifications sent before the response are discarded by clients. Use the initialized notification handler for post-handshake setup instead.

Released under the MIT License.