Duplicate debug configurations are shown in vscode debug dropdown

Viewed 2843

The "/.vscode/launch.json" has only one instance of "Run script: start" and I have been trying to figure out why is vscode loading 2 debug configurations, when there is clearly only 1. Where is this other "Run Script: start 2" comming from? Possibly a global launch.json, but where?

vscode debug configurations preview

2 Answers

Visual Studio Code has global launch configurations in the .vscode/settings.json file.

  // Global debug launch configuration. Should be used as an alternative to 'launch.json' that is shared across workspaces.
  "launch": {
    "configurations": [],
    "compounds": []
  },

Ref: User and Workspace Settings

If you don't see your "ghost" entry there, it might be a contributed launch configuration that the IDE suggests for you (i.e. a default launch config). I see similar entries in some of my projects, but when I select and run them, they don't actually launch anything, and I get the error stating that the launch configuration does not exist.

Configuration 'my_project' is missing in 'launch.json'.

This should fix the problem for existing workspaces:

  1. Delete folder <Code>\Local Storage (note: this will loose some UI state but nothing too drastic)
  2. For remote ssh workspaces, also delete folder <Code>\User\workspaceStorage\<some id>

Where <Code> refers to:

Windows: C:\Users\<userid>\AppData\Roaming\Code
Linux:   /home/<userid>/.config/Code
macOS:   /Users/<userid>/Library/Application Support/Code

The problem shouldn't reappear.

Kudos to this and this

Related