Visual Studio Code 中的 Launch.json

2024-02-17

要在 Visual Studio Code 中开始调试,我必须生成 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
        }
    ]
}

在此文件中,我可以设置要启动或附加的参数“请求”。 “启动”和“附加”有什么区别?

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


得到了答案docs https://code.visualstudio.com/docs/editor/debugging#_launch-versus-attach-configurations: 在 VS Code 中,我们支持在调试模式下启动应用程序或附加到已运行的应用程序。根据请求(附加或启动),需要不同的属性,我们的 launch.json 验证和建议应该对此有所帮助。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Visual Studio Code 中的 Launch.json 的相关文章

随机推荐