diff --git a/src/client/repl/replCommands.ts b/src/client/repl/replCommands.ts index 8000c0e12653..fb1ac6d582c9 100644 --- a/src/client/repl/replCommands.ts +++ b/src/client/repl/replCommands.ts @@ -22,22 +22,8 @@ import { createReplController } from './replController'; let notebookController: NotebookController | undefined; let notebookEditor: NotebookEditor | undefined; -// let allNotebookEditors: [NotebookEditor] | undefined; -// let mapUriToNotebookEditor: Map | undefined; - -// TODO: Need to figure out making separate REPL for each file: -// a.py in REPL. -// b.py run in REPL -// MAPPING Uri to notebookEditor if we want separate REPL for each file. -// Currently: Everything gets sent into one single REPL. - -// TODO: when you reload window, is the REPL still binded to same Python file? -// cache binding uri to to REPL instance or notebookEditor. - // TODO: figure out way to put markdown telling user kernel has been dead and need to pick again. -// TODO: FIGURE OUT WHY INTELLISENSE IS NOT WORKING - async function getSelectedTextToExecute(textEditor: TextEditor): Promise { if (!textEditor) { return undefined; @@ -70,7 +56,7 @@ export async function registerReplCommands( } if (interpreter) { const interpreterPath = interpreter.path; - // How do we get instance of interactive window from Python extension? + if (!notebookController) { notebookController = createReplController(interpreterPath); } @@ -78,10 +64,9 @@ export async function registerReplCommands( const code = await getSelectedTextToExecute(activeEditor); const ourResource = Uri.from({ scheme: 'untitled', path: 'repl.interactive' }); - // const ourResource2 = Uri.file(uri.path); - // How to go from user clicking Run Python --> Run selection/line via Python REPL -> IW opening const notebookDocument = await workspace.openNotebookDocument(ourResource); + // commands.executeCommand('_interactive.open'); command to open interactive window so intellisense is registered. // We want to keep notebookEditor, whenever we want to run. // Find interactive window, or open it. @@ -91,15 +76,6 @@ export async function registerReplCommands( }); } - // Instead we need to first check if notebookEditor for given file Uri exist. - // If it doesnt, we create notebookEditor and add to Map - // if (!mapUriToNotebookEditor?.get(ourResource2) || !mapUriToNotebookEditor.get(ourResource2)) { - // notebookEditor = await window.showNotebookDocument(notebookDocument, { - // viewColumn: ViewColumn.Beside, - // }); - // mapUriToNotebookEditor?.set(ourResource2, notebookEditor); - // } - notebookController!.updateNotebookAffinity(notebookDocument, NotebookControllerAffinity.Default); // Auto-Select Python REPL Kernel