无法使用config在visual studio代码上自动更改调试环境

时间:2017-07-20 13:03:52

标签: visual-studio-code

例如,我的根工作站目录是/home/chain/Project。我有两个单独的项目pythonwebsite。我launch.json去了:

{
"version": "0.2.0",
"configurations": 
[
    {
        "name": "Python",
        "type": "python",
        "request": "launch",
        "stopOnEntry": true,
        "pythonPath": "${config:python.pythonPath}",
        "program": "${workspaceRoot}/python_project_source/test.py",
        "cwd": "${workspaceRoot}/python_project_source",
        "env": {},
        "envFile": "${workspaceRoot}/.env",
        "debugOptions": [
            "WaitOnAbnormalExit",
            "WaitOnNormalExit",
            "RedirectOutput"
        ]
    },
    {
        "type": "chrome",
        "request": "launch",
        "name": "Launch Chrome against localhost",
        "url": "${workspaceRoot}/website/test.html",
        "webRoot": "${workspaceRoot}/website"
    }
]

}

正如预期的那样,当我选择test.py并按下' F5'它可以切换到python调试环境,当我选择test.html时,Chrome将被打开。

事实上,VS代码只记得我上次调试的环境,而不是自动更改它。所以我现在唯一要做的就是在需要编译另一个环境时向一个环境(/* */)添加一些注释。:(

我的launch.json

是否有问题

1 个答案:

答案 0 :(得分:1)

我相信,基于文件(或文件类型)自动切换调试环境不是Visual Studio Code的当前功能。

您必须根据要执行的调试任务的类型手动切换启动配置。

当然,您可以考虑撰写功能请求:https://github.com/Microsoft/vscode