I know I can assign a keychord to 2 standard tasks: build
and test
in VSCode. I need to do the same with a custom task. How can I do it?
Use runTask
with args
.
{
"key": "shift+cmd+t",
"command": "workbench.action.tasks.runTask",
"args": "The name of your task"
}
You can't currently. Here is the github issue with the feature request. Looks like it keeps getting pushed to 'the next' release.
As the other answer says, you currently cannot. But until it is fixed, there is a ...
Run fixed command line using keyboard shortcut:
^!1::Run mytask.exe myfile.txt
The above one launches command line mytask.exe myfile.txt
on pressing Ctrl+Alt+1.
If you want to limit scope of the shortcut from global to VSCode only, add #IfWinActive directive before that line.
Of course, you can also expand the macro to determine the file dynamically (or from user input) but I wanted to show you some minimum example which is a way to go.