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

Handle reloading of REPL Window #24148

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

anthonykim1
Copy link

Resolves: #24021

@anthonykim1 anthonykim1 self-assigned this Sep 21, 2024
@anthonykim1 anthonykim1 added area-repl feature-request Request for new features or functionality labels Sep 21, 2024
if (this.notebookDocument && nb.uri.toString() === this.notebookDocument.uri.toString()) {
this.notebookDocument = undefined;
this.newReplSession = true;
this.replUri = undefined;
await this.context.globalState.update(NATIVE_REPL_URI_MEMENTO, undefined);
Copy link
Author

@anthonykim1 anthonykim1 Nov 14, 2024

Choose a reason for hiding this comment

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

For the edge case:

create repl, reload repl, close tab, then open notebook, and then we fall into trap where we think notebook is repl.

I dont think we have to worry about this since I set the replUri and memento for native repl to undefined as I watch for notebook document closing. @amunger

Screen.Recording.2024-11-13.at.4.35.56.PM.mov

Copy link

Choose a reason for hiding this comment

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

one more step to test the edge case: create another repl and make sure it doesn't recover "into" the untitled notebook

Copy link

@amunger amunger Nov 14, 2024

Choose a reason for hiding this comment

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

to make it even more air tight, disable the python extension before reloading, and re-enable after creating the untitled notebook. That would simulate closing the tab before the python extension activated. At that point you would probably also need to check the label.

  1. create repl
  2. disable python extension
  3. reload vs code
  4. close the repl tab
  5. create new notebook
  6. enable python extension
  7. create python repl

Copy link
Author

@anthonykim1 anthonykim1 Nov 14, 2024

Choose a reason for hiding this comment

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

Progress notes:

Testing this DOES seem like repl almost steals the new untitled notebook.
Trying to solve this by finding fileName or tab name but both untitled notebook and Python REPL show up as 'Untitled-ipynb' :/

Screenshot 2024-11-14 at 3 52 01 PM

Screenshot 2024-11-14 at 3 50 50 PM

Copy link
Author

Choose a reason for hiding this comment

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

I think the only place Python extension does anything with tab name is:


when we call showNotebookDocument and pass 'Python REPL' as asRepl here

export interface NotebookDocumentShowOptions {
		/**
		 * The notebook should be opened in a REPL editor,
		 * where the last cell of the notebook is an input box and the other cells are the read-only history.
		 * When the value is a string, it will be used as the label for the editor tab.
		 */
		readonly asRepl?: boolean | string | {

Could this is bug in the NotebookDocumentShowOptions or showNotebook document where tab name somehow gets lost? @amunger

Copy link

Choose a reason for hiding this comment

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

the label property on the tab object should work
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-repl feature-request Request for new features or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

REPL: support window reload
2 participants