Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode: Debug > Add Configuration, nothing happens

Using Visual Studio Code v 1.32.3 on Windows 10, when I navigate to Debug > Add Configuration, nothing happens. No errors or other messages, nothing appears to be written to the workspace folder, no errors in Event Viewer, so far just nothing.

I am somewhat new to VSCode so please don't discount that this might be a newbie error. Potentially notable is that the project is a Cordova project, I have created a Workspace (and confirmed that I am using it and not just opening the folder).

What I have checked so far:

  • Verifying that nothing is actively trying to build or otherwise access that folder. PhoneGap Desktop is stopped and no emulators running.
  • Restarted PC
  • Reinstalled the Cordova Tools plugin

Interestingly if I open a new instance of VS Code and before opening any file or folder I go back to Debug > Add Configuration I will get a message "Please first open a folder in order to do advanced debug configura..." So this indicates that there may be a problem with my workspace or directory but I haven't found it yet.

Any ideas greatly appreciated.

Edit 1:

Version of Cordova Tools is 1.8.0.

I've since tried adding my own launch.json to the .vscode directory. Contents:

{
    "version": "0.2.0",
    "configurations": [
    {
        "name": "Run android on device|emulator",
        "type": "cordova",
        "request": "launch",
        "platform": "android",
        "target": "device|emulator",
        "sourceMaps": true,
        "cwd": "${workspaceFolder}"
    },
    ]
}

Notable is that in the bottom right corner of the window a "Add Configuration" button appears while I am viewing launch.json and it does appear to work correctly, prompting me with snippets to add.

None of these impact my ability to debug unfortunately.

like image 564
Jacob M. Avatar asked Mar 22 '19 18:03

Jacob M.


People also ask

Why debug is not working in VS Code?

The most common problem is that you did not set up launch.json or there is a syntax error in that file. Alternatively, you might need to open a folder, since no-folder debugging does not support launch configurations.

How do I set debug configuration in Visual Studio?

In Solution Explorer, right-click the project and choose Properties. In the side pane, choose Build (or Compile in Visual Basic). In the Configuration list at the top, choose Debug or Release. Select the Advanced button (or the Advanced Compile Options button in Visual Basic).

Where do I put VS Code config?

Settings file locations#Windows %APPDATA%\Code\User\settings.json. macOS $HOME/Library/Application\ Support/Code/User/settings.json.


2 Answers

Alright I think I have this working. Steps:

  • I deleted the launch.json added in my edit. (Effectively now no launch.json file again)
  • Navigate to Debug > Start Debugging
  • Ignore the error dialog that appears
  • VSCode will create a launch.json and display the debug menu

From here it looks like I'm back on track.

like image 148
Jacob M. Avatar answered Oct 19 '22 05:10

Jacob M.


Check VS Code OUTPUT window. When VS Code is downloading some launcher packages like .NET Core Launch, Debugging process may be affected. After downloading packages are completed check it again.

like image 22
Pedram A. Keyvani Avatar answered Oct 19 '22 05:10

Pedram A. Keyvani