In Visual Studio Code, the launch.json file is used to configure the debugger in your workspace. It specifies the environment in which your code will be run, as well as the debug options to use when running or debugging your code.
The launch.json file is located in the .vscode directory in your workspace. When you open a folder in Visual Studio Code, the editor automatically looks for a launch.json file and displays it in the Debug panel.
The launch.json file consists of a JSON object with two main properties: configurations and version. The configurations property is an array of objects, each of which represents a debug configuration. The version property specifies the version of the debugger configuration schema.
The below is a configuration that works for nodejs and python.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
// nodes
{
"type": "node",
"request": "launch",
"name": "node: Launch Program",
"program": "${file}",
"console": "integratedTerminal"
},
{
"type": "node",
"request": "launch",
"name": "node: Launch Program (External Terminal)",
"program": "${file}",
"console": "externalTerminal"
},
// pythons
{
"type": "python",
"request": "launch",
"name": "Python: Current File",
"program": "${file}",
"console": "integratedTerminal",
},
{
"type": "python",
"request": "launch",
"name": "Python: Current File (External Terminal)",
"program": "${file}",
"console": "externalTerminal"
}
]
}
Here is a link to the options: https://code.visualstudio.com/docs/editor/variables-reference