Skip to content

Commit 43df36e

Browse files
authored
Merge pull request #148 from glennsarti/fix-session-restart
(maint) Fix Connection Restart
2 parents 7e18fed + 6fe75a3 commit 43df36e

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

client/src/connection.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,6 @@ export class ConnectionManager implements IConnectionManager {
120120
public stop() {
121121
this.logger.debug('Stopping...')
122122

123-
if (this.connectionStatus === ConnectionStatus.Failed) {
124-
this.languageServerClient = undefined;
125-
this.languageServerProcess = undefined;
126-
}
127-
128123
this.connectionStatus = ConnectionStatus.Stopping;
129124

130125
// Close the language server client
@@ -133,14 +128,11 @@ export class ConnectionManager implements IConnectionManager {
133128
this.languageServerClient = undefined;
134129
}
135130

136-
// Kill the language server process we spawned
137-
if (this.languageServerProcess !== undefined) {
138-
// Terminate Language Server process
139-
// TODO: May not be functional on Windows.
140-
// Perhaps send the exit command and wait for process to exit?
141-
this.languageServerProcess.kill();
142-
this.languageServerProcess = undefined;
143-
}
131+
// The language server process we spawn will close once the
132+
// client disconnects. No need to forcibly kill the process here. Also the language
133+
// client will try and send a shutdown event, which will throw errors if the language
134+
// client can no longer transmit the message.
135+
this.languageServerProcess = undefined;
144136

145137
this.connectionStatus = ConnectionStatus.NotStarted;
146138

0 commit comments

Comments
 (0)