microsoft / vscode-edge-debug2

This is a VS Code extension which helps you debug your JavaScript Code inside the Edge browser.
Other
37 stars 31 forks source link

breakpoints not hit when serving project from wsl #164

Open mirronelli opened 4 years ago

mirronelli commented 4 years ago

Steps to reproduce:

  1. create a vue cli project hosted on a wsl 1 ubuntu node
  2. execute: npm run serve
  3. launch debugger from the launch.js as described here in readme.md
  4. set a breakpoint into whichever file (even main.ts or app.vue)

The debugger attaches to the browser and the console output is being displayed in vscode as expected. However the sourcemaps do not hit locally set breakpoints. When running using trace='verbose' it seems the vscode is sending a wrongly formatted path to the browser to match against its paths. See the output above.

I believe the '''vscode-remote://wsl%2Bubuntu-18.04''' part of the path is what confuses edge, since it knows nothing about the files being hosted on such a path (wsl).

The equivalent extension for chrome works as expected on the same setup and using the same settings, apart from the executable and version parameters.

lgp1985 commented 4 years ago

I had the same issue, one way around should be to run the extension from the workspace. Define in your settings.json

{
    "remote.extensionKind": {
        "msjsdiag.debugger-for-edge": [
            "workspace"
        ]
    }
}

Then you'll need to install the extension also there (on your WSL). After you'll need to define in your project .vscode/launch.json the path to your host msedge.

{
    "configurations": [
        {
            "type": "edge",
            "request": "launch",
            "name": "Launch Edge",
            "url": "http://localhost:3000/",
            "webRoot": "${workspaceFolder}/",
            "runtimeExecutable": "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
            "runtimeArgs": [
                "--remote-debugging-port=2015"
            ],
            "skipFiles": [
                "<node_internals>/**"
            ]
        }
    ]
}

This should make your breakpoints work once launched. If you made any mistakes, you'll see when mouse over Breakpoint set but not yet bound