Skip to content

Stop creating duplicate REPL and allow new REPL instance #23496

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

Merged
merged 5 commits into from
May 28, 2024

Conversation

anthonykim1
Copy link

@anthonykim1 anthonykim1 commented May 28, 2024

Resolves: #23495
Resolves: #23500

@anthonykim1 anthonykim1 added the bug Issue identified by VS Code Team member as probable bug label May 28, 2024
@anthonykim1 anthonykim1 self-assigned this May 28, 2024
@anthonykim1 anthonykim1 added the skip tests Updates to tests unnecessary label May 28, 2024
@anthonykim1 anthonykim1 marked this pull request as ready for review May 28, 2024 16:39
@vscodenpa 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

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?

Copy link
Author

@anthonykim1 anthonykim1 May 28, 2024

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

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
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

amunger
amunger previously approved these changes May 28, 2024
@anthonykim1 anthonykim1 merged commit da62fb5 into microsoft:main May 28, 2024
42 checks passed
DonJayamanne pushed a commit that referenced this pull request Jun 24, 2024
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