How to move cursor automatically from code editor to terminal in VS Code|TechnOrchid - NilRanbow
by Subrata Ghosh. Powered by Blogger.

Contact Form

Name

Email *

Message *

Wednesday, July 28, 2021

How to move cursor automatically from code editor to terminal in VS Code|TechnOrchid


problem:

I am using Microsoft VS Code version 1.34.0 (64-bit version) on Windows 10 64 bit. I have "Python" and "Code Runner" extensions installed and using them for Python 3.7.3


I click on the triangle in the top right corner to run code or do Ctrl + Alt + N. When I run code that needs user input, I can see the message(if provided any in code) and cursor in Terminal but the cursor is inactive (empty rectangle). The active cursor (blinking) is still in the code editor pane.


Is there any way to automatically move the active cursor from the code editor to Terminal for user input?


I am trying to avoid one extra mouse click or (Ctrl + ')


solution:

  • Install Code Runner from vscode extensions 
  • Then add the following line in settings.json :

                   ,"code-runner.preserve Focus": false






how to open settings.json?

  • Open  VS Code command palette using the keyboard shortcut Ctrl+Shift+P on Windows or Cmd+Shift+P on Mac.
  • Then type “settings JSON” into the command palette.
  • Click the top item, “Preferences: Open Settings (JSON).”



Mind pixel for creative mind: https://www.facebook.com/Mind-Pixel-2126754300731416

Thanks for coming!