You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We added a new command (with command ID runCommands) that allows running multiple commands, passed to runCommands as argument. It allows creating a single keybinding that can run multiple commands when triggered.
runCommands takes a single argument of this shape:
Let's add a keybinding that uses this command and make sure things run as expected:
Open your keybindings.json (you can invoke command "Open Keyboard Shortcuts (JSON)" from command palette)
Create a new keybinding that uses runCommands within keybindings.json, e.g., your keybindings.json contents could look like this - we have two keybindings:
[
{ // hide or show all help-bars"key": "ctrl+h",
"command": "runCommands",
"args": {
"commands": [
"workbench.action.toggleSidebarVisibility",
"workbench.action.toggleActivityBarVisibility",
"workbench.action.toggleAuxiliaryBar"
]
}
},
{ // create a new file and insert the msft header "key": "ctrl+n",
"command": "runCommands",
"args": {
"commands": [
{
"command": "workbench.action.files.newUntitledFile",
"args": {
"languageId": "typescript",
}
},
{
"command": "type",
"args": {
"text": "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/"
}
},
]
}
}
]
Make sure these keybindings work as expected (don't mind indentation issues with the second command if there're any)
Part 2
When you're editing command IDs (for field command) and arguments (args field) make sure you get code completion for command names & argument fields - both when writing the keybinding object and when writing an object to pass to runCommands.
That's it, thank you very much for testing!
I invite you to get creative with the new runCommands :-)
The text was updated successfully, but these errors were encountered:
Refs: #871
Complexity: 3
Create Issue
Summary
We added a new command (with command ID
runCommands
) that allows running multiple commands, passed torunCommands
as argument. It allows creating a single keybinding that can run multiple commands when triggered.runCommands
takes a single argument of this shape:Testing
Part 1
Let's add a keybinding that uses this command and make sure things run as expected:
keybindings.json
(you can invoke command "Open Keyboard Shortcuts (JSON)" from command palette)runCommands
withinkeybindings.json
, e.g., yourkeybindings.json
contents could look like this - we have two keybindings:Part 2
When you're editing command IDs (for field
command
) and arguments (args
field) make sure you get code completion for command names & argument fields - both when writing the keybinding object and when writing an object to pass torunCommands
.That's it, thank you very much for testing!
I invite you to get creative with the new
runCommands
:-)The text was updated successfully, but these errors were encountered: