mirror of
https://github.com/coder/code-server.git
synced 2026-05-10 14:27:26 +02:00
chore(vscode): update to 1.55.2
This commit is contained in:
@@ -7,6 +7,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
|
||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { toDisposable, DisposableStore, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { DeferredPromise } from 'vs/base/common/async';
|
||||
|
||||
export const IProgressService = createDecorator<IProgressService>('progressService');
|
||||
|
||||
@@ -51,7 +52,7 @@ export const enum ProgressLocation {
|
||||
export interface IProgressOptions {
|
||||
readonly location: ProgressLocation | string;
|
||||
readonly title?: string;
|
||||
readonly source?: string;
|
||||
readonly source?: string | { label: string; id: string; };
|
||||
readonly total?: number;
|
||||
readonly cancellable?: boolean;
|
||||
readonly buttons?: string[];
|
||||
@@ -123,6 +124,42 @@ export interface IOperation {
|
||||
stop(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* RAII-style progress instance that allows imperative reporting and hides
|
||||
* once `dispose()` is called.
|
||||
*/
|
||||
export class UnmanagedProgress extends Disposable {
|
||||
private readonly deferred = new DeferredPromise<void>();
|
||||
private reporter?: IProgress<IProgressStep>;
|
||||
private lastStep?: IProgressStep;
|
||||
|
||||
constructor(
|
||||
options: IProgressOptions | IProgressNotificationOptions | IProgressWindowOptions | IProgressCompositeOptions,
|
||||
@IProgressService progressService: IProgressService,
|
||||
) {
|
||||
super();
|
||||
progressService.withProgress(options, reporter => {
|
||||
this.reporter = reporter;
|
||||
if (this.lastStep) {
|
||||
reporter.report(this.lastStep);
|
||||
}
|
||||
|
||||
return this.deferred.p;
|
||||
});
|
||||
|
||||
this._register(toDisposable(() => this.deferred.complete()));
|
||||
}
|
||||
|
||||
report(step: IProgressStep) {
|
||||
if (this.reporter) {
|
||||
this.reporter.report(step);
|
||||
} else {
|
||||
this.lastStep = step;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class LongRunningOperation extends Disposable {
|
||||
private currentOperationId = 0;
|
||||
private readonly currentOperationDisposables = this._register(new DisposableStore());
|
||||
|
||||
Reference in New Issue
Block a user