From 7fcc44cd1976a83d3e72fe55ed1b3a791bb5e06b Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 16 Mar 2020 15:50:19 -0400 Subject: [PATCH] Updates view progress proposal - #92421 --- src/vs/platform/progress/common/progress.ts | 3 +-- src/vs/vscode.d.ts | 2 +- src/vs/vscode.proposed.d.ts | 19 ------------------- .../workbench/api/common/extHost.api.impl.ts | 2 +- .../workbench/api/common/extHostProgress.ts | 4 ++-- .../api/common/extHostTypeConverters.ts | 7 +++++-- src/vs/workbench/api/common/extHostTypes.ts | 3 +-- 7 files changed, 11 insertions(+), 29 deletions(-) diff --git a/src/vs/platform/progress/common/progress.ts b/src/vs/platform/progress/common/progress.ts index 5fa930eabfba8..b6ff5e5057b9d 100644 --- a/src/vs/platform/progress/common/progress.ts +++ b/src/vs/platform/progress/common/progress.ts @@ -45,8 +45,7 @@ export const enum ProgressLocation { Extensions = 5, Window = 10, Notification = 15, - Dialog = 20, - View = 25 + Dialog = 20 } export interface IProgressOptions { diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 4b26a5e6ebb59..c5b6fe3f2ddd3 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -7932,7 +7932,7 @@ declare module 'vscode' { /** * The location at which progress should show. */ - location: ProgressLocation; + location: ProgressLocation | { viewId: string }; /** * A human-readable string which will be used to describe the diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 426f7fc6f42ff..7a413553ad77f 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1891,23 +1891,4 @@ declare module 'vscode' { //#endregion - //#region https://github.com/microsoft/vscode/issues/92421 - - export enum ProgressLocation { - /** - * Show progress for a view, as progress bar inside the view (when visible), - * and as an overlay on the activity bar icon. Doesn't support cancellation or discrete progress. - */ - View = 25, - } - - export interface ProgressOptions { - /** - * The target view identifier for showing progress when using [ProgressLocation.View](#ProgressLocation.View). - */ - viewId?: string - } - - //#endregion - } diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index d8d58647f096d..89663f4f22a1d 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -540,7 +540,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I return extHostProgress.withProgress(extension, { location: extHostTypes.ProgressLocation.SourceControl }, (progress, token) => task({ report(n: number) { /*noop*/ } })); }, withProgress(options: vscode.ProgressOptions, task: (progress: vscode.Progress<{ message?: string; worked?: number }>, token: vscode.CancellationToken) => Thenable) { - if (options.location === extHostTypes.ProgressLocation.View) { + if (typeof options.location !== 'number') { checkProposedApiEnabled(extension); } return extHostProgress.withProgress(extension, options, task); diff --git a/src/vs/workbench/api/common/extHostProgress.ts b/src/vs/workbench/api/common/extHostProgress.ts index ef5e614e5b98b..5db3edf086217 100644 --- a/src/vs/workbench/api/common/extHostProgress.ts +++ b/src/vs/workbench/api/common/extHostProgress.ts @@ -24,10 +24,10 @@ export class ExtHostProgress implements ExtHostProgressShape { withProgress(extension: IExtensionDescription, options: ProgressOptions, task: (progress: Progress, token: CancellationToken) => Thenable): Thenable { const handle = this._handles++; - const { title, location, cancellable, viewId } = options; + const { title, location, cancellable } = options; const source = localize('extensionSource', "{0} (Extension)", extension.displayName || extension.name); - this._proxy.$startProgress(handle, { location: ProgressLocation.from(location, viewId), title, source, cancellable }, extension); + this._proxy.$startProgress(handle, { location: ProgressLocation.from(location), title, source, cancellable }, extension); return this._withProgress(handle, task, !!cancellable); } diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index e443f9335d7f8..0a0034e0b441a 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -1093,12 +1093,15 @@ export namespace EndOfLine { } export namespace ProgressLocation { - export function from(loc: vscode.ProgressLocation, viewId?: string): MainProgressLocation | string { + export function from(loc: vscode.ProgressLocation | { viewId: string }): MainProgressLocation | string { + if (typeof loc === 'string') { + return loc; + } + switch (loc) { case types.ProgressLocation.SourceControl: return MainProgressLocation.Scm; case types.ProgressLocation.Window: return MainProgressLocation.Window; case types.ProgressLocation.Notification: return MainProgressLocation.Notification; - case types.ProgressLocation.View: return viewId ?? ''; } throw new Error(`Unknown 'ProgressLocation'`); } diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index e89ded47b5f98..1dac637a08ff8 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -2082,8 +2082,7 @@ export class Task implements vscode.Task2 { export enum ProgressLocation { SourceControl = 1, Window = 10, - Notification = 15, - View = 25 + Notification = 15 } @es5ClassCompat