ref count document data on extension host side

This commit is contained in:
Johannes Rieken
2020-08-11 14:24:16 +02:00
parent 98249fba45
commit 3fefc6117c
4 changed files with 45 additions and 38 deletions

View File

@@ -67,7 +67,7 @@ export class ExtHostCell extends Disposable implements vscode.NotebookCell {
modeId: cell.language,
uri: cell.uri,
isDirty: false,
versionId: -1
versionId: 1
};
}
@@ -1523,19 +1523,9 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
const document = this._documents.get(revivedUriStr);
if (document) {
// remove all documents that have not been opened by the renderer
// and have not yet been closed
const removedCellDocuments: URI[] = [];
for (let cell of document.cells) {
if (this._documentsAndEditors.getDocument(cell.uri)?.version === -1) {
removedCellDocuments.push(cell.uri);
}
}
document.dispose();
this._documents.delete(revivedUriStr);
this._documentsAndEditors.$acceptDocumentsAndEditorsDelta({ removedDocuments: removedCellDocuments });
this._documentsAndEditors.$acceptDocumentsAndEditorsDelta({ removedDocuments: document.cells.map(cell => cell.uri) });
this._onDidCloseNotebookDocument.fire(document);
}