结果发现这是
program
属性
程序-启动调试器时要运行的可执行文件或文件
https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes
{
"name": "python launch foo",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/d1/d2/foo.py",
"cwd": "${workspaceFolder}",
"args": [ "${env:USERNAME}", "--optionX", "x1000" ]
"console": "integratedTerminal"
}
以前我只是用默认值复制启动配置
file
变量,该变量始终只运行工作区中打开的任何活动文件。
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"cwd": "${workspaceFolder}",
}