Skip to content

Commit 3c29170

Browse files
committed
feat: add disconnect handler
1 parent a40e8b5 commit 3c29170

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/auto-languageclient.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ export default class AutoLanguageClient {
383383
private captureServerErrors(lsProcess: LanguageServerProcess, projectPath: string): void {
384384
lsProcess.on('error', (err) => this.onSpawnError(err));
385385
lsProcess.on("close", (code, signal) => this.onSpawnClose(code, signal));
386+
lsProcess.on("disconnect", () => this.onSpawnDisconnect());
386387
lsProcess.on('exit', (code, signal) => this.onSpawnExit(code, signal));
387388
lsProcess.stderr?.setEncoding('utf8');
388389
lsProcess.stderr?.on('data', (chunk: Buffer) => this.onSpawnStdErrData(chunk, projectPath));
@@ -412,6 +413,12 @@ export default class AutoLanguageClient {
412413
}
413414
}
414415

416+
/** The function called whenever the spawned server `disconnect`s.
417+
* Extend (call super.onSpawnDisconnect) or override this if you need custom disconnect handling
418+
*/
419+
protected onSpawnDisconnect(): void {
420+
this.logger.debug(`${this.getServerName()} language server for ${this.getLanguageName()} got disconnected.`);
421+
}
415422

416423
/** The function called whenever the spawned server `exit`s.
417424
* Extend (call super.onSpawnExit) or override this if you need custom exit handling

0 commit comments

Comments
 (0)