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.
CodePudding user response:
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.