mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 18:19:12 +01:00
Handle typesInstallerInitializationFailed events (#23876)
* Handle typesInstallerInitializationFailed Display a warning message when the ts typings installer fails to initilize. One possible cause is that npm is not installed * Fix a spell
This commit is contained in:
@@ -74,6 +74,7 @@ export interface ITypescriptServiceClient {
|
||||
onProjectLanguageServiceStateChanged: Event<Proto.ProjectLanguageServiceStateEventBody>;
|
||||
onDidBeginInstallTypings: Event<Proto.BeginInstallTypesEventBody>;
|
||||
onDidEndInstallTypings: Event<Proto.EndInstallTypesEventBody>;
|
||||
onTypesInstallerInitializationFailed: Event<Proto.TypesInstallerInitializationFailedEventBody>;
|
||||
|
||||
logTelemetry(eventName: string, properties?: { [prop: string]: string }): void;
|
||||
|
||||
|
||||
@@ -160,6 +160,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
||||
private _onProjectLanguageServiceStateChanged = new EventEmitter<Proto.ProjectLanguageServiceStateEventBody>();
|
||||
private _onDidBeginInstallTypings = new EventEmitter<Proto.BeginInstallTypesEventBody>();
|
||||
private _onDidEndInstallTypings = new EventEmitter<Proto.EndInstallTypesEventBody>();
|
||||
private _onTypesInstallerInitializationFailed = new EventEmitter<Proto.TypesInstallerInitializationFailedEventBody>();
|
||||
|
||||
private _packageInfo: IPackageInfo | null;
|
||||
private _apiVersion: API;
|
||||
@@ -265,6 +266,10 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
||||
return this._onDidEndInstallTypings.event;
|
||||
}
|
||||
|
||||
get onTypesInstallerInitializationFailed(): Event<Proto.TypesInstallerInitializationFailedEventBody> {
|
||||
return this._onTypesInstallerInitializationFailed.event;
|
||||
}
|
||||
|
||||
private get output(): OutputChannel {
|
||||
if (!this._output) {
|
||||
this._output = window.createOutputChannel(localize('channelName', 'TypeScript'));
|
||||
@@ -1017,6 +1022,11 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
||||
if (data) {
|
||||
this._onDidEndInstallTypings.fire(data);
|
||||
}
|
||||
} else if (event.event === 'typesInstallerInitializationFailed') {
|
||||
const data = (event as Proto.TypesInstallerInitializationFailedEvent).body;
|
||||
if (data) {
|
||||
this._onTypesInstallerInitializationFailed.fire(data);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new Error('Unknown message type ' + message.type + ' recevied');
|
||||
|
||||
@@ -68,8 +68,8 @@ export class AtaProgressReporter {
|
||||
constructor(client: ITypescriptServiceClient) {
|
||||
this._disposable = vscode.Disposable.from(
|
||||
client.onDidBeginInstallTypings(e => this._onBegin(e.eventId)),
|
||||
client.onDidEndInstallTypings(e => this._onEndOrTimeout(e.eventId))
|
||||
);
|
||||
client.onDidEndInstallTypings(e => this._onEndOrTimeout(e.eventId)),
|
||||
client.onTypesInstallerInitializationFailed(_ => this.onTypesInstallerInitializationFailed()));
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
@@ -96,4 +96,8 @@ export class AtaProgressReporter {
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
|
||||
private onTypesInstallerInitializationFailed() {
|
||||
vscode.window.showWarningMessage(localize('typesInstallerInitializationFailed', "Could not install typings files for JS/TS language features. Please ensure that NPM is installed"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user