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

Use new REPL notebook API #24029

Merged
merged 13 commits into from
Sep 20, 2024
Merged

Use new REPL notebook API #24029

merged 13 commits into from
Sep 20, 2024

Conversation

amunger
Copy link

@amunger amunger commented Aug 30, 2024

No description provided.

@amunger amunger added debt Covers everything internal: CI, testing, refactoring of the codebase, etc. skip tests Updates to tests unnecessary labels Aug 30, 2024
@amunger amunger marked this pull request as ready for review September 3, 2024 19:31
@vs-code-engineering vs-code-engineering bot added this to the September 2024 milestone Sep 3, 2024
@anthonykim1
Copy link

anthonykim1 commented Sep 5, 2024

Thank you for doing this - I'm giving this a try right now.
Is it expected behavior that we see the little jupyter icon next to Python REPL? @amunger

Also the format of .interactive => .ipynb of the untitled interactive file.
Screenshot 2024-09-05 at 11 57 21 AM

@@ -9,7 +9,7 @@ export function createReplController(
const server = createPythonServer([interpreterPath], cwd);
disposables.push(server);

const controller = vscode.notebooks.createNotebookController('pythonREPL', 'interactive', 'Python REPL');
const controller = vscode.notebooks.createNotebookController('pythonREPL', 'jupyter-notebook', 'Python REPL');
Copy link

@anthonykim1 anthonykim1 Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar question here - is interactive type not valid after the new REPL api?

@amunger amunger added the skip package*.json package.json and package-lock.json don't both need updating label Sep 19, 2024
@anthonykim1
Copy link

anthonykim1 commented Sep 20, 2024

I've locally tested this and it seems like Intellisense is broken (not completely broken), but rather acting in weird way it doesn't provide all of the completions that it used to:

The screenshots are the Intellisense we would get before/prior this PR:
IntellisenseWorking1
IntellisenseWorking2

Which provides all the familiar completions from standard library module;
But after pulling in the PR into local branch I've noticed different behavior (the video is building the extension after pulling in local branch):

IntellisenseStillBroken.mov

Also one more bug finding: The very first code sent to native REPL doesn't seem to run/generate output with this PR.

@karthiknadig
Copy link
Member

@amunger In the video you can see it updating the problems view. Should it?

@anthonykim1
Copy link

anthonykim1 commented Sep 20, 2024

Also realized the editor name is different in the video (with changes in this PR)

Before we used to have "Python REPL" as the editor tab name like this(where you would always see Python REPL as editor tab name for native REPL instead of "REPL-1" that you see on the video above:
Screenshot 2024-09-19 at 11 17 46 PM

I think this is because before this PR, we used to run the interactive.open command and specify the editor tab name like:

const interactiveWindowObject = (await commands.executeCommand(
            'interactive.open',
            {
                preserveFocus: true,
                viewColumn: ViewColumn.Beside,
            },
            undefined,
            notebookController.id,
            'Python REPL',
        )) as { notebookEditor: NotebookEditor };

but with switching to using

openNotebookDocument

we aren't passing in the editor tab name.

This would break our logic for

if (tab.label === 'Python REPL') {
since we are relying on the editor tab name for searching.

  • I think we can modify the search so that we look through all the ones with @ REPL - <some_number> but wasn't sure if this was intended.

Having just Python REPL as tab name would be nicer for now since we only allow one universal Python native REPL, but I didn't see any parameter options for openNotebookDocument to pass in editor tab name ourselves :/

@amunger
Copy link
Author

amunger commented Sep 20, 2024

@amunger In the video you can see it updating the problems view. Should it?

It's just another notebook cell, so it will update the problems like anything in the history of the repl would

@amunger
Copy link
Author

amunger commented Sep 20, 2024

The editor label is set with:const editor = window.showNotebookDocument(notebookDocument!, { viewColumn, asRepl: 'Python REPL' });, you might just need to update insiders.

I had jedi set as my language server, so I was seeing the same limited set of completions for both. I'll have to look into why pylance completions aren't working correctly.

I'm not seeing that issue with the initial cell not running, might have to debug it on your machine.

@anthonykim1
Copy link

after talking with @amunger, it seems like the issues for (intellisense, editor tab name, first command getting lost problem) were all resolved after updating vscode-insiders to the latest.
Bumping up the version number should hopefully prevent all of this happening for users.

@amunger amunger enabled auto-merge (squash) September 20, 2024 18:55
@amunger amunger merged commit f9bb1f1 into main Sep 20, 2024
73 checks passed
@amunger amunger deleted the aamunger/notebookRepl branch September 20, 2024 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debt Covers everything internal: CI, testing, refactoring of the codebase, etc. skip package*.json package.json and package-lock.json don't both need updating skip tests Updates to tests unnecessary
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants