From bad4294784f8d17bda94fcc6a9101f5051755f74 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Tue, 7 Dec 2021 17:52:00 -0800 Subject: [PATCH] Enable expand/collapse cell commands to be called programmatically See microsoft/vscode-jupyter#8477 --- .../notebook/browser/contrib/cellCommands/cellCommands.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.ts b/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.ts index 06752200948..03941006678 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.ts @@ -344,6 +344,10 @@ registerAction2(class CollapseCellInputAction extends NotebookMultiCellAction { }); } + override parseArgs(accessor: ServicesAccessor, ...args: any[]): INotebookCommandContext | undefined { + return parseMultiCellExecutionArgs(accessor, ...args); + } + async runWithContext(accessor: ServicesAccessor, context: INotebookCommandContext | INotebookCellToolbarActionContext): Promise { if (context.ui) { context.cell.isInputCollapsed = true; @@ -372,6 +376,10 @@ registerAction2(class ExpandCellInputAction extends NotebookMultiCellAction { }); } + override parseArgs(accessor: ServicesAccessor, ...args: any[]): INotebookCommandContext | undefined { + return parseMultiCellExecutionArgs(accessor, ...args); + } + async runWithContext(accessor: ServicesAccessor, context: INotebookCommandContext | INotebookCellToolbarActionContext): Promise { if (context.ui) { context.cell.isInputCollapsed = false;