Skip to content

Allow Python "Run ..." commands to run in different terminals. #15324

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

Closed
chrissyast opened this issue Feb 5, 2021 · 2 comments
Closed

Allow Python "Run ..." commands to run in different terminals. #15324

chrissyast opened this issue Feb 5, 2021 · 2 comments
Labels
area-terminal feature-request Request for new features or functionality

Comments

@chrissyast
Copy link

chrissyast commented Feb 5, 2021

Environment data

  • VS Code version: 1.53.0
  • Extension version (available under the Extensions sidebar): 2021.1.502429796
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): Not sure
  • Value of the python.languageServer setting: "Jedi"

Example - https://github.com/chrissyast/python_test

  1. Open foo.py, click the "Run Python File in Terminal" button.
    Terminal window opens, runs foo.py
  2. Open a new terminal window
  3. Repeat step 1 for bar.py

Current behaviour
UI reverts back to the terminal from step 1, fails to start bar.py

Expected behaviour
bar/main.py is either opened in the active terminal window or a new terminal.

Note - not duplicate of #85 because the solution re-uses existing terminal. Also believe #488 was incorrectly marked as a duplicate of 85

@chrissyast chrissyast added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Feb 5, 2021
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Feb 8, 2021
@ericsnowcurrently
Copy link

@chrissyast, thanks for letting us know about this (and about #488). As you found, currently the Python extension re-uses the terminal it created the first time "Run Python File in Terminal" executed, regardless of the originating file or code, as long as it's using the same Python executable (and under the same workspace folder if using multiple workspace roots). So the behavior is what we intended.

That said, I can see how in some cases it can be helpful to open a new terminal window (or to re-use an already open terminal). Part of the problem for the Python extension is that VS Code does not provide any way to interact with the terminal, other than to send text to it. That means the extension cannot tell if the terminal is waiting at a shell prompt or not. One solution would be to open a new terminal every time rather than ever re-using it. We'll look into whether or not that (or some other solution) would be a feasible enhancement for the Python extension.

(FYI, the same terminal is re-used for "Run Selection in Python Terminal", which is a problem for "Run Python File in Terminal".)

@ericsnowcurrently ericsnowcurrently changed the title Unable to run Python in new terminal window Allow Python "Run ..." commands to run in different terminals. Feb 8, 2021
@ericsnowcurrently ericsnowcurrently added needs decision feature-request Request for new features or functionality and removed bug Issue identified by VS Code Team member as probable bug triage labels Feb 8, 2021
@ericsnowcurrently ericsnowcurrently removed their assignment Feb 8, 2021
@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Mar 24, 2021
@luabud luabud added needs decision and removed triage-needed Needs assignment to the proper sub-team labels Mar 24, 2021
@luabud
Copy link
Member

luabud commented Mar 24, 2021

We plan to improve the run in terminal experience in the future, I created #15770 to track improvements in this area. So I'm closing it in favour of that.

Thanks!

@luabud luabud closed this as completed Mar 24, 2021
@ghost ghost removed the needs decision label Mar 24, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-terminal feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

4 participants