问题描述
要开始在Visual Studio Code中进行调试,我必须生成Launch.json文件。
在Visual Studio Code中自动生成文件后,我得到了以下内容:
To start debugging in Visual Studio Code I have to generate a Launch.json file.After the file has been auto-generated by Visual Studio Code I've got something like this:
{
"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设置为启动或附加。
启动和附加有什么区别?
In this file I can set the parameter "request" to launch or attach.What is the difference between "launch" and "attach"?
我认为启动只是启动应用程序,附加负责附加到节点进程。但是我注意到,如果删除整个 attach块,仍然可以调试我的应用程序。
I thought that "launch" just start the app and "attach" is responsible for attaching to the node process. But I noticed if I delete the whole "attach" block I can still debug my app.
推荐答案
从:
在VS Code中,我们支持在调试中启动应用程序模式或附加到已经运行的应用程序。根据要求(附加或启动),需要不同的属性,我们的launch.json验证和建议应对此有所帮助。
Got the answer from the docs:In VS Code we support launching your app in debug mode or attaching to an already running app. Depending on the request (attach or launch) different attributes are required and our launch.json validation and suggestions should help with that.
这篇关于Visual Studio代码中的Launch.json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!