Task Runner: Provide input parameters
- VSCode Version: 0.10.11
- OS Version: Mac OS X El Capitan
I would like to provide input parameters when a task is executed. How can I accomplish this?
The documentation mentions "variable substitution," which is useful, but a browser search for "param" yields nothing.
Cheers, Trevor Sullivan Microsoft MVP: PowerShell
This is not supported right now. What would be cool is if you select the task in the quick box if you could provide params there. But this filters right now.
Any progress on this?
No. Nothing has happend here so far.
Any chance this will end up in VSCode anytime in the near future? :)
We want to have a task to switch branches across all of our microservices dynamically based on a text string to allow our QA teams to switch to a develop snapshot. Being able to prompt for that string would be of great use to us.
Also, it will be great if we could define, in tasks.json, a list of optional variables something like:
{
"label": "task with options",
"type": "shell",
"command": "command-on-${module}",
"options": [
"module1",
"module2",
"module3"
]
}
Thanks!
+1
+1
Being able to manage low-to-medium complexity workflow operations directly from VSCode would be great.
Certainly would be very beneficial to have this ability!
Launch configurations support to embed variables that can be used to ask for input through the UI. Please see https://github.com/Microsoft/vscode/issues/30588.
It is not difficult to support the same for tasks (because they share most of the variable implementation anyway).
This is of great interest to me. I work on a CLI project (Angular CLI) and would love to re-use a common debug launch configuration with different arguments.
@weinand I took a look at #30588 and the extension you linked to didn't work for me.
I've also tried to prompt for values using the preLaunchTask option as well with no luck.
@Brocco
Sorry, I'm not the author of the linked extension and I did not read the description thoroughly.
The documentation is outdated: VS Code has changed the syntax for command variables from an ambiguous '.' to a more readable ':'
So instead of ${command.prompt-debug.resolve} please use ${command:prompt-debug.resolve} and it will work fine. I'll file an issue against the extension.
How did you try to prompt for values using the preLaunchTask? Please note that "tasks" do not support prompting variables; only launch configurations do.
@Brocco could you get the extension to work?
I got it to prompt me, but the entry of the values was confusing and I couldn't get the value I wanted into the launch config.
Admittedly I didn't have a whole lot fo time to play with it and reverted back to my previous workflow for now.
Sorry, but the extension was meant to be an example showing that you can easily support user input for specific work flows.
Just let me know what you need, and I can sketch something up.
It would be good to be able set an input when calling the task. Sometimes we need to run a build or even a test that needs some flags or filters as input depending of what we need.
The task caller can prompt for user input after selecting the task (having in task.json like: "argsPrompt": true) or having some predefined arguments to select before running. Or both :)
+1
+1
+1
+1