Skip to content

Commit 5273e20

Browse files
author
Benjamin Pasero
committed
editors - save/revert through service
1 parent 3e777d8 commit 5273e20

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/vs/workbench/browser/parts/editor/editorActions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,13 +543,13 @@ export class RevertAndCloseEditorAction extends Action {
543543

544544
// first try a normal revert where the contents of the editor are restored
545545
try {
546-
await editor.revert(group.id);
546+
await this.editorService.revert({ editor, groupId: group.id });
547547
} catch (error) {
548548
// if that fails, since we are about to close the editor, we accept that
549549
// the editor cannot be reverted and instead do a soft revert that just
550550
// enables us to close the editor. With this, a user can always close a
551551
// dirty editor even when reverting fails.
552-
await editor.revert(group.id, { soft: true });
552+
await this.editorService.revert({ editor, groupId: group.id }, { soft: true });
553553
}
554554

555555
group.closeEditor(editor);

src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export class PreferencesEditor extends BaseEditor {
252252
if (this.editorService.activeControl !== this) {
253253
this.focus();
254254
}
255-
const promise: Promise<boolean> = this.input && this.input.isDirty() ? this.input.save(this.group!.id).then(editor => !!editor) : Promise.resolve(true);
255+
const promise: Promise<boolean> = this.input && this.input.isDirty() ? this.editorService.save({ editor: this.input, groupId: this.group!.id }) : Promise.resolve(true);
256256
promise.then(() => {
257257
if (target === ConfigurationTarget.USER_LOCAL) {
258258
this.preferencesService.switchSettings(ConfigurationTarget.USER_LOCAL, this.preferencesService.userSettingsResource, true);

0 commit comments

Comments
 (0)