VSCode debug launch.json example

[ vscode ]
[ debug ]

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "debug-task",
      "skipFiles": ["<node_internals>/**"],
      "runtimeExecutable": "node",
      "args": [
        "${input:pickTask}",
        "--env",
        "${input:pickEnv}"
      ],
      "cwd": "${workspaceFolder}/packages/tool",
      "outputCapture": "std"
    }
  ],
  "inputs": [
    {
      "id": "pickEnv",
      "description": "Pick environment",
      "type": "pickString",
      "options": ["dev", "qa", "prod"],
      "default": "qa"
    },
    {
      "id": "inputTask",
      "description": "Input task",
      "type": "promptString"
    }
  ]
}
  • set outputCapture to std if you are using logging tool but didn’t see output in debug session
  • pickString/promptString to allow you input/pick args for debug task

Reference

https://stackoverflow.com/questions/48273346/vscode-command-for-user-input-in-debug-launch-config