Skip to content

Stop creating duplicate REPL and allow new REPL instance - #23496

Merged
Anthony Kim (anthonykim1) merged 5 commits into
microsoft:mainfrom
anthonykim1:fixREPLError
May 28, 2024
Merged

Anthony Kim (anthonykim1) merged 5 commits into
microsoft:mainfrom
anthonykim1:fixREPLError

Conversation

@anthonykim1

@anthonykim1 Anthony Kim (anthonykim1) commented May 28, 2024 •

Copy link
Copy Markdown

Resolves: #23495
Resolves: #23500

@anthonykim1 Anthony Kim (anthonykim1) added the bug Issue identified by VS Code Team member as probable bug label May 28, 2024
@anthonykim1 Anthony Kim (anthonykim1) added the skip tests Updates to tests unnecessary label May 28, 2024
@anthonykim1
Anthony Kim (anthonykim1) marked this pull request as ready for review May 28, 2024 16:39
@vscodenpa VS Code Bot (vscodenpa) added this to the May 2024 milestone May 28, 2024
notebookDocument = interactiveWindowObject.notebookEditor.notebook;
}
// Handle case where user has closed REPL window, and re-opens.
if (notebookEditor && notebookDocument) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

shouldn't these be set to undefined if the REPL window closes?

@anthonykim1 Anthony Kim (anthonykim1) May 28, 2024 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Exactly, that is the intended behavior and not properly handling that was the root cause of the problems. Hence why we would want to watch for user when they close the REPL window and explicitly set them to undefined:

 if (!interactiveWindowIsOpen) {
        notebookEditor = undefined;
        notebookDocument = undefined;
    }

so then we can create a valid and fresh REPL instance again when user shift+enter.

With the code block that starts at line 109 (if statement block), we need in order to show the "new" instance of REPL after user has exited out of previous REPL instance and want to trigger REPL again. Excluding the showNotebook call stopped REPL from being shown if user has exited out of one REPL instance.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This also runs every time the command is run, right? It's probably fine to show bring the editor up front every time for that command, but selecting the kernel every time is a bit strange - maybe that should go into the conditional above where the editor is being created.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I believe so, I think we should be fine but just wanted to be safe..
I removed it in the latest commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-repl bug Issue identified by VS Code Team member as probable bug skip tests Updates to tests unnecessary

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python Repl: New REPL view opened on every invocation Make sure to native send to same REPL instance

3 participants