mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
Updates view progress proposal - #92421
This commit is contained in:
@@ -45,8 +45,7 @@ export const enum ProgressLocation {
|
|||||||
Extensions = 5,
|
Extensions = 5,
|
||||||
Window = 10,
|
Window = 10,
|
||||||
Notification = 15,
|
Notification = 15,
|
||||||
Dialog = 20,
|
Dialog = 20
|
||||||
View = 25
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IProgressOptions {
|
export interface IProgressOptions {
|
||||||
|
|||||||
Vendored
+1
-1
@@ -7932,7 +7932,7 @@ declare module 'vscode' {
|
|||||||
/**
|
/**
|
||||||
* The location at which progress should show.
|
* The location at which progress should show.
|
||||||
*/
|
*/
|
||||||
location: ProgressLocation;
|
location: ProgressLocation | { viewId: string };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A human-readable string which will be used to describe the
|
* A human-readable string which will be used to describe the
|
||||||
|
|||||||
Vendored
-19
@@ -1891,23 +1891,4 @@ declare module 'vscode' {
|
|||||||
|
|
||||||
//#endregion
|
//#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
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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*/ } }));
|
return extHostProgress.withProgress(extension, { location: extHostTypes.ProgressLocation.SourceControl }, (progress, token) => task({ report(n: number) { /*noop*/ } }));
|
||||||
},
|
},
|
||||||
withProgress<R>(options: vscode.ProgressOptions, task: (progress: vscode.Progress<{ message?: string; worked?: number }>, token: vscode.CancellationToken) => Thenable<R>) {
|
withProgress<R>(options: vscode.ProgressOptions, task: (progress: vscode.Progress<{ message?: string; worked?: number }>, token: vscode.CancellationToken) => Thenable<R>) {
|
||||||
if (options.location === extHostTypes.ProgressLocation.View) {
|
if (typeof options.location !== 'number') {
|
||||||
checkProposedApiEnabled(extension);
|
checkProposedApiEnabled(extension);
|
||||||
}
|
}
|
||||||
return extHostProgress.withProgress(extension, options, task);
|
return extHostProgress.withProgress(extension, options, task);
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ export class ExtHostProgress implements ExtHostProgressShape {
|
|||||||
|
|
||||||
withProgress<R>(extension: IExtensionDescription, options: ProgressOptions, task: (progress: Progress<IProgressStep>, token: CancellationToken) => Thenable<R>): Thenable<R> {
|
withProgress<R>(extension: IExtensionDescription, options: ProgressOptions, task: (progress: Progress<IProgressStep>, token: CancellationToken) => Thenable<R>): Thenable<R> {
|
||||||
const handle = this._handles++;
|
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);
|
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);
|
return this._withProgress(handle, task, !!cancellable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1093,12 +1093,15 @@ export namespace EndOfLine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export namespace ProgressLocation {
|
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) {
|
switch (loc) {
|
||||||
case types.ProgressLocation.SourceControl: return MainProgressLocation.Scm;
|
case types.ProgressLocation.SourceControl: return MainProgressLocation.Scm;
|
||||||
case types.ProgressLocation.Window: return MainProgressLocation.Window;
|
case types.ProgressLocation.Window: return MainProgressLocation.Window;
|
||||||
case types.ProgressLocation.Notification: return MainProgressLocation.Notification;
|
case types.ProgressLocation.Notification: return MainProgressLocation.Notification;
|
||||||
case types.ProgressLocation.View: return viewId ?? '';
|
|
||||||
}
|
}
|
||||||
throw new Error(`Unknown 'ProgressLocation'`);
|
throw new Error(`Unknown 'ProgressLocation'`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2082,8 +2082,7 @@ export class Task implements vscode.Task2 {
|
|||||||
export enum ProgressLocation {
|
export enum ProgressLocation {
|
||||||
SourceControl = 1,
|
SourceControl = 1,
|
||||||
Window = 10,
|
Window = 10,
|
||||||
Notification = 15,
|
Notification = 15
|
||||||
View = 25
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@es5ClassCompat
|
@es5ClassCompat
|
||||||
|
|||||||
Reference in New Issue
Block a user