diff --git a/src/vs/workbench/api/browser/mainThreadNotebook.ts b/src/vs/workbench/api/browser/mainThreadNotebook.ts index 1cd0e2fc2d32c83413699a6e4365e170258d82d1..a74dce50ca84cedd734374f066599664af11a494 100644 --- a/src/vs/workbench/api/browser/mainThreadNotebook.ts +++ b/src/vs/workbench/api/browser/mainThreadNotebook.ts @@ -279,7 +279,7 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo if (!this._editorEventListenersMapping.has(doc.toString())) { const disposableStore = new DisposableStore(); const textModel = this._notebookService.getNotebookTextModel(doc); - disposableStore.add(textModel!.onDidModelChangeProxy(e => { + disposableStore.add(textModel!.onDidChangeContent(e => { const data = e.kind === NotebookCellsChangeType.ModelChange || e.kind === NotebookCellsChangeType.Initialize ? { diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/scm/scm.ts b/src/vs/workbench/contrib/notebook/browser/contrib/scm/scm.ts index ad1885bbfb31113b4b9b129ea6a29bd638180553..4c431ef0a483204af1c7c504c310a2f8ff65aa31 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/scm/scm.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/scm/scm.ts @@ -43,7 +43,7 @@ export class SCMController extends Disposable implements INotebookEditorContribu this.update(); if (this._notebookEditor.textModel) { - this._localDisposable.add(this._notebookEditor.textModel.onDidModelChangeProxy((e) => { + this._localDisposable.add(this._notebookEditor.textModel.onDidChangeContent((e) => { this.update(); })); } diff --git a/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel.ts b/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel.ts index c13e2aa0c7baad588db25a41abe4e95d91fd8132..77739cea9eda83ef29a1e1aa2128c444e57332c3 100644 --- a/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel.ts +++ b/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel.ts @@ -308,7 +308,7 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD this.selectionHandles = endSelectionHandles; }; - this._register(this._notebook.onDidModelChangeProxy(e => { + this._register(this._notebook.onDidChangeContent(e => { let changes: NotebookCellTextModelSplice[] = []; if (e.kind === NotebookCellsChangeType.ModelChange || e.kind === NotebookCellsChangeType.Initialize) { @@ -323,7 +323,7 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD } })); - this._register(this._notebook.onDidModelChangeProxy(e => { + this._register(this._notebook.onDidChangeContent(e => { if (e.kind === NotebookCellsChangeType.ChangeDocumentMetadata) { this.eventDispatcher.emit([new NotebookMetadataChangedEvent(this._notebook.metadata)]); } diff --git a/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts b/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts index 96f6c84309ff28dcd917d13e84e7946a6399425a..5039c4b4b59621f60d5079e7fc0d8443867b1c08 100644 --- a/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts +++ b/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts @@ -149,8 +149,8 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel readonly onDidChangeDirty = this._onDidChangeDirty.event; private readonly _emitSelections = this._register(new Emitter()); get emitSelections() { return this._emitSelections.event; } - private _onDidModelChangeProxy = this._register(new Emitter()); - get onDidModelChangeProxy(): Event { return this._onDidModelChangeProxy.event; } + private _onDidChangeContent = this._register(new Emitter()); + get onDidChangeContent(): Event { return this._onDidChangeContent.event; } private _mapping: Map = new Map(); private _cellListeners: Map = new Map(); cells: NotebookCellTextModel[]; @@ -195,7 +195,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel this._operationManager = new NotebookOperationManager(this._undoService, uri); this._eventEmitter = new DelayedEmitter( - this._onDidModelChangeProxy, + this._onDidChangeContent, () => { this._increaseVersionId(); }, this ); @@ -242,7 +242,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel this.setDirty(true); this._increaseVersionId(); // this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeCellContent); - this._onDidModelChangeProxy.fire({ kind: NotebookCellsChangeType.ChangeCellContent, versionId: this.versionId, synchronous: true }); + this._onDidChangeContent.fire({ kind: NotebookCellsChangeType.ChangeCellContent, versionId: this.versionId, synchronous: true }); }); this._cellListeners.set(mainCells[i].handle, dirtyStateListener); @@ -333,7 +333,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel this.setDirty(true); this._increaseVersionId(); // this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeCellContent); - this._onDidModelChangeProxy.fire({ kind: NotebookCellsChangeType.ChangeCellContent, versionId: this.versionId, synchronous: true }); + this._onDidChangeContent.fire({ kind: NotebookCellsChangeType.ChangeCellContent, versionId: this.versionId, synchronous: true }); }); this._cellListeners.set(cell.handle, dirtyStateListener); @@ -417,7 +417,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel updateNotebookMetadata(metadata: NotebookDocumentMetadata) { this.metadata = metadata; // this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeDocumentMetadata); - this._onDidModelChangeProxy.fire({ kind: NotebookCellsChangeType.ChangeDocumentMetadata, versionId: this.versionId, metadata: this.metadata, synchronous: true }); + this._onDidChangeContent.fire({ kind: NotebookCellsChangeType.ChangeDocumentMetadata, versionId: this.versionId, metadata: this.metadata, synchronous: true }); } @@ -435,7 +435,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel this.setDirty(true); this._increaseVersionId(); // this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeCellContent); - this._onDidModelChangeProxy.fire({ kind: NotebookCellsChangeType.ChangeCellContent, versionId: this.versionId, synchronous: true }); + this._onDidChangeContent.fire({ kind: NotebookCellsChangeType.ChangeCellContent, versionId: this.versionId, synchronous: true }); }); @@ -443,7 +443,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel this.setDirty(false); // this._onDidChangeContent.fire(NotebookCellsChangeType.ModelChange); - this._onDidModelChangeProxy.fire({ + this._onDidChangeContent.fire({ kind: NotebookCellsChangeType.ModelChange, versionId: this._versionId, changes: [[ @@ -466,7 +466,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel this.setDirty(true); this._increaseVersionId(); // this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeCellContent); - this._onDidModelChangeProxy.fire({ kind: NotebookCellsChangeType.ChangeCellContent, versionId: this.versionId, synchronous: true }); + this._onDidChangeContent.fire({ kind: NotebookCellsChangeType.ChangeCellContent, versionId: this.versionId, synchronous: true }); }); this._cellListeners.set(cells[i].handle, dirtyStateListener); @@ -478,7 +478,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel this._increaseVersionId(); - this._onDidModelChangeProxy.fire({ + this._onDidChangeContent.fire({ kind: NotebookCellsChangeType.ModelChange, versionId: this._versionId, changes: [[ @@ -505,7 +505,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel // this._onDidChangeContent.fire(NotebookCellsChangeType.ModelChange); this._increaseVersionId(); - this._onDidModelChangeProxy.fire({ kind: NotebookCellsChangeType.ModelChange, versionId: this._versionId, changes: [[index, count, []]], synchronous }); + this._onDidChangeContent.fire({ kind: NotebookCellsChangeType.ModelChange, versionId: this._versionId, changes: [[index, count, []]], synchronous }); } private _isCellMetadataChanged(a: NotebookCellMetadata, b: NotebookCellMetadata) { @@ -599,7 +599,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel cell.language = languageId; this._increaseVersionId(); - this._onDidModelChangeProxy.fire({ kind: NotebookCellsChangeType.ChangeLanguage, versionId: this._versionId, index: this.cells.indexOf(cell), language: languageId, synchronous: true }); + this._onDidChangeContent.fire({ kind: NotebookCellsChangeType.ChangeLanguage, versionId: this._versionId, index: this.cells.indexOf(cell), language: languageId, synchronous: true }); } } @@ -655,7 +655,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel // this._onDidChangeContent.fire(NotebookCellsChangeType.Move); this._increaseVersionId(); - this._onDidModelChangeProxy.fire({ kind: NotebookCellsChangeType.Move, versionId: this._versionId, index, length, newIdx, cells, synchronous }); + this._onDidChangeContent.fire({ kind: NotebookCellsChangeType.Move, versionId: this._versionId, index, length, newIdx, cells, synchronous }); } // todo, we can't emit this change as it will create a new view model and that will hold diff --git a/src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts b/src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts index ec51f4838fa2a51ca8722823676764fd5a579869..bc6ee9afeb8215190efa44cd955206bf4eb621e6 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts @@ -145,7 +145,7 @@ export class NotebookEditorModel extends EditorModel implements INotebookEditorM this._register(this._notebook); - this._register(this._notebook.onDidModelChangeProxy(e => { + this._register(this._notebook.onDidChangeContent(e => { if (e.kind !== NotebookCellsChangeType.Initialize) { this._onDidChangeContent.fire(); } diff --git a/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts b/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts index 75c32be59fe276a783d3b95fd60f8db121ff1233..ba46779e926a950dd0c507ce550ea5302a924a09 100644 --- a/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts +++ b/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts @@ -337,8 +337,8 @@ export class NotebookEditorTestModel extends EditorModel implements INotebookEdi ) { super(); - if (_notebook && _notebook.onDidModelChangeProxy) { - this._register(_notebook.onDidModelChangeProxy(() => { + if (_notebook && _notebook.onDidChangeContent) { + this._register(_notebook.onDidChangeContent(() => { this._dirty = true; this._onDidChangeDirty.fire(); this._onDidChangeContent.fire();