23

The launch.json file should be inside the .vscode folder, but it is not present there.

How can I get this file so that I can modify the configurations?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Amaan Zafar
  • 390
  • 1
  • 3
  • 9

3 Answers3

36

As described in the Launch Configurations section of the Visual Studio Code documentation:

VS Code keeps debugging configuration information in a launch.json file located in a .vscode folder in your workspace (project root folder) or in your user settings or workspace settings.

To create a launch.json file, click the create a launch.json file link in the Run start view.

As of Visual Studio Code 1.56:

Visual Studio Code screenshot for create launch.json file link

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

VS Code screenshot of File Explorer with launch.json file

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
  • 1
    Note the details of the docs quote in the answer. The launch configs may be defined in the global `settings.json` or your workspace settings (`foo.code-workspace`). In this case, you won't have a `launch.json`, and trying to open it from the command palette (ctrl+shift+p) will take you to the file with the existing launch configs. [In this bug](https://github.com/microsoft/vscode-python/issues/14388), VSCode isn't picking up launch configs defined outside `launch.json`. – Hawkeye Parker Apr 05 '23 at 19:22
3

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.

Amaan Zafar
  • 390
  • 1
  • 3
  • 9
0

Warning: if you try to create an empty one (or one with an invalid content), trying to get to that file through the "Create a launch.json file" would not do anything.

See issue 133327.

That will be fixed with VSCode 1.61 (Sept. 2021): at least, that existing file will be opened when you click on "Create a launch.json file".

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250