Merge from vscode 81d7885dc2e9dc617e1522697a2966bc4025a45d (#5949)

* Merge from vscode 81d7885dc2e9dc617e1522697a2966bc4025a45d

* Fix vs unit tests and hygiene issue

* Fix strict null check issue
This commit is contained in:
Chris LaFreniere
2019-06-10 18:27:09 -07:00
committed by GitHub
parent ff38bc8143
commit d15a3fcc98
926 changed files with 19529 additions and 11383 deletions

View File

@@ -3,15 +3,32 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
import { IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
import { IAction } from 'vs/base/common/actions';
export const IProgressService = createDecorator<IProgressService>('progressService');
/**
* A progress service that can be used to report progress to various locations of the UI.
*/
export interface IProgressService {
_serviceBrand: any;
_serviceBrand: ServiceIdentifier<IProgressService>;
withProgress<R = any>(options: IProgressOptions | IProgressNotificationOptions | IProgressCompositeOptions, task: (progress: IProgress<IProgressStep>) => Promise<R>, onDidCancel?: () => void): Promise<R>;
}
export const ILocalProgressService = createDecorator<ILocalProgressService>('localProgressService');
/**
* A progress service that will report progress local to the UI piece triggered from. E.g.
* if used from an action of a viewlet, the progress will be reported in that viewlet.
*/
export interface ILocalProgressService {
_serviceBrand: ServiceIdentifier<ILocalProgressService>;
/**
* Show progress customized with the provided flags.
@@ -44,9 +61,14 @@ export interface IProgressOptions {
}
export interface IProgressNotificationOptions extends IProgressOptions {
location: ProgressLocation.Notification;
primaryActions?: IAction[];
secondaryActions?: IAction[];
readonly location: ProgressLocation.Notification;
readonly primaryActions?: ReadonlyArray<IAction>;
readonly secondaryActions?: ReadonlyArray<IAction>;
}
export interface IProgressCompositeOptions extends IProgressOptions {
location: ProgressLocation.Explorer | ProgressLocation.Extensions | ProgressLocation.Scm | string;
delay?: number;
}
export interface IProgressStep {
@@ -54,15 +76,6 @@ export interface IProgressStep {
increment?: number;
}
export const IProgressService2 = createDecorator<IProgressService2>('progressService2');
export interface IProgressService2 {
_serviceBrand: any;
withProgress<R = any>(options: IProgressOptions, task: (progress: IProgress<IProgressStep>) => Promise<R>, onDidCancel?: () => void): Promise<R>;
}
export interface IProgressRunner {
total(value: number): void;
worked(value: number): void;
@@ -118,7 +131,7 @@ export class LongRunningOperation {
private currentProgressTimeout: any;
constructor(
private progressService: IProgressService
private localProgressService: ILocalProgressService
) { }
start(progressDelay: number): IOperation {
@@ -131,7 +144,7 @@ export class LongRunningOperation {
const newOperationToken = new CancellationTokenSource();
this.currentProgressTimeout = setTimeout(() => {
if (newOperationId === this.currentOperationId) {
this.currentProgressRunner = this.progressService.show(true);
this.currentProgressRunner = this.localProgressService.show(true);
}
}, progressDelay);