diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/interactiveWindow.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/interactiveWindow.test.ts index 4f8a1211c2d..2f648d6df6f 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/interactiveWindow.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/interactiveWindow.test.ts @@ -20,6 +20,7 @@ async function createInteractiveWindow(kernel: Kernel) { `vscode.vscode-api-tests/${kernel.controller.id}`, undefined )) as unknown as INativeInteractiveWindow; + assert.ok(notebookEditor, 'Interactive Window was not created successfully'); return { notebookEditor, inputUri }; } @@ -66,7 +67,6 @@ async function addCellAndRun(code: string, notebook: vscode.NotebookDocument, i: test('Can open an interactive window and execute from input box', async () => { assert.ok(vscode.workspace.workspaceFolders); const { notebookEditor, inputUri } = await createInteractiveWindow(defaultKernel); - assert.ok(notebookEditor); const inputBox = vscode.window.visibleTextEditors.find( (e) => e.document.uri.path === inputUri.path @@ -83,7 +83,6 @@ async function addCellAndRun(code: string, notebook: vscode.NotebookDocument, i: test('Interactive window scrolls after execute', async () => { assert.ok(vscode.workspace.workspaceFolders); const { notebookEditor } = await createInteractiveWindow(defaultKernel); - assert.ok(notebookEditor); // Run and add a bunch of cells for (let i = 0; i < 10; i++) { @@ -97,19 +96,18 @@ async function addCellAndRun(code: string, notebook: vscode.NotebookDocument, i: test('Interactive window has the correct kernel', async () => { assert.ok(vscode.workspace.workspaceFolders); - const { notebookEditor } = await createInteractiveWindow(defaultKernel); - assert.ok(notebookEditor); + await createInteractiveWindow(defaultKernel); await vscode.commands.executeCommand('workbench.action.closeActiveEditor'); // Create a new interactive window with a different kernel - const { notebookEditor: notebookEditor2 } = await createInteractiveWindow(secondKernel); - assert.ok(notebookEditor2); + const { notebookEditor } = await createInteractiveWindow(secondKernel); + assert.ok(notebookEditor); // Verify the kernel is the secondary one - await addCellAndRun(`print`, notebookEditor2.notebook, 0); + await addCellAndRun(`print`, notebookEditor.notebook, 0); - assert.strictEqual(secondKernel.associatedNotebooks.has(notebookEditor2.notebook.uri.toString()), true, `Secondary kernel was not set as the kernel for the interactive window`); + assert.strictEqual(secondKernel.associatedNotebooks.has(notebookEditor.notebook.uri.toString()), true, `Secondary kernel was not set as the kernel for the interactive window`); }); }); diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts index 17d5b63c944..a871da4e1b5 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts @@ -2112,6 +2112,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD async executeNotebookCells(cells?: Iterable): Promise { if (!this.viewModel || !this.hasModel()) { + this.logService.info('notebookEditorWidget', 'No NotebookViewModel, cannot execute cells'); return; } if (!cells) {