Skip to content

"Python › Terminal: Focus After Launch" is confusing #24396

@injust

Description

@injust

Behaviour

With the default settings, running a Python file (using the "Python: Run File in Terminal" command) does not focus the terminal. This is fine.

I want to focus the terminal as soon as the Python file starts running (a reasonable use case for scripts that accept user input), so I enable "Python › Terminal: Focus After Launch" (python.terminal.focusAfterLaunch). The description makes sense to me:

When launching a python terminal, whether to focus the cursor on the terminal.

But the title is "Focus After Launch", and that is what it literally does: It launches the Python process, waits for it to exit (?!), and then focuses the terminal. Unless there's a valid use case that I'm missing, this setting should instead focus the terminal upon launch, not after.


Turns out there is a setting to do what I want (focus the terminal upon launch): "Terminal › Integrated: Focus After Run" (terminal.integrated.focusAfterRun).

Controls whether the terminal, accessible buffer, or neither will be focused after Terminal: Run Selected Text In Active Terminal has been run.

The naming and description are both confusing:

  1. What's the difference between "after launch" and "after run"? It's focusing the terminal as soon as the command is run, not afterward.
  2. This isn't specific to Terminal: Run Selected Text In Active Terminal at all.

Steps to reproduce:

  1. Create and save a Python file that sleeps, and another that takes user input
  2. Enable "Python › Terminal: Focus After Launch" (python.terminal.focusAfterLaunch) and/or "Terminal › Integrated: Focus After Run" (terminal.integrated.focusAfterRun)
  3. Run the "Python: Run Python File" command

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions