-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix preview command sometimes not executing on Windows #81
Conversation
Nice, thanks! I will check if this still works for me. Generally, I'd favor a solution where we don't have to additionally detect the |
I would also want to find a better solution than this. However, others have run into the same issue on the IPython repo and the vscode-python repo, so it does not seem to have an easy fix. This solution should work out of the box for new users. Adding a delay between writing the command and the newline requires users to tweak the delay value. |
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.
Thanks, looks good to me, just a few more minor comments.
Yeah, this solution is definitely better than adding a delay. I just hope there will be a solution that gets to the root of this problem by means of a fix in the IPython repo or somewhere else where something like this would be tackled. But for now, if this fixes your problem that's already great and luckily this is also a fix that might be easily revertible once a solution is found in the future. |
Sadly, I tried again with shell integration and this time it broke again... After some debugging I found that it thinks that there is a command running after sending the checkpoint_paste(). So, when sending the extra newline, it will first send a CTRL+C to stop the first command, deleting the checkpoint_paste() line. I haven't been able to break the sendText method, so let's stick to that for now. |
Great, thanks for addressing all the points. The code looks good to me now. I just want to test this out a bit on my machine and ensure it doesn't break anything for me (we definitely need unit and integration tests in the very near future🙈, see #47). I will probably only be able to report on Friday as I'm a bit busy beforehand. |
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.
Thanks! I've tested it on my machine and it works fine. I've also checked that users can still enter the multi-line mode, e.g. when they manually type in a for-loop in the IPython shell. It works since you check for this.isExecutingCommand
👍
This PR attempts to fix the preview command on Windows. As seen in this video, sometimes checkpoint_paste() is not executed in the IPython shell, but it triggers the multiline input in IPython. In this PR, I detect the multiline input ("...:") and send "\x7F" to clear the extra line and send another newline to actually execute the command. This seems to fix the issue on my side. Let me know if you have any issues on other platforms!
Fixes #18