mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-13 13:52:33 +01:00
increate file participant default time to 1 minute, show notification progress which allows for cancellation, https://github.com/microsoft/vscode/issues/111208
This commit is contained in:
@@ -77,7 +77,7 @@ Registry.as<IConfigurationRegistry>(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."),
|
||||
}
|
||||
}
|
||||
|
||||
+15
-5
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user