diff --git a/src/vs/workbench/services/textfile/browser/textFileService.ts b/src/vs/workbench/services/textfile/browser/textFileService.ts index 1bc02959ca3d1984fd656b553e1917dbeed4788a..452b0d2b64b19c237f215b28a5c9bdea693fed1e 100644 --- a/src/vs/workbench/services/textfile/browser/textFileService.ts +++ b/src/vs/workbench/services/textfile/browser/textFileService.ts @@ -283,9 +283,13 @@ export abstract class AbstractTextFileService extends Disposable implements ITex // before event await this._onWillRunOperation.fireAsync({ operation: FileOperation.DELETE, target: resource }, CancellationToken.None); + // Check for any existing dirty file model for the resource + // and do a soft revert before deleting to be able to close + // any opened editor with these files const dirtyFiles = this.getDirtyFileModels().map(dirtyFileModel => dirtyFileModel.resource).filter(dirty => isEqualOrParent(dirty, resource)); await this.doRevertFiles(dirtyFiles, { soft: true }); + // Now actually delete from disk await this.fileService.del(resource, options); // after event