Skip to content

Commit

Permalink
Add revert method implementation to input so user can close dirty not…
Browse files Browse the repository at this point in the history
…ebook after clicking "dont save." (#2578)
  • Loading branch information
nstrayer authored Apr 1, 2024
1 parent b64e156 commit 738604a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IReference } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { localize } from 'vs/nls';
import { IEditorOptions } from 'vs/platform/editor/common/editor';
import { EditorInputCapabilities, GroupIdentifier, ISaveOptions, IUntypedEditorInput } from 'vs/workbench/common/editor';
import { EditorInputCapabilities, GroupIdentifier, IRevertOptions, ISaveOptions, IUntypedEditorInput } from 'vs/workbench/common/editor';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { IResolvedNotebookEditorModel } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { INotebookEditorModelResolverService } from 'vs/workbench/contrib/notebook/common/notebookEditorModelResolverService';
Expand Down Expand Up @@ -120,6 +120,12 @@ export class PositronNotebookEditorInput extends EditorInput {
return PositronNotebookEditorInput.ID;
}

override async revert(_group: GroupIdentifier, options?: IRevertOptions): Promise<void> {
if (this._editorModelReference && this._editorModelReference.object.isDirty()) {
await this._editorModelReference.object.revert(options);
}
}

/**
* Gets the editor identifier.
*/
Expand Down

0 comments on commit 738604a

Please sign in to comment.