mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-12 09:50:11 -05:00
Use uris when resolving project loading indicator display (#233859)
Fixes #230009
This commit is contained in:
@@ -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<void>(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<unknown>): void {
|
||||
if (!this._task) {
|
||||
vscode.window.withProgress({
|
||||
|
||||
Reference in New Issue
Block a user