diff --git a/src/vs/workbench/contrib/notebook/common/notebookCommon.ts b/src/vs/workbench/contrib/notebook/common/notebookCommon.ts index 9fc6e6b6576f30652438e315417edce4e2744ce9..2a5b2337860ccd1630560398f9ecc10f1174ac99 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookCommon.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookCommon.ts @@ -17,6 +17,7 @@ import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/no import { GlobPattern } from 'vs/workbench/api/common/extHost.protocol'; import { CancellationToken } from 'vs/base/common/cancellation'; import { Schemas } from 'vs/base/common/network'; +import { IRevertOptions } from 'vs/workbench/common/editor'; export enum CellKind { Markdown = 1, @@ -559,10 +560,14 @@ export const NOTEBOOK_EDITOR_CURSOR_BOUNDARY = new RawContextKey<'none' | 'top' export interface INotebookEditorModel extends IEditorModel { - viewType: string; - notebook: NotebookTextModel; + readonly onDidChangeDirty: Event; + readonly resource: URI; + readonly viewType: string; + readonly notebook: NotebookTextModel; isDirty(): boolean; save(): Promise; + saveAs(target: URI): Promise; + revert(options?: IRevertOptions | undefined): Promise; } export interface INotebookTextModelBackup { diff --git a/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts b/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts index 359fc431c2ce1bebe5da365bb7c3388693049e5e..c263fc9deb77f304467f1eb782f20c77b699ac54 100644 --- a/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts +++ b/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts @@ -22,6 +22,7 @@ import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/no import { CellKind, CellUri, INotebookEditorModel, IProcessedOutput, NotebookCellMetadata, INotebookKernelInfo } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { Webview } from 'vs/workbench/contrib/webview/browser/webview'; import { ICompositeCodeEditor, IEditor } from 'vs/editor/common/editorCommon'; +import { NotImplementedError } from 'vs/base/common/errors'; export class TestCell extends NotebookCellTextModel { constructor( @@ -246,6 +247,10 @@ export class NotebookEditorTestModel extends EditorModel implements INotebookEdi return this._notebook.viewType; } + get resource() { + return this._notebook.uri; + } + get notebook() { return this._notebook; } @@ -282,6 +287,14 @@ export class NotebookEditorTestModel extends EditorModel implements INotebookEdi return false; } + + saveAs(): Promise { + throw new NotImplementedError(); + } + + revert(): Promise { + throw new NotImplementedError(); + } } export function withTestNotebook(instantiationService: IInstantiationService, blukEditService: IBulkEditService, undoRedoService: IUndoRedoService, cells: [string[], string, CellKind, IProcessedOutput[], NotebookCellMetadata][], callback: (editor: TestNotebookEditor, viewModel: NotebookViewModel, textModel: NotebookTextModel) => void) {