Task user input
Custom tasks in VS Code can prompt a user for input. This input is then inserted into the task execution script.
To start, in the task
section of the tasks.json
, use a ${input:myInput}
variable. Then define a new input
called myInput
in the inputs
section of the tasks.json
.
For example:
{
"version": "2.0.0",
"tasks": [
{
"label": "double",
"type": "shell",
"command": "echo ${input:myInput} ${input:myInput}",
"problemMatcher": []
}
],
"inputs": [
{
"id": "myInput",
"description": "What should I double?",
"type": "promptString"
}
]
}