always send model add data and check on the extension if this is a notebook-cell special case

this sends the twice but gurantees that the renderer owns the model
This commit is contained in:
Johannes Rieken
2020-07-17 18:23:16 +02:00
parent 39774a2d8d
commit 660ffebf0a
2 changed files with 10 additions and 7 deletions

View File

@@ -15,6 +15,7 @@ import { ExtHostTextEditor } from 'vs/workbench/api/common/extHostTextEditor';
import * as typeConverters from 'vs/workbench/api/common/extHostTypeConverters';
import { ILogService } from 'vs/platform/log/common/log';
import { ResourceMap } from 'vs/base/common/map';
import { Schemas } from 'vs/base/common/network';
export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsShape {
@@ -60,7 +61,14 @@ export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsSha
if (delta.addedDocuments) {
for (const data of delta.addedDocuments) {
const resource = URI.revive(data.uri);
assert.ok(!this._documents.has(resource), `document '${resource} already exists!'`);
const existingDocumentData = this._documents.get(resource);
if (existingDocumentData) {
if (resource.scheme !== Schemas.vscodeNotebookCell) {
throw new Error(`document '${resource} already exists!'`);
}
existingDocumentData.onEvents({ changes: [], versionId: data.versionId, eol: data.EOL });
continue;
}
const documentData = new ExtHostDocumentData(
this._extHostRpc.getProxy(MainContext.MainThreadDocuments),