diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index fae45d555b4..19786714a21 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -3266,6 +3266,18 @@ declare module 'vscode' { dispose(): void; } + /** + * Defines a generalized way of reporting progress updates. + */ + export interface Progress { + + /** + * Report a progress update. + * @param value A progress item, like a message or an updated percentage value + */ + report(value: T): void + } + /** * An individual terminal instance within the integrated terminal. */ @@ -3844,6 +3856,17 @@ declare module 'vscode' { */ export function setStatusBarMessage(text: string): Disposable; + /** + * Show progress in the scm viewlet while running the given callback and while its returned + * promise isn't resolve or rejected. + * + * @param task A callback returning a promise. Progress increments can be reported with + * the provided [progress](#Progress)-object. + * @return The thenable the task did return. + */ + export function withScmProgress(task: (progress: Progress) => Thenable): Thenable; + + /** * Creates a status bar [item](#StatusBarItem). * diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index a0dc373f265..18b78038d50 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -7,18 +7,6 @@ declare module 'vscode' { - /** - * Defines a generalized way of reporing progress updates. - */ - export interface Progress { - - /** - * Report a progress update. - * @param value A progress item, like a message or an updated percentage value - */ - report(value: T): void - } - /** * Defines a problem pattern */ @@ -505,8 +493,6 @@ declare module 'vscode' { */ export function withWindowProgress(title: string, task: (progress: Progress, token: CancellationToken) => Thenable): Thenable; - export function withScmProgress(task: (progress: Progress) => Thenable): Thenable; - export function sampleFunction(): Thenable; } @@ -661,4 +647,4 @@ declare module 'vscode' { */ onData(callback: (data: string) => any): void; } -} \ No newline at end of file +} diff --git a/src/vs/workbench/api/node/extHostProgress.ts b/src/vs/workbench/api/node/extHostProgress.ts index 3d0b2b42e1a..237aae60d30 100644 --- a/src/vs/workbench/api/node/extHostProgress.ts +++ b/src/vs/workbench/api/node/extHostProgress.ts @@ -46,12 +46,7 @@ export class ExtHostProgress { throw err; } - return p.then(result => { - this._proxy.$progressEnd(handle); - return result; - }, err => { - this._proxy.$progressEnd(handle); - throw err; - }); + p.then(result => this._proxy.$progressEnd(handle), err => this._proxy.$progressEnd(handle)); + return p; } }