Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove interrupt button from the notebook editor toolbar. #11359

Merged
merged 3 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,420 changes: 1,210 additions & 1,210 deletions TELEMETRY.csv

Large diffs are not rendered by default.

2,874 changes: 1,437 additions & 1,437 deletions TELEMETRY.md

Large diffs are not rendered by default.

28 changes: 0 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -653,17 +653,6 @@
},
"enablement": "isWorkspaceTrusted && jupyter.interactive.canRestartNotebookKernel"
},
{
"command": "jupyter.notebookeditor.interruptkernel",
"title": "%jupyter.command.jupyter.interruptkernel.title%",
"shortTitle": "%jupyter.command.jupyter.interruptkernel.shorttitle%",
"category": "Notebook",
"icon": {
"light": "resources/light/interrupt.svg",
"dark": "resources/dark/interrupt.svg"
},
"enablement": "notebookKernel =~ /^ms-toolsai.jupyter\\// && notebookType == 'jupyter-notebook' && isWorkspaceTrusted && jupyter.notebookeditor.canInterruptNotebookKernel"
},
{
"command": "jupyter.notebookeditor.restartkernel",
"title": "%jupyter.command.jupyter.restartkernel.title%",
Expand Down Expand Up @@ -918,12 +907,6 @@
"group": "navigation@1",
"when": "notebookKernel =~ /^ms-toolsai.jupyter\\// && notebookType == 'jupyter-notebook' && isWorkspaceTrusted && jupyter.notebookeditor.canrestartNotebookkernel && config.notebook.globalToolbar != true"
},
{
"command": "jupyter.notebookeditor.interruptkernel",
"title": "%jupyter.command.jupyter.interruptkernel.title%",
"group": "overflow@1",
"when": "notebookKernel =~ /^ms-toolsai.jupyter\\// && notebookType == 'jupyter-notebook' && isWorkspaceTrusted && jupyter.notebookeditor.canInterruptNotebookKernel && config.notebook.globalToolbar != true"
},
{
"command": "jupyter.openVariableView",
"title": "%jupyter.command.jupyter.openVariableView.title%",
Expand Down Expand Up @@ -955,11 +938,6 @@
"group": "navigation/execute@1",
"when": "notebookKernel =~ /^ms-toolsai.jupyter\\// && notebookType == 'jupyter-notebook' && isWorkspaceTrusted && jupyter.kernel.isjupyter"
},
{
"command": "jupyter.notebookeditor.interruptkernel",
"group": "navigation/execute@2",
"when": "notebookKernel =~ /^ms-toolsai.jupyter\\// && notebookType == 'jupyter-notebook' && isWorkspaceTrusted && jupyter.kernel.isjupyter"
},
{
"command": "jupyter.openVariableView",
"group": "navigation@1",
Expand Down Expand Up @@ -1364,12 +1342,6 @@
"category": "Notebook",
"when": "jupyter.havenativecells && jupyter.isnativeactive && isWorkspaceTrusted"
},
{
"command": "jupyter.notebookeditor.interruptkernel",
"title": "%jupyter.command.jupyter.interruptkernel.title%",
"category": "Notebook",
"when": "notebookType == 'jupyter-notebook' && isWorkspaceTrusted"
},
{
"command": "jupyter.notebookeditor.restartkernel",
"title": "%jupyter.command.jupyter.restartkernel.title%",
Expand Down
1 change: 0 additions & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgu
['notebook.cell.expandCellInput']: [
{ ranges: { start: number; end: number }[]; document?: Uri; autoReveal?: boolean }
];
[DSCommands.NotebookEditorInterruptKernel]: [{ notebookEditor: { notebookUri: Uri } } | undefined | Uri];
[DSCommands.ExportFileAndOutputAsNotebook]: [Uri];
[DSCommands.RunAllCells]: [Uri];
[DSCommands.RunCell]: [Uri, number, number, number, number];
Expand Down
521 changes: 27 additions & 494 deletions src/gdpr.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/notebooks/controllers/vscodeNotebookController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ export class VSCodeNotebookController implements Disposable, IVSCodeNotebookCont
private handleInterrupt(notebook: NotebookDocument) {
notebook.getCells().forEach((cell) => traceCellMessage(cell, 'Cell cancellation requested'));
this.commandManager
.executeCommand(Commands.NotebookEditorInterruptKernel, notebook.uri)
.executeCommand(Commands.InterruptKernel, { notebookEditor: { notebookUri: notebook.uri } })
.then(noop, (ex) => console.error(ex));
}

Expand Down
12 changes: 0 additions & 12 deletions src/notebooks/notebookCommandListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,6 @@ export class NotebookCommandListener implements IDataScienceCommandListener {
this.disposableRegistry.push(
this.commandManager.registerCommand(Commands.NotebookEditorExpandAllCells, this.expandAll, this)
);
this.disposableRegistry.push(
commandManager.registerCommand(
Commands.NotebookEditorInterruptKernel,
(context?: { notebookEditor: { notebookUri: Uri } } | Uri) => {
if (context && 'notebookEditor' in context) {
this.interruptKernel(context?.notebookEditor?.notebookUri).ignoreErrors();
} else {
this.interruptKernel(context).ignoreErrors();
}
}
)
);
this.disposableRegistry.push(
commandManager.registerCommand(
Commands.NotebookEditorRestartKernel,
Expand Down
1 change: 0 additions & 1 deletion src/platform/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ export namespace Commands {
export const NotebookEditorUndoCells = 'jupyter.notebookeditor.undocells';
export const NotebookEditorRedoCells = 'jupyter.notebookeditor.redocells';
export const NotebookEditorRemoveAllCells = 'jupyter.notebookeditor.removeallcells';
export const NotebookEditorInterruptKernel = 'jupyter.notebookeditor.interruptkernel';
export const NotebookEditorRestartKernel = 'jupyter.notebookeditor.restartkernel';
export const NotebookEditorRunAllCells = 'jupyter.notebookeditor.runallcells';
export const NotebookEditorRunSelectedCell = 'jupyter.notebookeditor.runselectedcell';
Expand Down
9 changes: 5 additions & 4 deletions src/test/datascience/notebook/executionService.vscode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,11 @@ suite('DataScience - VSCode Notebook - (Execution) (slow)', function () {
traceInfo(
`Interrupt requested for ${getDisplayPath(vscodeNotebook.activeNotebookEditor?.notebook?.uri)} in test`
);
await commands.executeCommand(
'jupyter.notebookeditor.interruptkernel',
vscodeNotebook.activeNotebookEditor?.notebook.uri
);
await commands.executeCommand('jupyter.interruptkernel', {
notebookEditor: vscodeNotebook.activeNotebookEditor
? { notebookUri: vscodeNotebook.activeNotebookEditor.notebook.uri }
: undefined
});
await waitForExecutionCompletedWithErrors(cell);
// Verify that it hasn't got added (even after interrupting).
assertNotHasTextOutputInVSCode(cell, 'Start', 0, false);
Expand Down
21 changes: 16 additions & 5 deletions src/test/datascience/notebook/interruptRestart.vscode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ suite('DataScience - VSCode Notebook - Restart/Interrupt/Cancel/Errors (slow)',
traceInfo('Step 3');

// Interrupt the kernel.
commandManager.executeCommand(Commands.NotebookEditorInterruptKernel, vscEditor.notebook.uri).then(noop, noop);
commandManager
.executeCommand(Commands.InterruptKernel, { notebookEditor: { notebookUri: vscEditor.notebook.uri } })
.then(noop, noop);
traceInfo('Step 4');

// Wait for interruption (cell will fail with errors).
Expand Down Expand Up @@ -154,7 +156,9 @@ suite('DataScience - VSCode Notebook - Restart/Interrupt/Cancel/Errors (slow)',

// Don't have to wait for interrupt, as sometimes interrupt can timeout & we get a prompt to restart.
// Stop execution of the cell (if possible) in kernel.
commandManager.executeCommand(Commands.NotebookEditorInterruptKernel, vscEditor.notebook.uri).then(noop, noop);
commandManager
.executeCommand(Commands.InterruptKernel, { notebookEditor: { notebookUri: vscEditor.notebook.uri } })
.then(noop, noop);
// Stop the cell (cleaner way to tear down this test, else VS Code can hang due to the fact that we delete/close notebooks & rest of the code is trying to access it).

traceInfo('Step 14');
Expand Down Expand Up @@ -237,7 +241,9 @@ suite('DataScience - VSCode Notebook - Restart/Interrupt/Cancel/Errors (slow)',
console.log('Step2');

// Interrupt the kernel & wait for 2 to cancel & 3 to get de-queued.
commandManager.executeCommand(Commands.NotebookEditorInterruptKernel, vscEditor.notebook.uri).then(noop, noop);
commandManager
.executeCommand(Commands.InterruptKernel, { notebookEditor: { notebookUri: vscEditor.notebook.uri } })
.then(noop, noop);
console.log('Step3');

await Promise.all([
Expand Down Expand Up @@ -275,7 +281,10 @@ suite('DataScience - VSCode Notebook - Restart/Interrupt/Cancel/Errors (slow)',
assert.equal(cell2.executionSummary?.executionOrder, 3, 'Execution order of cell 2 should be 3');

// Interrupt the kernel & wait for 2.
commandManager.executeCommand(Commands.NotebookEditorInterruptKernel, vscEditor.notebook.uri).then(noop, noop);
commandManager
.executeCommand(Commands.InterruptKernel, { notebookEditor: { notebookUri: vscEditor.notebook.uri } })
.then(noop, noop);

console.log('Step7');
await Promise.all([
waitForExecutionCompletedWithErrors(cell2),
Expand Down Expand Up @@ -308,7 +317,9 @@ suite('DataScience - VSCode Notebook - Restart/Interrupt/Cancel/Errors (slow)',
console.log('Step9');

// Interrupt the kernel & wait for 2 to cancel & 3 to get de-queued.
commandManager.executeCommand(Commands.NotebookEditorInterruptKernel, vscEditor.notebook.uri).then(noop, noop);
commandManager
.executeCommand(Commands.InterruptKernel, { notebookEditor: { notebookUri: vscEditor.notebook.uri } })
.then(noop, noop);
console.log('Step10');

await Promise.all([
Expand Down