Signal that TS Server has loaded succesfully when any error event is received

A successful error computation more or less signals that the server is ready and is more reliable than waiting for the projectUpdatedInBackground signal
This commit is contained in:
Matt Bierner 2018-09-27 11:59:17 -07:00
parent 5518b862e6
commit e20fdf9545

View file

@ -601,6 +601,12 @@ export default class TypeScriptServiceClient extends Disposable implements IType
case 'syntaxDiag':
case 'semanticDiag':
case 'suggestionDiag':
// This event also roughly signals that project has been loaded successfully
if (this._tsServerLoading) {
this._tsServerLoading.resolve();
this._tsServerLoading = undefined;
}
const diagnosticEvent: Proto.DiagnosticEvent = event;
if (diagnosticEvent.body && diagnosticEvent.body.diagnostics) {
this._onDiagnosticsReceived.fire({
@ -632,12 +638,6 @@ export default class TypeScriptServiceClient extends Disposable implements IType
const resources = body.openFiles.map(vscode.Uri.file);
this.bufferSyncSupport.getErr(resources);
}
// This event also roughly signals that project has been loaded successfully
if (this._tsServerLoading) {
this._tsServerLoading.resolve();
this._tsServerLoading = undefined;
}
break;
case 'beginInstallTypes':