* Send a notification to the LSP server (fire-and-forget). * Used for file synchronization (didOpen, didChange, didClose).
(
method: string,
params: unknown,
)
| 414 | * Used for file synchronization (didOpen, didChange, didClose). |
| 415 | */ |
| 416 | async function sendNotification( |
| 417 | method: string, |
| 418 | params: unknown, |
| 419 | ): Promise<void> { |
| 420 | if (!isHealthy()) { |
| 421 | const error = new Error( |
| 422 | `Cannot send notification to LSP server '${name}': server is ${state}`, |
| 423 | ) |
| 424 | logError(error) |
| 425 | throw error |
| 426 | } |
| 427 | |
| 428 | try { |
| 429 | await client.sendNotification(method, params) |
| 430 | } catch (error) { |
| 431 | const notificationError = new Error( |
| 432 | `LSP notification '${method}' failed for server '${name}': ${errorMessage(error)}`, |
| 433 | ) |
| 434 | logError(notificationError) |
| 435 | throw notificationError |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | /** |
| 440 | * Registers a handler for LSP notifications from the server. |
nothing calls this directly
no test coverage detected