This commit is contained in:
rebornix
2021-01-20 17:52:19 -08:00
parent 6e56202803
commit 26aaaeb11c
@@ -578,9 +578,37 @@ registerAction2(class extends NotebookAction {
super({
id: CANCEL_NOTEBOOK_COMMAND_ID,
title: localize('notebookActions.cancelNotebook', "Cancel Notebook Execution"),
description: {
description: localize('notebookActions.executeNotebook', "Execute Notebook"),
args: [
{
name: 'uri',
description: 'The document uri',
constraint: URI
}
]
},
});
}
getEditorContextFromArgsOrActive(accessor: ServicesAccessor, context?: UriComponents): INotebookActionContext | undefined {
if (context) {
const uri = URI.revive(context);
if (uri) {
const widget = getWidgetFromUri(accessor, uri);
if (widget) {
return {
notebookEditor: widget,
};
}
}
}
return undefined;
}
async runWithContext(accessor: ServicesAccessor, context: INotebookActionContext): Promise<void> {
return context.notebookEditor.cancelNotebookExecution();
}