提交 48d4d323 编写于 作者: R rebornix

redundant model insertion

上级 d2ae19e7
...@@ -617,7 +617,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor { ...@@ -617,7 +617,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
async executeNotebookCell(cell: ICellViewModel): Promise<void> { async executeNotebookCell(cell: ICellViewModel): Promise<void> {
try { try {
cell.runState = CellRunState.Running; cell.runState = CellRunState.Running;
const provider = this.notebookService.getContributedNotebookProviders(cell.uri)[0]; const provider = this.notebookService.getContributedNotebookProviders(this.viewModel!.uri)[0];
if (provider) { if (provider) {
const viewType = provider.id; const viewType = provider.id;
const notebookUri = CellUri.parse(cell.uri)?.notebook; const notebookUri = CellUri.parse(cell.uri)?.notebook;
......
...@@ -54,8 +54,7 @@ export class NotebookEditorModel extends EditorModel { ...@@ -54,8 +54,7 @@ export class NotebookEditorModel extends EditorModel {
let notebook = this.getNotebook(); let notebook = this.getNotebook();
if (notebook) { if (notebook) {
let mainCell = new NotebookCellTextModel(URI.revive(cell.uri), cell.handle, cell.source, cell.language, cell.cellKind, cell.outputs, cell.metadata); this.notebook.insertNewCell(index, [cell as NotebookCellTextModel]);
this.notebook.insertNewCell(index, [mainCell]);
this._dirty = true; this._dirty = true;
this._onDidChangeDirty.fire(); this._onDidChangeDirty.fire();
......
...@@ -188,11 +188,12 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod ...@@ -188,11 +188,12 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod
} }
getOutputOffset(index: number): number { getOutputOffset(index: number): number {
this._ensureOutputsTop();
if (index >= this._outputCollection.length) { if (index >= this._outputCollection.length) {
throw new Error('Output index out of range!'); throw new Error('Output index out of range!');
} }
this._ensureOutputsTop();
const offset = this._outputsTop!.getAccumulatedValue(index - 1); const offset = this._outputsTop!.getAccumulatedValue(index - 1);
return this.layoutInfo.outputContainerOffset + offset; return this.layoutInfo.outputContainerOffset + offset;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册