MCPcopy
hub / github.com/microsoft/vscode-languageserver-node / handleConnectionClosed

Function handleConnectionClosed

client/src/client.ts:2767–2797  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2765 }
2766
2767 protected handleConnectionClosed() {
2768 // Check whether this is a normal shutdown in progress or the client stopped normally.
2769 if (this.state === ClientState.Stopping || this.state === ClientState.Stopped) {
2770 return;
2771 }
2772 try {
2773 if (this._resolvedConnection) {
2774 this._resolvedConnection.dispose();
2775 }
2776 } catch (error) {
2777 // Disposing a connection could fail if error cases.
2778 }
2779 let action = CloseAction.DoNotRestart;
2780 try {
2781 action = this._clientOptions.errorHandler!.closed();
2782 } catch (error) {
2783 // Ignore errors coming from the error handler.
2784 }
2785 this._connectionPromise = undefined;
2786 this._resolvedConnection = undefined;
2787 if (action === CloseAction.DoNotRestart) {
2788 this.error('Connection to server got closed. Server will not be restarted.');
2789 this.state = ClientState.Stopped;
2790 this.cleanUp(false);
2791 } else if (action === CloseAction.Restart) {
2792 this.info('Connection to server got closed. Server will restart.');
2793 this.cleanUp(true);
2794 this.state = ClientState.Initial;
2795 this.start();
2796 }
2797 }
2798
2799 private handleConnectionError(error: Error, message: Message, count: number) {
2800 let action = this._clientOptions.errorHandler!.error(error, message, count);

Callers

nothing calls this directly

Calls 5

startMethod · 0.80
disposeMethod · 0.65
closedMethod · 0.65
errorMethod · 0.65
infoMethod · 0.65

Tested by

no test coverage detected