Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to get the focus (cursor) from the editor to the panel(terminal) visual studio code extension

I am writing a visual studio code extension and at some point, when I call a command to open and run a script at the terminal, I want simultaneously the terminal to take the focus (cursor) from everywhere else.

Thank you in advance.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It is as simple as this:

vscode.commands.executeCommand("workbench.action.terminal.focus");

You’re basically invoking a command with the same identifier you’d use if you were to assign it to a keyboard shortcut – and you can look up other commands in the editor itself if you invoke workbench.action.openGlobalKeybindings.

Documented here.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading