LoginSignup
2
3

More than 3 years have passed since last update.

[VSCode] launch.jsonとtasks.jsonは使わない

Posted at

はじめに

VSCodeでC++のビルド&デバッグするために、律儀にlaunch.jsontasks.jsonを書いてたんだけど、CodeRunnerっつう拡張機能を使えば、もう書かなくていいんだ。

CodeRunner
https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner

CodeRunnerとは

コマンドラインで行えるコマンドを言語ごとに割り当ててショートカットキーで簡単実行できちゃう拡張機能

複数のコマンドを続けて実行する時に特に威力を発揮する

設定

実行対象のファイル上でショートカットキー(Ctrl+Alt+N)を押すとCodeRunnerが実行される

settings.json
{
  "code-runner.runInTerminal": true,
  "code-runner.executorMap": {
    "javascript": "node",
    "php": "C:\\php\\php.exe",
    "python": "python",
    "perl": "perl",
    "ruby": "C:\\Ruby23-x64\\bin\\ruby.exe",
    "go": "go run",
    "html": "\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\"",
    "java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
    "c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
    "cpp": "g++ $fullFileName && ./a.out"
  }
}
2
3
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
2
3