Skip to content

"Run selection in python terminal" sometimes creates a new terminal when one already is being used #18053

Closed
@DEVNULLDNE

Description

@DEVNULLDNE

VS Code version

1.62.2

Extension version

v2021.11.1422169775

OS type

Windows

OS version

10

Python distribution

python.org

Python version

3.9.7

Language server

Pylance

Expected behaviour

If there is already a python terminal open, the code will be sent to and run on that terminal.

Actual behaviour

It mostly works as expected. Seemingly randomly it will decide to open a new terminal. If I close this new terminal and try again, it will still open a new terminal. This usually happens after I have not been using the terminal for awhile. Though, the last time this happened it was more like 5 minutes.

I read somewhere that this command basically looks for a terminal named "Python" running python. Creating such a terminal by hand doesn't cause this command to send that terminal the selection though as it will still create a new terminal. It seems like this should be the way it works though so that just changing the name of a terminal will allow you to run code in the terminal of your choosing if you want to run multiple python terminals.

Steps to reproduce

I don't know why it happens. It usually happens after a long period of time but the last time was around 5 minutes.

Here are a list of things I didn't do in those 5 minutes.

  • Create or delete any terminals
  • Do anything related to extensions

Here's a list of things I might have done:

  • Interacted with my web browser
  • Used another vscode window that was also running a python terminal and used the command

I could not reproduce the problem with various ways of interacting with 2 vscode windows each having a python terminal though.

I have noticed this problem for maybe 3 weeks. I don't really know if the behavior is new from when I started using this extension and vscode though which was maybe 3 months ago.

Logs

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

area-terminalbugIssue identified by VS Code Team member as probable buginvestigatingWe are looking into the cause of the issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions