From 1e9c0a643e435fdff2ce4e2909824b8a6803589c Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Wed, 28 Apr 2021 07:47:00 -0700 Subject: [PATCH] Fix notebook cell collapse action Fix #122318 --- .../workbench/contrib/notebook/browser/contrib/coreActions.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts b/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts index 04740c1163d..46fd3c2e491 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts @@ -1385,7 +1385,8 @@ abstract class ChangeNotebookCellMetadataAction extends NotebookCellAction { const metadataDelta = this.getMetadataDelta(); const edits: ICellEditOperation[] = []; - for (const cell of context.selectedCells || []) { + const targetCells = (context.cell ? [context.cell] : context.selectedCells) ?? []; + for (const cell of targetCells) { const index = textModel.cells.indexOf(cell.model); if (index >= 0) { edits.push({ editType: CellEditType.Metadata, index, metadata: { ...context.cell.metadata, ...metadataDelta } });