Use more reliable signal for ts project load complete

`telemetry` is not fired for implicit projects, while `projectsUpdatedInBackground` should always be fired. Gating this to 3.0 since I believe the event was only added recently
This commit is contained in:
Matt Bierner
2018-09-18 16:50:45 -07:00
parent d1dbe4d53c
commit 565c88f4fd

View File

@@ -319,12 +319,14 @@ export default class TypeScriptServiceClient extends Disposable implements IType
if (this._tsServerLoading) {
this._tsServerLoading.reject();
}
vscode.window.withProgress({
location: vscode.ProgressLocation.Window,
title: localize('serverLoading.progress', "Initializing JS/TS language features"),
}, () => new Promise((resolve, reject) => {
this._tsServerLoading = { resolve, reject };
}));
if (this._apiVersion.gte(API.v300)) {
vscode.window.withProgress({
location: vscode.ProgressLocation.Window,
title: localize('serverLoading.progress', "Initializing JS/TS language features"),
}, () => new Promise((resolve, reject) => {
this._tsServerLoading = { resolve, reject };
}));
}
this.serviceStarted(resendModels);
@@ -613,13 +615,6 @@ export default class TypeScriptServiceClient extends Disposable implements IType
case 'telemetry':
const telemetryData = (event as Proto.TelemetryEvent).body;
this.dispatchTelemetryEvent(telemetryData);
// This event also roughly signals that project has been loaded successfully
if (this._tsServerLoading) {
this._tsServerLoading.resolve();
this._tsServerLoading = undefined;
}
break;
case 'projectLanguageServiceState':
@@ -634,6 +629,12 @@ 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':