Investigate to cancel a running save participant when saving again (#90590)

* Investigate to cancel a running save participant when saving again (fix #90509)

* keep token source
This commit is contained in:
Benjamin Pasero
2020-02-13 16:45:49 +01:00
committed by GitHub
parent df5969701e
commit b989a6ab05
6 changed files with 63 additions and 8 deletions

View File

@@ -365,9 +365,9 @@ export class SaveParticipant implements ISaveParticipant {
this._saveParticipants.dispose();
}
async participate(model: IResolvedTextFileEditorModel, env: { reason: SaveReason; }): Promise<void> {
async participate(model: IResolvedTextFileEditorModel, context: { reason: SaveReason; }, token: CancellationToken): Promise<void> {
const cts = new CancellationTokenSource();
const cts = new CancellationTokenSource(token);
return this._progressService.withProgress({
title: localize('saveParticipants', "Running Save Participants for '{0}'", this._labelService.getUriLabel(model.resource, { relative: true })),
@@ -383,7 +383,7 @@ export class SaveParticipant implements ISaveParticipant {
break;
}
try {
const promise = p.participate(model, env, progress, cts.token);
const promise = p.participate(model, context, progress, cts.token);
await raceCancellation(promise, cts.token);
} catch (err) {
this._logService.warn(err);