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

Use sendText to send Python code to Terminal REPL for Python >= 3.13 #24765

Merged
merged 15 commits into from
Feb 4, 2025

Conversation

anthonykim1
Copy link

@anthonykim1 anthonykim1 commented Jan 31, 2025

Resolves: #24674 (comment)
Use sendText to send Python code to Terminal REPL for Python >= 3.13 to prevent keyboard interrupt.

Relevant file context from VS Code: https://github.com/microsoft/vscode/blob/f9c927cf7a29a59b896b6cdac2d8b5d2d43afea5/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts#L906

It seems like we are on this edge scenario where generic terminal shell integration is enabled (so executeCommand can be used), but we have temporarily disabled Python shell integration for Python >= 3.13 (and of course sending the relevant escape sequences such as the commandLine itself to VS Code). Why?

Why and where I think the keyboard interrupt is happening:
Python extension tries to executeCommand when sending commands to terminal REPL >= Python3.13, where we are not sending shell integration escape sequences from the Python side.

  • I think this is why it is attaching the keyboard interrupt all the sudden, because VS Code see that Python extension is requesting executeCommand but is not sending the commandLine escape sequence to them. For every other versions < 3.13 (where we send all the shell integration escape sequences including the commandLine), this does not happen.

@anthonykim1 anthonykim1 added bug Issue identified by VS Code Team member as probable bug area-terminal labels Jan 31, 2025
@anthonykim1 anthonykim1 added this to the February 2025 milestone Jan 31, 2025
@anthonykim1 anthonykim1 self-assigned this Jan 31, 2025
@@ -261,6 +280,36 @@ suite('Terminal Service', () => {
terminal.verify((t) => t.sendText(TypeMoq.It.isValue(textToSend)), TypeMoq.Times.never());
});

test('Ensure sendText is called when Python shell integration and terminal shell integration are both enabled - Mac, Linux && Python >= 3.13', async () => {
Copy link
Author

Choose a reason for hiding this comment

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

Note we will start using executeCommand again once we resolve all the Python3.13 related issue and start using Python shell integration again.

@anthonykim1 anthonykim1 marked this pull request as ready for review February 4, 2025 19:13
Copy link

⚠️ This PR originates from a fork. Due to security restrictions, pipelines from forks are no longer triggered automatically. Learn more.

If the changes appear safe, you can manually trigger the pipeline by commenting /AzurePipelines run.

@anthonykim1 anthonykim1 merged commit 6b784e5 into microsoft:main Feb 4, 2025
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-terminal bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running a file in WSL executes ^C(keyboardInterrupt) before running
2 participants