lspeasy / server/src / NotificationHandler
Type Alias: NotificationHandler<Params>
ts
type NotificationHandler<Params> = (params, context) => void | Promise<void>;Defined in: packages/server/src/types.ts:202
Signature for LSP notification handlers registered via LSPServer.onNotification.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
Params | unknown | The notification params type, inferred from method name. |
Parameters
| Parameter | Type |
|---|---|
params | Params |
context | NotificationContext |
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.