diff --git a/src/vs/workbench/services/textfile/browser/textFileService.ts b/src/vs/workbench/services/textfile/browser/textFileService.ts index f02d1dc4379..930a74e0fe6 100644 --- a/src/vs/workbench/services/textfile/browser/textFileService.ts +++ b/src/vs/workbench/services/textfile/browser/textFileService.ts @@ -598,26 +598,13 @@ export abstract class AbstractTextFileService extends Disposable implements ITex }); await Promise.all(fileModels.map(async model => { - try { - await model.revert(options); + await model.revert(options); - // If model is still dirty, mark the resulting operation as error - if (model.isDirty()) { - const result = mapResourceToResult.get(model.resource); - if (result) { - result.error = true; - } - } - } catch (error) { - - // FileNotFound means the file got deleted meanwhile, so ignore it - if ((error).fileOperationResult === FileOperationResult.FILE_NOT_FOUND) { - return; - } - - // Otherwise bubble up the error - else { - throw error; + // If model is still dirty, mark the resulting operation as error + if (model.isDirty()) { + const result = mapResourceToResult.get(model.resource); + if (result) { + result.error = true; } } })); diff --git a/src/vs/workbench/services/textfile/common/textFileEditorModel.ts b/src/vs/workbench/services/textfile/common/textFileEditorModel.ts index d0f22c9fb60..fb23bde3b4f 100644 --- a/src/vs/workbench/services/textfile/common/textFileEditorModel.ts +++ b/src/vs/workbench/services/textfile/common/textFileEditorModel.ts @@ -230,10 +230,14 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil await this.load({ forceReadFromDisk: true }); } catch (error) { - // Set flags back to previous values, we are still dirty if revert failed - undo(); + // FileNotFound means the file got deleted meanwhile, so ignore it + if ((error).fileOperationResult !== FileOperationResult.FILE_NOT_FOUND) { - throw error; + // Set flags back to previous values, we are still dirty if revert failed + undo(); + + throw error; + } } }