diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts index 74ee6bfa705..ca3456f934f 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts @@ -440,12 +440,12 @@ suite('Notebook API tests', function () { await cellsChangeEvent; await cellMetadataChangeEvent; assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellCount, 3); - assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(0)?.metadata?.inputCollapsed, false); + assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(0)?.metadata.inputCollapsed, false); assert.strictEqual(version + 1, vscode.window.activeNotebookEditor!.document.version); await vscode.commands.executeCommand('undo'); assert.strictEqual(version + 2, vscode.window.activeNotebookEditor!.document.version); - assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(0)?.metadata?.inputCollapsed, undefined); + assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(0)?.metadata.inputCollapsed, undefined); assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellCount, 2); }); diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts b/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts index 692c8d40f76..e064a2e637d 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts @@ -803,7 +803,7 @@ async function runCell(accessor: ServicesAccessor, context: INotebookActionConte } if (context.ui && context.cell) { - if (context.cell.internalMetadata?.runState === NotebookCellExecutionState.Executing) { + if (context.cell.internalMetadata.runState === NotebookCellExecutionState.Executing) { return; } return context.notebookEditor.executeNotebookCells(Iterable.single(context.cell)); @@ -1251,7 +1251,7 @@ registerAction2(class ClearCellOutputsAction extends NotebookCellAction { editor.viewModel.notebookDocument.applyEdits([{ editType: CellEditType.Output, index, outputs: [] }], true, undefined, () => undefined, undefined); - if (context.cell.internalMetadata?.runState !== NotebookCellExecutionState.Executing) { + if (context.cell.internalMetadata.runState !== NotebookCellExecutionState.Executing) { context.notebookEditor.viewModel.notebookDocument.applyEdits([{ editType: CellEditType.PartialInternalMetadata, index, internalMetadata: { runState: NotebookCellExecutionState.Idle, @@ -1464,7 +1464,7 @@ registerAction2(class ClearAllCellOutputsAction extends NotebookAction { })), true, undefined, () => undefined, undefined); const clearExecutionMetadataEdits = editor.viewModel.notebookDocument.cells.map((cell, index) => { - if (cell.internalMetadata?.runState !== NotebookCellExecutionState.Executing) { + if (cell.internalMetadata.runState !== NotebookCellExecutionState.Executing) { return { editType: CellEditType.PartialInternalMetadata, index, internalMetadata: { runState: NotebookCellExecutionState.Idle, diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/statusBar/executionStatusBarItemController.ts b/src/vs/workbench/contrib/notebook/browser/contrib/statusBar/executionStatusBarItemController.ts index b34c318e9ab..5ebf368ec88 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/statusBar/executionStatusBarItemController.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/statusBar/executionStatusBarItemController.ts @@ -107,13 +107,13 @@ class ExecutionStateCellStatusBarHelper extends Disposable { return; } - const item = this._getItemForState(cell.internalMetadata?.runState ?? NotebookCellExecutionState.Idle, cell.internalMetadata?.lastRunSuccess); + const item = this._getItemForState(cell.internalMetadata.runState ?? NotebookCellExecutionState.Idle, cell.internalMetadata.lastRunSuccess); // Show the execution spinner for a minimum time - if (cell.internalMetadata?.runState === NotebookCellExecutionState.Executing) { + if (cell.internalMetadata.runState === NotebookCellExecutionState.Executing) { this._currentExecutingStateTimer = setTimeout(() => { this._currentExecutingStateTimer = undefined; - if (cell.internalMetadata?.runState !== NotebookCellExecutionState.Executing) { + if (cell.internalMetadata.runState !== NotebookCellExecutionState.Executing) { this._update(); } }, ExecutionStateCellStatusBarHelper.MIN_SPINNER_TIME); @@ -184,17 +184,17 @@ class TimerCellStatusBarHelper extends Disposable { private async _update() { let item: INotebookCellStatusBarItem | undefined; - const state = this._cell.internalMetadata?.runState ?? NotebookCellExecutionState.Idle; + const state = this._cell.internalMetadata.runState ?? NotebookCellExecutionState.Idle; if (state === NotebookCellExecutionState.Executing) { - const startTime = this._cell.internalMetadata?.runStartTime; - const adjustment = this._cell.internalMetadata?.runStartTimeAdjustment; + const startTime = this._cell.internalMetadata.runStartTime; + const adjustment = this._cell.internalMetadata.runStartTimeAdjustment; if (typeof startTime === 'number') { item = this._getTimeItem(startTime, Date.now(), adjustment); this._scheduler.schedule(); } } else if (state === NotebookCellExecutionState.Idle) { - const startTime = this._cell.internalMetadata?.runStartTime; - const endTime = this._cell.internalMetadata?.runEndTime; + const startTime = this._cell.internalMetadata.runStartTime; + const endTime = this._cell.internalMetadata.runEndTime; if (typeof startTime === 'number' && typeof endTime === 'number') { item = this._getTimeItem(startTime, endTime); } @@ -262,7 +262,7 @@ class KeybindingPlaceholderStatusBarHelper extends Disposable { } private _getItemsForCell(cell: ICellViewModel): INotebookCellStatusBarItem[] { - if (typeof cell.internalMetadata?.runState !== 'undefined' || typeof cell.internalMetadata?.lastRunSuccess !== 'undefined') { + if (typeof cell.internalMetadata.runState !== 'undefined' || typeof cell.internalMetadata.lastRunSuccess !== 'undefined') { return []; } diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/viewportCustomMarkdown/viewportCustomMarkdown.ts b/src/vs/workbench/contrib/notebook/browser/contrib/viewportCustomMarkdown/viewportCustomMarkdown.ts index 5d0ecc0f445..825b8bcabb2 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/viewportCustomMarkdown/viewportCustomMarkdown.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/viewportCustomMarkdown/viewportCustomMarkdown.ts @@ -41,7 +41,7 @@ class NotebookViewportContribution extends Disposable implements INotebookEditor cellRangesToIndexes(visibleRanges).forEach(index => { const cell = this._notebookEditor.viewModel?.viewCells[index]; - if (cell?.cellKind === CellKind.Markup && cell?.getEditState() === CellEditState.Preview && !cell.metadata?.inputCollapsed) { + if (cell?.cellKind === CellKind.Markup && cell?.getEditState() === CellEditState.Preview && !cell.metadata.inputCollapsed) { this._notebookEditor.createMarkdownPreview(cell); } else if (cell?.cellKind === CellKind.Code) { const viewCell = (cell as CodeCellViewModel); diff --git a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts index 039087da23c..444b2b1e281 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts @@ -318,7 +318,7 @@ class CellInfoContentProvider { for (const cell of ref.object.notebook.cells) { if (cell.handle === data.handle) { - const metadataSource = getFormatedMetadataJSON(ref.object.notebook, cell.metadata || {}, cell.language); + const metadataSource = getFormatedMetadataJSON(ref.object.notebook, cell.metadata, cell.language); result = this._modelService.createModel( metadataSource, mode, diff --git a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts index f7aea5b4270..d188dea2b16 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts @@ -133,7 +133,7 @@ export interface IGenericCellViewModel { id: string; handle: number; uri: URI; - metadata: NotebookCellMetadata | undefined; + metadata: NotebookCellMetadata; outputIsHovered: boolean; outputIsFocused: boolean; outputsViewModels: ICellOutputViewModel[]; @@ -262,8 +262,8 @@ export interface ICellViewModel extends IGenericCellViewModel { getText(): string; getTextLength(): number; getHeight(lineHeight: number): number; - metadata: NotebookCellMetadata | undefined; - internalMetadata: NotebookCellInternalMetadata | undefined; + metadata: NotebookCellMetadata; + internalMetadata: NotebookCellInternalMetadata; textModel: ITextModel | undefined; hasModel(): this is IEditableCellViewModel; resolveTextModel(): Promise; diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditorKernelManager.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditorKernelManager.ts index a272c05fce7..2f97e857992 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditorKernelManager.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditorKernelManager.ts @@ -47,7 +47,7 @@ export class NotebookEditorKernelManager extends Disposable { const cellHandles: number[] = []; for (const cell of cells) { - if (cell.cellKind !== CellKind.Code || cell.internalMetadata?.runState === NotebookCellExecutionState.Pending || cell.internalMetadata?.runState === NotebookCellExecutionState.Executing) { + if (cell.cellKind !== CellKind.Code || cell.internalMetadata.runState === NotebookCellExecutionState.Pending || cell.internalMetadata.runState === NotebookCellExecutionState.Executing) { continue; } if (!kernel.supportedLanguages.includes(cell.language)) { diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidgetContextKeys.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidgetContextKeys.ts index 5ec47907d10..d056874669f 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidgetContextKeys.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidgetContextKeys.ts @@ -69,9 +69,9 @@ export class NotebookEditorContextKeys { if (!e.runStateChanged) { return; } - if (c.internalMetadata?.runState === NotebookCellExecutionState.Pending) { + if (c.internalMetadata.runState === NotebookCellExecutionState.Pending) { executionCount++; - } else if (c.internalMetadata?.runState === NotebookCellExecutionState.Idle) { + } else if (c.internalMetadata.runState === NotebookCellExecutionState.Idle) { executionCount--; } this._someCellRunning.set(executionCount > 0); diff --git a/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts b/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts index a55cf2fc6f0..f14f3fcca8d 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts @@ -177,7 +177,7 @@ export class NotebookCellList extends WorkbenchList implements ID this._localDisposableStore.add(this.view.onMouseDblClick(() => { const focus = this.getFocusedElements()[0]; - if (focus && focus.cellKind === CellKind.Markup && !focus.metadata?.inputCollapsed) { + if (focus && focus.cellKind === CellKind.Markup && !focus.metadata.inputCollapsed) { focus.updateEditState(CellEditState.Editing, 'dbclick'); focus.focusMode = CellFocusMode.Editor; } diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts index 825bc53b922..98840923d32 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts @@ -1181,7 +1181,7 @@ var requirejs = (function() { return false; } - if (cell.metadata?.outputCollapsed) { + if (cell.metadata.outputCollapsed) { return false; } diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/cellContextKeys.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/cellContextKeys.ts index 43ea4f9d594..39408dbf2df 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/cellContextKeys.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/cellContextKeys.ts @@ -145,8 +145,8 @@ export class CellContextKeyManager extends Disposable { } private updateForCollapseState() { - this.cellContentCollapsed.set(!!this.element.metadata?.inputCollapsed); - this.cellOutputCollapsed.set(!!this.element.metadata?.outputCollapsed); + this.cellContentCollapsed.set(!!this.element.metadata.inputCollapsed); + this.cellOutputCollapsed.set(!!this.element.metadata.outputCollapsed); } private updateForOutputs() { diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts index d22419f52cf..1246350889e 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts @@ -263,11 +263,11 @@ abstract class AbstractCellRenderer { return; } - if (templateData.currentRenderedCell.metadata?.inputCollapsed) { + if (templateData.currentRenderedCell.metadata.inputCollapsed) { textModel.applyEdits([ { editType: CellEditType.Metadata, index, metadata: { ...templateData.currentRenderedCell.metadata, inputCollapsed: false } } ], true, undefined, () => undefined, undefined); - } else if (templateData.currentRenderedCell.metadata?.outputCollapsed) { + } else if (templateData.currentRenderedCell.metadata.outputCollapsed) { textModel.applyEdits([ { editType: CellEditType.Metadata, index, metadata: { ...templateData.currentRenderedCell.metadata, outputCollapsed: false } } ], true, undefined, () => undefined, undefined); @@ -519,7 +519,7 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR } private updateCollapsedState(element: MarkdownCellViewModel) { - if (element.metadata?.inputCollapsed) { + if (element.metadata.inputCollapsed) { this.notebookEditor.hideMarkdownPreviews([element]); } else { this.notebookEditor.unhideMarkdownPreviews([element]); @@ -787,8 +787,8 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende const clickedOnInput = e.offsetY < (cell.layoutInfo as CodeCellLayoutInfo).outputContainerOffset; const viewModel = this.notebookEditor.viewModel!; const metadata: Partial = clickedOnInput ? - { inputCollapsed: !cell.metadata?.inputCollapsed } : - { outputCollapsed: !cell.metadata?.outputCollapsed }; + { inputCollapsed: !cell.metadata.inputCollapsed } : + { outputCollapsed: !cell.metadata.outputCollapsed }; viewModel.notebookDocument.applyEdits([ { editType: CellEditType.PartialMetadata, @@ -804,7 +804,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende return; } - const metadata: Partial = cell.metadata?.inputCollapsed ? + const metadata: Partial = cell.metadata.inputCollapsed ? { inputCollapsed: false } : { outputCollapsed: false }; const viewModel = this.notebookEditor.viewModel!; diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts index 9e7058f4dba..423251362fa 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts @@ -225,11 +225,11 @@ export class CodeCell extends Disposable { this.viewCell.layoutChange({}); - if (this.viewCell.metadata?.inputCollapsed && this.viewCell.metadata.outputCollapsed) { + if (this.viewCell.metadata.inputCollapsed && this.viewCell.metadata.outputCollapsed) { this.viewUpdateAllCollapsed(); - } else if (this.viewCell.metadata?.inputCollapsed) { + } else if (this.viewCell.metadata.inputCollapsed) { this.viewUpdateInputCollapsed(); - } else if (this.viewCell.metadata?.outputCollapsed && this.viewCell.outputsViewModels.length) { + } else if (this.viewCell.metadata.outputCollapsed && this.viewCell.outputsViewModels.length) { this.viewUpdateOutputCollapsed(); } else { this.viewUpdateExpanded(); diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts index 8da7491ee30..e7362a45304 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts @@ -242,7 +242,7 @@ export class StatefulMarkdownCell extends Disposable { } private viewUpdate(): void { - if (this.viewCell.metadata?.inputCollapsed) { + if (this.viewCell.metadata.inputCollapsed) { this.viewUpdateCollapsed(); } else if (this.viewCell.getEditState() === CellEditState.Editing) { this.viewUpdateEditing(); diff --git a/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.ts b/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.ts index 70e00498851..3049c90f3b3 100644 --- a/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.ts +++ b/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.ts @@ -117,11 +117,11 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod })); this._register(this.model.onDidChangeMetadata(e => { - if (this.metadata?.outputCollapsed) { + if (this.metadata.outputCollapsed) { this._onDidHideOutputs.fire(this.outputsViewModels.slice(0)); } - if (this.metadata?.inputCollapsed) { + if (this.metadata.inputCollapsed) { this._onDidHideInput.fire(); } })); @@ -150,9 +150,9 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod this._ensureOutputsTop(); const notebookLayoutConfiguration = this.viewContext.notebookOptions.getLayoutConfiguration(); const outputShowMoreContainerHeight = state.outputShowMoreContainerHeight ? state.outputShowMoreContainerHeight : this._layoutInfo.outputShowMoreContainerHeight; - let outputTotalHeight = Math.max(this._outputMinHeight, this.metadata?.outputCollapsed ? notebookLayoutConfiguration.collapsedIndicatorHeight : this._outputsTop!.getTotalValue()); + let outputTotalHeight = Math.max(this._outputMinHeight, this.metadata.outputCollapsed ? notebookLayoutConfiguration.collapsedIndicatorHeight : this._outputsTop!.getTotalValue()); - if (!this.metadata?.inputCollapsed) { + if (!this.metadata.inputCollapsed) { let newState: CodeCellLayoutState; let editorHeight: number; let totalHeight: number; @@ -201,7 +201,7 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod layoutState: newState }; } else { - outputTotalHeight = Math.max(this._outputMinHeight, this.metadata?.inputCollapsed && this.metadata.outputCollapsed ? 0 : outputTotalHeight); + outputTotalHeight = Math.max(this._outputMinHeight, this.metadata.inputCollapsed && this.metadata.outputCollapsed ? 0 : outputTotalHeight); const indicatorHeight = notebookLayoutConfiguration.collapsedIndicatorHeight + outputTotalHeight + outputShowMoreContainerHeight; const outputContainerOffset = notebookLayoutConfiguration.cellTopMargin + notebookLayoutConfiguration.collapsedIndicatorHeight; diff --git a/src/vs/workbench/contrib/notebook/browser/viewModel/markdownCellViewModel.ts b/src/vs/workbench/contrib/notebook/browser/viewModel/markdownCellViewModel.ts index fc457a84707..1703faa5359 100644 --- a/src/vs/workbench/contrib/notebook/browser/viewModel/markdownCellViewModel.ts +++ b/src/vs/workbench/contrib/notebook/browser/viewModel/markdownCellViewModel.ts @@ -129,7 +129,7 @@ export class MarkdownCellViewModel extends BaseCellViewModel implements ICellVie })); this._register(model.onDidChangeMetadata(e => { - if (this.metadata?.inputCollapsed) { + if (this.metadata.inputCollapsed) { this._onDidHideInput.fire(); } })); @@ -153,7 +153,7 @@ export class MarkdownCellViewModel extends BaseCellViewModel implements ICellVie layoutChange(state: MarkdownCellLayoutChangeEvent) { // recompute - if (!this.metadata?.inputCollapsed) { + if (!this.metadata.inputCollapsed) { const editorWidth = state.outerWidth !== undefined ? this.viewContext.notebookOptions.computeMarkdownCellEditorWidth(state.outerWidth) : this._layoutInfo.editorWidth; diff --git a/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.ts b/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.ts index 5123621f35b..1a121b5d1c4 100644 --- a/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.ts +++ b/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.ts @@ -169,8 +169,8 @@ export class NotebookCellTextModel extends Disposable implements ICell { ) { super(); this._outputs = outputs.map(op => new NotebookCellOutputTextModel(op)); - this._metadata = metadata || {}; - this._internalMetadata = internalMetadata || {}; + this._metadata = metadata ?? {}; + this._internalMetadata = internalMetadata ?? {}; } getValue(): string { diff --git a/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts b/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts index 74115aeef94..1231c27746c 100644 --- a/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts +++ b/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts @@ -284,7 +284,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel const mainCells = cells.map(cell => { const cellHandle = this._cellhandlePool++; const cellUri = CellUri.generate(this.uri, cellHandle); - return new NotebookCellTextModel(cellUri, cellHandle, cell.source, cell.language, cell.cellKind, cell.outputs || [], cell.metadata, cell.internalMetadata, this.transientOptions, this._modeService); + return new NotebookCellTextModel(cellUri, cellHandle, cell.source, cell.language, cell.cellKind, cell.outputs, cell.metadata, cell.internalMetadata, this.transientOptions, this._modeService); }); for (let i = 0; i < mainCells.length; i++) { diff --git a/src/vs/workbench/contrib/notebook/common/notebookCommon.ts b/src/vs/workbench/contrib/notebook/common/notebookCommon.ts index 482129fac5a..caf2ded1702 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookCommon.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookCommon.ts @@ -195,7 +195,8 @@ export interface ICell { language: string; cellKind: CellKind; outputs: ICellOutput[]; - metadata?: NotebookCellMetadata; + metadata: NotebookCellMetadata; + internalMetadata: NotebookCellInternalMetadata; onDidChangeOutputs?: Event; onDidChangeLanguage: Event; onDidChangeMetadata: Event; diff --git a/src/vs/workbench/contrib/notebook/test/notebookTextModel.test.ts b/src/vs/workbench/contrib/notebook/test/notebookTextModel.test.ts index 5a3969a77f4..59bb65360de 100644 --- a/src/vs/workbench/contrib/notebook/test/notebookTextModel.test.ts +++ b/src/vs/workbench/contrib/notebook/test/notebookTextModel.test.ts @@ -304,7 +304,7 @@ suite('NotebookTextModel', () => { }], true, undefined, () => undefined, undefined); assert.strictEqual(textModel.cells.length, 1); - assert.strictEqual(textModel.cells[0].metadata?.customProperty, undefined); + assert.strictEqual(textModel.cells[0].metadata.customProperty, undefined); } ); }); @@ -330,7 +330,7 @@ suite('NotebookTextModel', () => { }], true, undefined, () => undefined, undefined); assert.strictEqual(textModel.cells.length, 1); - assert.strictEqual(textModel.cells[0].metadata?.customProperty, 15); + assert.strictEqual(textModel.cells[0].metadata.customProperty, 15); } ); });