Enable expand/collapse cell commands to be called programmatically

See microsoft/vscode-jupyter#8477
This commit is contained in:
Rob Lourens 2021-12-07 17:52:00 -08:00
parent 3baa168461
commit bad4294784

View file

@ -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<void> {
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<void> {
if (context.ui) {
context.cell.isInputCollapsed = false;