-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Prevent Cannot read properties of undefined ('show') when running Python code
#25669
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
base: main
Are you sure you want to change the base?
Conversation
Cannot read properties of undefined ('show') when running Python code
| const terminal = this.terminal!; | ||
| // TODO: First execution of shift+enter may get ignored when using sendText. | ||
| // Prevent Cannot read properties of undefined: https://github.com/microsoft/vscode-python-environments/issues/958 | ||
| if (!this.terminal) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this actually queue it up using a worker queue? rather than returning undefined. essentially, wait for terminal to be ready, then when it does get ready, start executing. Until, then all the commands just get added to the queue. This way you can return a promise, that could eventually execute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea, but would this queue also work for synchronous runs? @karthiknadig
I think the problem is that sendText (synchronous) gets called, when terminal is undefined and when its synchronous (sendText), it doesnt really wait for anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this function return a promise regardless of sendText or executeCommand?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me try to come up with way we can actually detect when REPL is launched, maybe that will let us use the queue approach.
Resolves: microsoft/vscode-python-environments#958
Challenge is that sendText would get called when terminal is not ready. And doing
undefined.show()is the problem.Switching to queue based execution for running REPL commands, which would prevent from us losing the first command as well.