Skip to content

Commit

Permalink
feat(language-client): fix hang when server crashed during shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
fannheyward committed Jan 5, 2021
1 parent 353b9e1 commit 7648463
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/language-client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3925,10 +3925,7 @@ export abstract class BaseLanguageClient {

protected handleConnectionClosed() {
// Check whether this is a normal shutdown in progress or the client stopped normally.
if (
this.state === ClientState.Stopping ||
this.state === ClientState.Stopped
) {
if (this.state === ClientState.Stopped) {
return
}
try {
Expand All @@ -3939,10 +3936,12 @@ export abstract class BaseLanguageClient {
// Disposing a connection could fail if error cases.
}
let action = CloseAction.DoNotRestart
try {
action = this._clientOptions.errorHandler!.closed()
} catch (error) {
// Ignore errors coming from the error handler.
if (this.state !== ClientState.Stopping) {
try {
action = this._clientOptions.errorHandler!.closed();
} catch (error) {
// Ignore errors coming from the error handler.
}
}
this._connectionPromise = undefined
this._resolvedConnection = undefined
Expand Down Expand Up @@ -4140,7 +4139,7 @@ export abstract class BaseLanguageClient {

const generalCapabilities = ensure(result, 'general')!;
generalCapabilities.regularExpressions = { engine: 'ECMAScript', version: 'ES2020' };
generalCapabilities.markdown = { parser: 'marked', version: '1.1.0'};
generalCapabilities.markdown = { parser: 'marked', version: '1.1.0' };

for (let feature of this._features) {
feature.fillClientCapabilities(result)
Expand Down

0 comments on commit 7648463

Please sign in to comment.