Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonykim1 committed May 10, 2024
1 parent fa76d00 commit 6ff2dce
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions src/client/repl/replCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,8 @@ import { createReplController } from './replController';

let notebookController: NotebookController | undefined;
let notebookEditor: NotebookEditor | undefined;
// let allNotebookEditors: [NotebookEditor] | undefined;
// let mapUriToNotebookEditor: Map<Uri, NotebookEditor> | 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<string | undefined> {
if (!textEditor) {
return undefined;
Expand Down Expand Up @@ -70,18 +56,17 @@ 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);
}
const activeEditor = window.activeTextEditor as TextEditor;

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.
Expand All @@ -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 <Uri, NotebookEditor>
// 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
Expand Down

0 comments on commit 6ff2dce

Please sign in to comment.