Launch.json in Visual Studio Code
Olivia Zamora
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 }
]}
In this file I can set the parameter "request" to launch or attach. What is the difference between "launch" and "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.
1 Answer
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.