$shibayu36->blog;

クラスター株式会社のソフトウェアエンジニアです。エンジニアリングや読書などについて書いています。

VSCodeで全ワークスペースで使うdebug launch設定をする

VSCodeでデバッガを起動したい時に、毎回.vscode/launch.jsonの追加をしていた。これ面倒だなと思っていたのだが、普通にsettings.jsonのlaunchというキー名で全ワークスペースで使うdebug launch configurationの設定ができた。

例えばRubyデバッグのためにvscode-rdbgを使っていた場合、.vscode/settings.jsonに次のように設定しておくと全ての場所でVSCode上でRubyデバッグができる。便利ですね。

  "launch": {
    "version": "0.2.0",
    "configurations": [
      {
          "type": "rdbg",
          "name": "Debug current file with rdbg",
          "request": "launch",
          "script": "${file}",
          "args": [],
          "askParameters": true
      },
      {
          "type": "rdbg",
          "name": "Debug current test with rdbg",
          "request": "launch",
          "command": "rspec",
          "script": "${file}",
          "args": [],
          "askParameters": false
      }
    ]
  }

参考