I am debugging my code using a launch.json
file. I have a long list of command line arguments:
"args": [
"-i", "inputfile",
"-o", "outputfile",
"--option", "do_stuff",
"--very-long-option", "do_some_serious_stuff",
...
]
It works well. But now I would like to run the same program with the same arguments using command prompt:
my_prog -i inputfile -o outputfile --option do_stuff --very-long-option do_some_serious_stuff ...
I can generate this command line manually by editing the data taken from the launch.json
file, but it's time-consuming and error-prone. How can I make VSCode print this command line for me each time I debug my program?
I tried adding the following to my tasks.json
file:
{
"label": "echo_cmd_line",
"command": "echo",
"args": ["args are", "${args}"],
"type": "shell"
},
and the following to my launch.json
file:
"preLaunchTask": "echo_cmd_line",
but it outputs just args are
. Not sure I can access arguments in this way.
How can I make it work?
This currently seems to be impossible.
As noted by this answer, this feature was requested 7 years ago but not implemented yet, so probably not deemed important enough.