Vscode-js-debug: urlFilter with wildcard does not match root URL

Created on 22 Jan 2020  路  5Comments  路  Source: microsoft/vscode-js-debug

  • VS Code Version: 1.41.1
  • Log file (set "trace": true in launch config): N/A

Steps to reproduce:

  1. Using the following 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": [
    {
      "type": "edge",
      "request": "attach",
      "name": "Attach Edge",
      "urlFilter": "https://localhost:3000/*",
      "webRoot": "${workspaceFolder}/Portal/apps",
      "sourceMaps": true,
      "smartStep": true,
      "skipFiles": ["**/node_modules/**"],
      "sourceMapPathOverrides": {
        "webpack:///*": "${webRoot}/*"
      },
      "port": 2015
    }
  ]
}
  1. Attaching works when a tab is open on a sub-page, e.g https://localhost:3000/home.
  2. Attaching does not work when the tab is open on the root URL, e.g. https://localhost:3000.

I would expect the wildcard to match anything or nothing. Or else there should be an operator for optional wildcard.

bug verified

Most helpful comment

Probably works if it ends with 3000* right?

All 5 comments

Probably works if it ends with 3000* right?

@roblourens Thanks for the tip, that does the trick! Only issue I can see is that it will also match localhost:30000.

While this is sufficient for my use case, it would probably be more user-friendly if trailing /* was replaced with *, to fit with the principle of least surprise. It seems like this is already done if there is no wildcard: https://github.com/microsoft/vscode-chrome-debug-core/blob/283e6b4e09f0528e8ecf2f21cb1cf57ef6666ce7/src/chrome/chromeUtils.ts#L191

Feel free to close this bug if you disagree though, the workaround is good enough for me :)

I agree!

TL;DR: I really want to use "urlFilter" too, but with both a wildcard and complicated parameters containing special characters.

Ok, this might not be the right place to put this, because I don't think I'm using vscode-chrome-debug directly. I am developing an office-js add-in for Excel, and I ended up here because I am having trouble with a launch configuration.

What I _am_ using is the "Microsoft Office Add-in Debugger for Visual Studio Code", the repo for which is here: vscode-debugger-extension-for-office-addins . The source code is no longer offered in that repo, but by looking at the files which get installed, I can see that it is using vscode-chrome-debug-core, and I suspect that I'm being denied the functionality I desire by the code at or near the line which has been referenced above. I haven't traced this all the way, stepping through the source code, admittedly... but I have my suspicions. So, maybe this _is_ the right place to start...

Without the ability to use urls with wildcards and complicated parameters, I face the prospect of needing to have a separate launch configuration for each task pane, or whatever little hosted stub page is involved with the project.

launch.json excerpt:

{
// ... omitted
  "configurations": [
    {
      "name": "Excel Desktop",
      "type": "node",
      "request": "launch",
      // ...  yadda yadda
    },
    {
      "type": "office-addin",
      "request": "attach",
      "name": "storepane - attach to taskpaneStoreId",
      "port": 9222,
      "trace": "verbose",

      //  this doesn't work...
      // "urlFilter":
      //   "https://localhost:3000/*.html?_host_Info=Excel$Win32$16.01$en-US$$$$0",
      //                         ^^^^^   omg, i can haz wildcard, plz? 

      //  this doesn't either...
      // "urlFilter":
      //    "https://localhost:3000*.html?_host_Info=Excel$Win32$16.01$en-US$$$$0",
      //                                  I $uspect it'$ choking on thi$, $omhow...

      "url":
        "https://localhost:3000/taskpane1.html?_host_Info=Excel$Win32$16.01$en-US$$$$0",
      //  this works, but requires the user to have a separate launch
      //  configuration for each .html host page in the project, of which
      //  there can be many.

      "webRoot": "${workspaceFolder}",
      "timeout": 45000
    },
// ... file continues ...

My hypothesis is that getMatchingTargets() is returning an empty array, as a result of the goofy url with too many dollar signs I'm required to use.

I have mentioned this issue over in that repo:
https://github.com/OfficeDev/vscode-debugger-extension-for-office-addins/issues/17#issue-684272179

I noticed this issue in js-debug (our new debugger) a week or two ago as well, will transfer this issue, fix, and close it

Was this page helpful?
0 / 5 - 0 ratings