vscode-js-debug
vscode-js-debug copied to clipboard
Allow for wildcard in pathMapping
In our solution we have folder structure with versions. Without wildcard every time new version will be created we would need to change the launch.json.
Also we need to add and entry for every folder if we cannot use wildcard.
Let's look at this:
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "https://localhost/Tenant",
"webRoot": "${FOLDER_NAME:workspaceFolder}",
"pathMapping": {
"Tenant/Content/packages/Core/11.00/Folder": "C:\\work\\Applications\\Core\\Scripts\\Folder",
"Tenant/Content/packages/Core/11.00": "C:\\work\\Applications\\Core\\Scripts\\"
}
}
If we would be able to add wildcard in server path and in local path this would allow us to make the launch.json more concise, without adding entry for every version/folder.
Is there any workaround for this?
Thanks in advance
In our case we have url with deployment versions:
http://localhost:8080/assets.axd/637762069256939930/node_modules/lodash/lodash.min.js
http://localhost:8080/assets.axd/637762069256939930/node_modules/vue/dist/vue.js
http://localhost:8080/assets.axd/637762069256939930/node_modules/vuex/dist/vuex.min.js
Our ideal launch.json should be:
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080/",
"webRoot": "${workspaceFolder}",
"pathMapping": {
"assets.axd/*/node_modules/": "${workspaceFolder}/node_modules/"
}
}
I would be happy to accept a PR for this, code pointer:
https://github.com/microsoft/vscode-js-debug/blob/1ea758e0b8936b3b6cf5ff55414146574dfae7c7/src/common/sourceMaps/sourceMapResolutionUtils.ts#L101-L133
I think the only change needed is at this function:
https://github.com/microsoft/vscode-js-debug/blob/1ea758e0b8936b3b6cf5ff55414146574dfae7c7/src/common/sourceMaps/sourceMapResolutionUtils.ts#L182-L193
And this one: https://github.com/microsoft/vscode-js-debug/blob/1ea758e0b8936b3b6cf5ff55414146574dfae7c7/src/common/sourceMaps/sourceMapResolutionUtils.ts#L195-L200
I can made the change using regexp or glob patterns. ¿which one is more appropriate?
I'm sure that on some other config file of VSCode glob or regexp file name matching is used, @connor4312 ¿ any code pointer to that?
We use micromatch elsewhere in the debugger, you should be able to reuse that 🙂