mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 10:12:34 -05:00
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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user