LoginSignup
6
6

More than 5 years have passed since last update.

Visual Studio CodeでRustのコードをビルドするときのtasks.jsonの設定

Last updated at Posted at 2015-10-25

Rustを触ってみたい。

けど、ガチプログラマじゃないので、Visual Studio Codeでふわっと触るくらいでいい。でも、ビルドのためにコマンドラインを開くのはだるいので、エディタからの操作で完結させたい。

みたいなニッチな欲望を満たすための設定。

Tasks

Visual Studio CodeにはTasksというのがあって、これを設定するとCtrl+Shift+Bでビルドが、Ctrl+Shift+Tでテストが走るようになる。

参考:https://code.visualstudio.com/Docs/editor/tasks

tasks.jsonを設定

↓のブログ記事が詳しい。

参考:
Rust Using Visual Studio Code | mobiarch

problemMatcherを設定しておくと、エラーが出た場所をハイライトしてくれる?っぽいけど、めんどくさいのでとりあえず省略。とりあえずミニマルな設定はこんな感じっぽい。

tasks.json
{
    "version": "0.1.0",
    "command": "cargo",
    "showOutput": "always",
    "tasks" :[
        {
            "taskName": "build",
            "isBuildCommand": true
        },
        {
            "taskName": "run"
        },
        {
            "taskName": "test",
            "isTestCommand": true
        }
    ]
}
6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6