首页 文章

Visual Studio Code中的Launch.json

提问于
浏览
2

要在Visual Studio代码中开始调试,我必须生成一个Launch.json文件 . 在Visual Studio Code自动生成文件后,我有这样的事情:

{
"version": "0.2.0",
"configurations": [
    {
        "name": "Launch",
        "type": "node",
        "request": "launch",
        "program": "./bin/www",
        "stopOnEntry": false,
        "args": [],
        "cwd": ".",
        "runtimeExecutable": null,
        "runtimeArgs": [
            "--nolazy"
        ],
        "env": {
            "NODE_ENV": "development"
        },
        "externalConsole": false,
        "sourceMaps": false,
        "outDir": null
    },
    {
        "name": "Attach",
        "type": "node",
        "request": "attach",
        "port": 5858
    }
]

}

在此文件中,我可以将参数“request”设置为启动或附加 . “launch”和“attach”有什么区别?

我认为“启动”只是启动应用程序,“附加”负责附加到节点进程 . 但我注意到如果删除整个“附加”块我仍然可以调试我的应用程序 .

1 回答

  • 0

    得到了docs的答案:在VS Code中,我们支持在调试模式下启动您的应用程序或附加到已经运行的应用程序 . 根据请求(附加或启动),需要不同的属性,我们的launch.json验证和建议应该有所帮助 .

相关问题