vscode-rust
vscode-rust copied to clipboard
How to add command arguments to autogenerated tasks
How do you add arguments to the tasks that are automatically generated by this extension?
Here's the default run task for reference
{
"version": "2.0.0",
"tasks": [
{
"type": "cargo",
"subcommand": "run",
"problemMatcher": [
"$rustc"
],
"group": "build",
"label": "Rust: cargo run - ch2-catsay"
}
]
}
Normally I would use a regular shell type task with a command field and and args array, however that doesn't seem possible for this task format, as adding either of those fields makes the task invalid, appending arguments to the subcommand field also fails.
I think you can't modify the auto-detected tasks supplied by the extension and need to provide custom ones instead: https://code.visualstudio.com/docs/editor/tasks#_custom-tasks. The auto-detected ones are just basic build/check/test/run commands and is more of a shortcut/convenience than anything :)
I think you can't modify the auto-detected tasks supplied by the extension
Why is that? On the contrary, I assume that tasks auto-emitted into tasks.json can be modified. This is why they are shown as configured tasks as opposed to "contributed" tasks in the menu.
It would be nice if a cargo command entry recognized an args array in addition to the subcommand field.
+1
+1