As described in the Launch Configurations section of the Visual Studio Code documentation:
VS Code keeps debugging configuration information in a
launch.jsonfile located in a.vscodefolder in your workspace (project root folder) or in your user settings or workspace settings.To create a
launch.jsonfile, click the create a launch.json file link in the Run start view.
As of Visual Studio Code 1.56:

Once that's created, it should now be available under your workspace's .vscode folder.

Configuring "tasks.json" and "launch.json" for debugging C++
vscode debugger - Where is the 'launch.json' file in Visual Studio Code? - Stack Overflow
How to create automatic configurations for launch.json?
confused about different types of VSCODE launch.json configs for debugging in Edge with DEVTOOLS
Videos
I'm getting an hard time to put VSCode to debug a very simple program that asks for input, and so far it was mission impossible. The catch here is that it requires an user input, for the hello world simple example I just needed to configure the tasks.json and the VSCode debugger was good to go and stopped on all breakpoints.
The problem come when I tried a simple pow program that asks for two numbers, and for that I need to open a window, otherwise I never get the opportunity to interact with it.
So, I ended up with this configuration were the file tasks.json is known to work just fine with any launch.json created!
For the launch.json configuration, "(Windows) Launch" is able to run, despite of no debugging, but the "(gdb) Bash on Windows Launch" not even that, it simples does nothing! But for the one that runs, the breakpoints end up grayed out, it's truly annoying!
By the way, the compiler is run with the "-g" parameter enabled, I read somewhere that that was a requirement for the debugger.
tasks.json:
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "C:\\MinGW\\bin\\g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
launch.json:
{
// 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": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"console": "externalTerminal",
"logging": {
"moduleLoad": false,
"trace": true
},
},
{
"name": "(gdb) Bash on Windows Launch",
"type": "cppdbg",
"request": "launch",
"program": "${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": true,
"pipeTransport": {
"debuggerPath": "/usr/bin/gdb",
"pipeProgram": "${env:windir}\\system32\\bash.exe",
"pipeArgs": ["-c"],
"pipeCwd": ""
},
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
C++ code:
#include <iostream>
using namespace std;
// Driver Code
int main()
{
int a, b, pow = 1;
// Input two numbers
cout << "Base: ";
cin >> a;
cout << "Exponent: ";
cin >> b;
// Iterate till b from 1
for (int i = 1; i <= b; i++) {
pow = pow * a;
}
// Print the value
cout << "Pow: " << pow << endl;
}As described in the Launch Configurations section of the Visual Studio Code documentation:
VS Code keeps debugging configuration information in a
launch.jsonfile located in a.vscodefolder in your workspace (project root folder) or in your user settings or workspace settings.To create a
launch.jsonfile, click the create a launch.json file link in the Run start view.
As of Visual Studio Code 1.56:

Once that's created, it should now be available under your workspace's .vscode folder.

Click on the debug side bar to open the debugging options. Then either the cog icon at the top, or the create a launch.json file link below the big blue button. If the launch.json file is present, it will open it otherwise it will generate one.
I've been searching around for a few hours now and haven't found a solution, just posts for creating a launch.json in general.
When I go to create a launch.json, I'm either give a launch that's automatically populated, or I'm presented with an option to populate configurations automatically for whichever language I want to use. With C++ for example, this means that it fills out name, type, program, args, etc and generates the configurations for my launch.json.
I've created a launch.json that I want to use as a template in the future, rather than having to manually change these automatic configurations. I also want to avoid copying over launch.json from other projects. I essentially want to configure vscode so that if I create a launch.json, I can automatically populate it with my own template of parameters for configurations.
I hope this makes sense. I figure that settings.json might be the place to do so, but it seems like it just has a global default that gets used. I'm trying to find where all of the different templates for launch.json are stored. I'm not sure if they're stored, or if they're some how magically generated based off of some criteria, or if they come from language extensions themselves.
If anyone has any insight into this, I would deeply appreciate it. Thanks.
Edit: I believe this is the right answer: User Defined Snippets
Thanks u/_d_end
I was playing with creating VSCODE launch.json configurations for running Microsoft Edge with integrated devtools showing in VSCODE.
I ended up with two different launch configurations after doing the following:
-
at the start there is no launch.json
-
I click on the debugger and it offers me the opportunity to create a launch.json and selected 'Microsoft Dev Tools' and a config was added to the newly created launch.json file.
-
then inside the launch.json I can "Add configuration" and choose "Microsoft Devtools : launch" and a second config gets added.
Both configs need a fix so that it runs the page running on http://localhost:5500 (I change the url setting to do this).
I end up with two 'compound' configurations called 'Launch Edge Headless and attach DevTools' (which I shall call 'headless') and one called 'Launch Edge and attach DevTools' (which I shall call 'external' because it launches an external browser).
I will past the launch.json.config with the two configs below.
can anyone explain why the external config is only available when you choose "create launch file" from the debugger panel and no launch.json exists and not available when you click the "Add configuration" button from inside the launch.json file?
thanks in advance
{
// 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": [
{
"type": "pwa-msedge",
"name": "Launch Microsoft Edge",
"request": "launch",
"runtimeArgs": ["--remote-debugging-port=9222"],
"url": "http://localhost:5500", // Provide your project's url to finish configuring
"presentation": {
"hidden": true
}
},
{
"type": "pwa-msedge",
"name": "Launch Microsoft Edge in headless mode",
"request": "launch",
"runtimeArgs": ["--headless", "--remote-debugging-port=9222"],
"url": "http://localhost:5500", // Provide your project's url to finish configuring
"presentation": {
"hidden": true
}
},
{
"type": "vscode-edge-devtools.debug",
"name": "Open Edge DevTools",
"request": "attach",
"url": "http://localhost:5500", // Provide your project's url to finish configuring
"presentation": {
"hidden": true
}
}
],
"compounds": [
{
"name": "Launch Edge Headless and attach DevTools",
"configurations": [
"Launch Microsoft Edge in headless mode",
"Open Edge DevTools"
]
},
{
"name": "Launch Edge and attach DevTools",
"configurations": ["Launch Microsoft Edge", "Open Edge DevTools"]
}
]
}
You can work with a MultiRoot Workspace.
- Open a Workspace with: File | Open Folder
- Add Workspaces with: File | Add Folder to Workspace
- Save the MultiRoot Workspace: File | Save Workspace As
Next time you open this MultiRoot Workspace with: File | Open Workspace
Now each Workspace folder can have its own .vscode folder with launch.json and tasks.json.
When you now open a launch.json you can add Configurations by hand or with the Add Configuration... button in the lower right.
In the Debug Bar you can now select a Launch config from any of the Workspaces.
It is also possible to add the different launch configurations for the sub folders of a Workspace, in case you need to launch multiple configs (server and client) but then you need to set the parameters yourself like cwd.
Add C# extension from Microsoft. Post that open any cs file. It will install C# dependencies.The you will get a pop up

Click yes. Both tasks.json and launch .json are created.