提交 2ea9ecd6 编写于 作者: J Johannes Rieken

increate file participant default time to 1 minute, show notification progress...

increate file participant default time to 1 minute, show notification progress which allows for cancellation, https://github.com/microsoft/vscode/issues/111208
上级 00eea33b
......@@ -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."),
}
}
......
......@@ -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);
});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册