* Stops the LSP server gracefully. * * If already stopped or stopping, returns immediately. * On failure, sets state to 'error', logs for monitoring, and throws. * * @throws {Error} If server fails to stop
()
| 272 | * @throws {Error} If server fails to stop |
| 273 | */ |
| 274 | async function stop(): Promise<void> { |
| 275 | if (state === 'stopped' || state === 'stopping') { |
| 276 | return |
| 277 | } |
| 278 | |
| 279 | try { |
| 280 | state = 'stopping' |
| 281 | await client.stop() |
| 282 | state = 'stopped' |
| 283 | logForDebugging(`LSP server instance stopped: ${name}`) |
| 284 | } catch (error) { |
| 285 | state = 'error' |
| 286 | lastError = error as Error |
| 287 | logError(error) |
| 288 | throw error |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * Manually restarts the server by stopping and starting it. |
no test coverage detected