diff --git a/extensions/typescript-language-features/src/typescriptServiceClient.ts b/extensions/typescript-language-features/src/typescriptServiceClient.ts index b5fdb185101..d8ed0b2b284 100644 --- a/extensions/typescript-language-features/src/typescriptServiceClient.ts +++ b/extensions/typescript-language-features/src/typescriptServiceClient.ts @@ -125,7 +125,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType private _isPromptingAfterCrash = false; private isRestarting: boolean = false; private hasServerFatallyCrashedTooManyTimes = false; - private readonly loadingIndicator = this._register(new ServerInitializingIndicator()); + private readonly loadingIndicator: ServerInitializingIndicator; public readonly telemetryReporter: TelemetryReporter; public readonly bufferSyncSupport: BufferSyncSupport; @@ -158,6 +158,8 @@ export default class TypeScriptServiceClient extends Disposable implements IType ) { super(); + this.loadingIndicator = this._register(new ServerInitializingIndicator(this)); + this.logger = services.logger; this.tracer = new Tracer(this.logger); @@ -1254,6 +1256,12 @@ class ServerInitializingIndicator extends Disposable { private _task?: { project: string; resolve: () => void }; + constructor( + private readonly client: ITypeScriptServiceClient, + ) { + super(); + } + public reset(): void { if (this._task) { this._task.resolve(); @@ -1269,15 +1277,28 @@ class ServerInitializingIndicator extends Disposable { // the incoming project loading task is. this.reset(); - const projectDisplayName = vscode.workspace.asRelativePath(projectName); + const projectDisplayName = this.getProjectDisplayName(projectName); + vscode.window.withProgress({ location: vscode.ProgressLocation.Window, - title: vscode.l10n.t("Initializing project '{0}'", projectDisplayName), + title: vscode.l10n.t("Initializing '{0}'", projectDisplayName), }, () => new Promise(resolve => { this._task = { project: projectName, resolve }; })); } + private getProjectDisplayName(projectName: string): string { + const projectUri = this.client.toResource(projectName); + const relPath = vscode.workspace.asRelativePath(projectUri); + + const maxDisplayLength = 60; + if (relPath.length > maxDisplayLength) { + return '...' + relPath.slice(-maxDisplayLength); + } + + return relPath; + } + public startedLoadingFile(fileName: string, task: Promise): void { if (!this._task) { vscode.window.withProgress({