vscode-rust icon indicating copy to clipboard operation
vscode-rust copied to clipboard

How to add command arguments to autogenerated tasks

Open mbartelsm opened this issue 5 years ago • 4 comments

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.

mbartelsm avatar Apr 24 '20 09:04 mbartelsm

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 :)

Xanewok avatar Apr 24 '20 09:04 Xanewok

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.

mzabaluev avatar Nov 07 '20 10:11 mzabaluev

+1

TonioGela avatar Nov 15 '20 15:11 TonioGela

+1

benjaminr avatar Jan 24 '21 11:01 benjaminr