提交 660ffebf 编写于 作者: J Johannes Rieken

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
上级 39774a2d
......@@ -30,7 +30,6 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/
import { IWorkingCopyFileService } from 'vs/workbench/services/workingCopy/common/workingCopyFileService';
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { Schemas } from 'vs/base/common/network';
namespace delta {
......@@ -400,12 +399,8 @@ export class MainThreadDocumentsAndEditors {
extHostDelta.removedEditors = removedEditors;
}
if (delta.addedDocuments.length > 0) {
// notebook cell documents get sync'd by the notebook open logic
// and therefore we don't send them another time now.
empty = false;
extHostDelta.addedDocuments = delta.addedDocuments
.filter(m => m.uri.scheme !== Schemas.vscodeNotebookCell)
.map(m => this._toModelAddData(m));
extHostDelta.addedDocuments = delta.addedDocuments.map(m => this._toModelAddData(m));
}
if (delta.addedEditors.length > 0) {
empty = false;
......
......@@ -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),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册