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

Only last "type": "cargo" build task shows up when running build tasks.

Open lispink opened this issue 4 years ago • 0 comments

I have the issue that only one task is usable when you have multiple tasks of type cargo.

Example tasks.json:

{
	"version": "2.0.0",
	"type": "shell",
	"presentation": {
		"echo": true,
		"reveal": "silent",
		"focus": false,
		"panel": "shared",
		"showReuseMessage": false,
		"clear": true
	},
	"problemMatcher": [
		"$rustc"
	],
	"tasks": [
		{
			"label": "Rust: cargo build - minigrep",
			"type": "cargo",
			"subcommand": "build",
			"options": {
				"cwd": "${workspaceFolder}\\projects\\minigrep\\"
			},
			"group": "build"
		},
		{
			"label": "Rust: cargo build - playground",
			"type": "cargo",
			"subcommand": "build",
			"options": {
				"cwd": "${workspaceFolder}\\projects\\playground\\"
			},
			"group": "build"
		},
		{
			"label": "Rust: cargo build - hello_cargo",
			"type": "cargo",
			"subcommand": "build",
			"options": {
				"cwd": "${workspaceFolder}\\projects\\hello_cargo\\"
			},
			"group": "build"
		},
	]
}

When going to run a build task from vscode only the hello_cargo task shows up. vscode build options

I found a similar solved issue on the vscode github.

I currently have a workaround by using the shell type:

{
	"version": "2.0.0",
	"type": "shell",
	"presentation": {
		"echo": true,
		"reveal": "silent",
		"focus": false,
		"panel": "shared",
		"showReuseMessage": false,
		"clear": true
	},
	"problemMatcher": [
		"$rustc"
	],
	"tasks": [
		{
			"label": "Rust: cargo build - minigrep",
			"type": "shell",
			"command": "cargo",
			"args": [
				"build"
			],
			"options": {
				"cwd": "${workspaceFolder}\\projects\\minigrep\\"
			},
			"group": "build"
		},
		{
			"label": "Rust: cargo build - playground",
			"type": "shell",
			"command": "cargo",
			"args": [
				"build"
			],
			"options": {
				"cwd": "${workspaceFolder}\\projects\\playground\\"
			},
			"group": "build"
		},
		{
			"label": "Rust: cargo build - hello_cargo",
			"type": "shell",
			"command": "cargo",
			"args": [
				"build"
			],
			"options": {
				"cwd": "${workspaceFolder}\\projects\\hello_cargo\\"
			},
			"group": "build"
		},
	]
}

Then vscode does show all 3 options.

lispink avatar May 16 '21 16:05 lispink