diff --git a/src/vs/workbench/api/browser/mainThreadFileSystemEventService.ts b/src/vs/workbench/api/browser/mainThreadFileSystemEventService.ts index b6e0a210a3084e494f15ca607d52e9c54ec4227a..81905c6b1d0fb9aa4e9e406ef365c7d06ac25a1a 100644 --- a/src/vs/workbench/api/browser/mainThreadFileSystemEventService.ts +++ b/src/vs/workbench/api/browser/mainThreadFileSystemEventService.ts @@ -77,7 +77,7 @@ Registry.as(Extensions.Configuration).registerConfigurat properties: { 'files.participants.timeout': { type: 'number', - default: 5000, + default: 60000, markdownDescription: localize('files.participants.timeout', "Timeout in milliseconds after which file participants for create, rename, and delete are cancelled. Use `0` to disable participants."), } } diff --git a/src/vs/workbench/services/workingCopy/common/workingCopyFileOperationParticipant.ts b/src/vs/workbench/services/workingCopy/common/workingCopyFileOperationParticipant.ts index d7723c151a41c6939ac1e048224e31c1e14f89a2..185f3546b45919f91cf5ce3efb65e528e5a2db9d 100644 --- a/src/vs/workbench/services/workingCopy/common/workingCopyFileOperationParticipant.ts +++ b/src/vs/workbench/services/workingCopy/common/workingCopyFileOperationParticipant.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { localize } from 'vs/nls'; -import { raceTimeout } from 'vs/base/common/async'; +import { raceCancellation } from 'vs/base/common/async'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { ILogService } from 'vs/platform/log/common/log'; import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress'; @@ -40,10 +40,13 @@ export class WorkingCopyFileOperationParticipant extends Disposable { } const cts = new CancellationTokenSource(); + const timer = setTimeout(() => cts.cancel(), timeout); return this.progressService.withProgress({ - location: ProgressLocation.Window, - title: this.progressLabel(operation) + location: ProgressLocation.Notification, + title: this.progressLabel(operation), + cancellable: true, + delay: Math.min(timeout / 2, 3000) }, async progress => { // For each participant @@ -51,14 +54,21 @@ export class WorkingCopyFileOperationParticipant extends Disposable { if (cts.token.isCancellationRequested) { break; } - try { const promise = participant.participate(files, operation, undoRedoGroupId, isUndoing, progress, timeout, cts.token); - await raceTimeout(promise, timeout, () => cts.dispose(true /* cancel */)); + await raceCancellation(promise, cts.token); } catch (err) { this.logService.warn(err); } } + }, () => { + // user cancel + cts.cancel(); + + }).finally(() => { + // cleanup + cts.dispose(); + clearTimeout(timer); }); }