diff --git a/src/client/repl/replCommands.ts b/src/client/repl/replCommands.ts index d9d0858a6637..fd9b74f6602e 100644 --- a/src/client/repl/replCommands.ts +++ b/src/client/repl/replCommands.ts @@ -82,20 +82,18 @@ export async function registerReplCommands( const activeEditor = window.activeTextEditor as TextEditor; const code = await getSelectedTextToExecute(activeEditor); - if (!notebookEditor) { - const interactiveWindowObject = (await commands.executeCommand( - 'interactive.open', - { - preserveFocus: true, - viewColumn: ViewColumn.Beside, - }, - undefined, - notebookController.id, - 'Python REPL', - )) as { notebookEditor: NotebookEditor }; - notebookEditor = interactiveWindowObject.notebookEditor; - notebookDocument = interactiveWindowObject.notebookEditor.notebook; - } + const interactiveWindowObject = (await commands.executeCommand( + 'interactive.open', + { + preserveFocus: true, + viewColumn: ViewColumn.Beside, + }, + undefined, + notebookController.id, + 'Python REPL', + )) as { notebookEditor: NotebookEditor }; + notebookEditor = interactiveWindowObject.notebookEditor; + notebookDocument = interactiveWindowObject.notebookEditor.notebook; if (notebookDocument) { notebookController.updateNotebookAffinity(notebookDocument, NotebookControllerAffinity.Default);