question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python Environment + Terminal focus not working when key binding is used for workbench.action.terminal.new

See original GitHub issue

Environment data

  • VS Code version: 1.45.1
  • Extension version (available under the Extensions sidebar): 2020.5.86398
  • OS and version: Linux x64 5.6.2-050602-generic (MINT)
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.9
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv
  • Relevant/affected Python packages and their versions:
  • Relevant/affected Python-related VS Code extensions and their versions:
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info #3977):
  • Value of the python.languageServer setting:
"python.jediEnabled": false,

Expected behaviour

Once the virtual environment is activated focus should be on terminal

Actual behaviour

Right now if I create a new terminal using key binding(ctrl+alt+insert) it creates a new terminal and active my virtual environment but I lose the focus. BTW, this happens sometimes(maybe 65%) which makes it more irritating.

Steps to reproduce:

  1. Use keybinding for new terminal:
    {
        "key": "ctrl+alt+insert",
        "command": "workbench.action.terminal.new"
    },
  1. (In my case I already have other terminals running and terminal is open but the focus is on editor)
  2. Keep the focus on the editor (writing code)
  3. Hit the key bound to create new terminal (ctrl+alt+insert)
  4. Try to type (Sometimes terminal got focus sometime don’t) 🤷‍♂️

Youtube Video (Listen for key-strokes to understand better)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kimadelinecommented, Jun 18, 2020

Thank you for your reply! Seems like "workbench.action.terminal.new" and python.createTerminal don’t behave the same, so I’ve taken the conversation back to VS Code’s repo. I’ll close this issue for now so that we don’t have to keep an eye on 2 different issues, but I’ll reopen it if necessary.

0reactions
jd-solankicommented, Jun 16, 2020

Hi, @kimadeline Thanks for reviewing it.

Does it mean that if you work with the default Python install (not in a virtual environment) the terminal will get focus 100% of the time?

Yes

Do you get the same issues if you use the python.createTerminal command instead

Nope I done around 15 tests and all of them got focus on terminal

Thanks for that screencast I didn’t known about that. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Integrated Terminal in Visual Studio Code
Use the Ctrl+Shift+` keyboard shortcut to create a new terminal. Use the View > Terminal or Terminal > New Terminal menu commands.
Read more >
vscode key binding !terminalFocus not working after update?
By default, keybindings are dispatched to the workbench instead of the terminal as specified in terminal.integrated.commandsToSkipShell .
Read more >
User and Workspace Settings - vscode-docs1 - Read the Docs
showCommands) ) with Preferences: Open User Settings and Preferences: Open Workspace Settings or use the keyboard shortcut ( kb(workbench.action.
Read more >
Integrated Terminal - 《Visual Studio Code v1.46 Document》
Why is VS Code shortcut X not working when the terminal has focus? ... panel or by triggering the kb(workbench.action.terminal.new) command.
Read more >
Bring Your Vim/Tmux Navigation Reflexes to VS Code
After installing the Vim extension, a few choice keybindings can help VS Code play even nicer with your terminal muscle memory.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found