This commit is contained in:
parent
67c90e6930
commit
0a7d9859ed
|
@ -27,7 +27,6 @@ import * as vscode from 'vscode';
|
||||||
import { Cache } from './cache';
|
import { Cache } from './cache';
|
||||||
import { ResourceMap } from 'vs/base/common/map';
|
import { ResourceMap } from 'vs/base/common/map';
|
||||||
|
|
||||||
|
|
||||||
interface IObservable<T> {
|
interface IObservable<T> {
|
||||||
proxy: T;
|
proxy: T;
|
||||||
onDidChange: Event<void>;
|
onDidChange: Event<void>;
|
||||||
|
@ -86,6 +85,8 @@ export class ExtHostCell extends Disposable implements vscode.NotebookCell {
|
||||||
readonly uri: URI;
|
readonly uri: URI;
|
||||||
readonly cellKind: CellKind;
|
readonly cellKind: CellKind;
|
||||||
|
|
||||||
|
private _document: vscode.TextDocument | undefined;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _proxy: MainThreadNotebookShape,
|
private _proxy: MainThreadNotebookShape,
|
||||||
readonly notebook: ExtHostNotebookDocument,
|
readonly notebook: ExtHostNotebookDocument,
|
||||||
|
@ -112,7 +113,10 @@ export class ExtHostCell extends Disposable implements vscode.NotebookCell {
|
||||||
}
|
}
|
||||||
|
|
||||||
get document(): vscode.TextDocument {
|
get document(): vscode.TextDocument {
|
||||||
return this._extHostDocument.getDocument(this.uri)!.document;
|
if (!this._document) {
|
||||||
|
this._document = this._extHostDocument.getDocument(this.uri)?.document;
|
||||||
|
}
|
||||||
|
return this._document!;
|
||||||
}
|
}
|
||||||
|
|
||||||
get language(): string {
|
get language(): string {
|
||||||
|
@ -365,6 +369,7 @@ export class ExtHostNotebookDocument extends Disposable implements vscode.Notebo
|
||||||
|
|
||||||
const contentChangeEvents: vscode.NotebookCellsChangeData[] = [];
|
const contentChangeEvents: vscode.NotebookCellsChangeData[] = [];
|
||||||
const addedCellDocuments: IExtHostModelAddedData[] = [];
|
const addedCellDocuments: IExtHostModelAddedData[] = [];
|
||||||
|
const removedCellDocuments: URI[] = [];
|
||||||
|
|
||||||
splices.reverse().forEach(splice => {
|
splices.reverse().forEach(splice => {
|
||||||
const cellDtos = splice[2];
|
const cellDtos = splice[2];
|
||||||
|
@ -402,11 +407,16 @@ export class ExtHostNotebookDocument extends Disposable implements vscode.Notebo
|
||||||
deletedItems,
|
deletedItems,
|
||||||
items: newCells
|
items: newCells
|
||||||
});
|
});
|
||||||
|
|
||||||
|
for (let cell of deletedItems) {
|
||||||
|
removedCellDocuments.push(cell.uri);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (addedCellDocuments) {
|
this._documentsAndEditors.acceptDocumentsAndEditorsDelta({
|
||||||
this._documentsAndEditors.acceptDocumentsAndEditorsDelta({ addedDocuments: addedCellDocuments });
|
addedDocuments: addedCellDocuments,
|
||||||
}
|
removedDocuments: removedCellDocuments
|
||||||
|
});
|
||||||
|
|
||||||
if (!initialization) {
|
if (!initialization) {
|
||||||
this._emitter.emitModelChange({
|
this._emitter.emitModelChange({
|
||||||
|
|
Loading…
Reference in a new issue