ゲスト 39人 と メンバー0人 がオンラインです

■概要

 通常、「Ctrl+Shift+B」を入力したあとに「Cargo Build」を選択しないといけない。
 めんどうなのでデフォルトで「Ctrl+Shift+B」しただけでビルドできるようにする

 

■手順(旧)

 1.Terminal > Configure Taskを選択してtask.jsonを生成する。

 2.下記の設定が書かれていればOK。書かれていない場合は追加する
  ※デフォルトで書かれているはず

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cargo",
            "label": "cargo build",
            "command": "cargo",
            "args": [
                "build"
            ],
            "problemMatcher": [
                "$rustc"
            ],
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": true,
                "clear": false
            },
            // ↓これ
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

■手順(新)

 最近、改めて設定してみたら手順が変わっていた?ので修正

 1. Terminal > Configure Task>Rust : cargo build xxxx を選択してtask.jsonを生成する。
 2. groupの箇所を追加する(デフォルトでbuildが動作するようにする)

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cargo",
			"subcommand": "build",
			"problemMatcher": [
				"$rustc"
			],
                        // ↓ここから追加
			"group": {
				"kind":"build",
				"isDefault": true
			},
                        // ↑ここまで追加
			"label": "Rust: cargo build - hello"
		}
	]
}