pathMapping does not work when launch configuration in user settings.json and project in devcontainer
This finds pathMapping when defined in launch.json. However it does not work, when I place it under the launch key in my user settings.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": [
{
"name": "Firefox Debugger",
"type": "firefox",
"request": "launch",
"reAttach": true,
"profile": "dev",
"keepProfileChanges": true,
"url": "http://localhost:8080/",
"skipFiles": [
"${workspaceFolder}/app/node_modules/**"
],
"pathMappings": [
{
"url": "webpack:///src",
"path": "${workspaceFolder}/app/src"
}
]
}
]
}
The extension offers to do a pathMapping like the following. This actually works, but it is not generic.
{
"url": "webpack:///src/components/Component.vue",
"path": "vscode-remote://dev-container%2B2f686f6d652f6272616e64732f7265706f732f626574612d617070/project/app/src/components/Component.vue"
},
Expected
The launch configuration should also work in settings.json.
The extension also behaves similarly if the config is placed in a multi-root .code-workspace file as well.
{
"folders": [
{
"path": ".",
"name": "www",
},
{
"path": "./client/src/api",
"name": "JavaScript API"
}
],
"settings": {
"launch": {
"configurations": [
{
"name": "Launch localhost in ff",
"type": "firefox",
"request": "attach",
"reloadOnAttach": true,
"port": 6000,
"url": "https://localhost:3000",
"webRoot": "${workspaceFolder:www}/client/src",
"pathMappings": [
{
"url": "https://localhost:3000/src/",
"path": "${workspaceFolder:www}/client/src"
},
{
"url": "data:/var/www/client/",
"path": "${workspaceFolder:www}/client/"
}
]
},
],
"compounds": []
}
}
}
Got the same problem, @StefanBrand can you please describe how to get the right prefix for the connected container like vscode-remote://dev-container%2B2f686f6d652f6272616e64732f7265706f732f626574612d617070 in your post?
So to make this work I can simply hard-code the container name into settings.json like this?
"pathMappings": [
{
"url": "webpack:///src",
"path": "vscode-remote://dev-container%2B2f686f6d652f6272616e64732f7265706f732f626574612d617070/var/www/html/src"
}
]
For Chrome debugger seems this works well out-of-the-box with "path": "${workspaceFolder}/app/src". But Firefox debugger with such configuration tries to open file from the host filesystem, not from the container filesystem.
the vscode-remote:// URI was generated by the extension.