Skip to content

Commit

Permalink
[monaco] don't open dirty editor if auto save is enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Kosyakov <[email protected]>
  • Loading branch information
akosyakov committed Aug 11, 2020
1 parent 0d1c55b commit c205cfb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/monaco/src/browser/monaco-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,12 @@ export class MonacoWorkspace {
// create a new reference to make sure the model is not disposed before it is
// acquired by the editor, thus losing the changes that made it dirty.
this.textModelService.createModelReference(model.textEditorModel.uri).then(ref => {
this.editorManager.open(new URI(model.uri), {
mode: 'open',
}).then(editor => ref.dispose());
(
model.autoSave === 'on' ? new Promise(resolve => model.onDidSaveModel(resolve)) :
this.editorManager.open(new URI(model.uri), { mode: 'open' })
).then(
() => ref.dispose()
);
});
}
}
Expand Down

0 comments on commit c205cfb

Please sign in to comment.