-
Notifications
You must be signed in to change notification settings - Fork 37.3k
Description
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.84.0 (user setup)
- OS Version: Windows_NT x64 10.0.22621
Steps to Reproduce:
- Install a remote virtual filesystem extension like Kelvin.vscode-sshfs or liximomo.remotefs
- When connected to a remote FS, create a remote launch.json and use
${workspaceFolder}somewhere where it will be replaced - the same can be seen with a remotetasks.json - The variable is replaced not with it's URI form but with its
fsPathform.
Here is an example tasks.json than can quickly reproduce the issue. Note the options.cwd.
{
"version": "2.0.0",
"tasks": [
{
"label": "echo 2",
"type": "shell",
"options": {
"cwd": "c:\\temp"
},
"command": "echo ${workspaceFolder}"
}
]
}And a xdebug.php-debug specific launch.json.
{ "version": "0.2.0", "configurations": [
{
"name": "Listen for Sail Xdebug",
"debugServer": 4711,
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": { "/var/www/html": "${workspaceFolder}" },
// "pathMappings": { "/var/www/html": "ssh://docker.local/users/zobo/laravel-test" },
}
]}Additional info.
In the specific case of debugging a remote PHP script - mounted over SSHFS virtual filesystem, this is needed so that the php-debug adapter can convert a /var/www/html/index.php path to a VFS uri of ssh://users/zobo/laravel-test/index.php.
I have added the virtualWorkspaces capability, but that did not help. I believe this is the offending code:
vscode/src/vs/workbench/services/configurationResolver/common/variableResolver.ts
Lines 285 to 287 in dc78919
| case 'workspaceRoot': | |
| case 'workspaceFolder': | |
| return normalizeDriveLetter(this.fsPath(getFolderUri(VariableKind.WorkspaceFolder))); |
Related php-debug issue: xdebug/vscode-php-debug#873
Related docs https://code.visualstudio.com/api/extension-guides/virtual-workspaces
Example XXX.code-workspace config for sshfs and remotefs
{
"folders": [
{
"name": "example-app — (Remote)",
"uri": "sftp://dockerrfs/"
},
{
"path": ".."
},
{
"name": "SSH FS - docker",
"uri": "ssh://users/zobo/laravel-test"
}
],
"settings": {
"sshfs.configs": [
{
"name": "docker",
"host": "192.168.56.101",
"username": "root",
"root": "/users/zobo/laravel-test",
"agent": "pageant"
}
],
"remotefs.remote": {
"dockerRFS": {
"scheme": "sftp",
"host": "192.168.56.101",
"username": "root",
"rootPath": "/users/zobo/laravel-test",
"agent": "pageant"
}
}
}
}I could solve the problem by implementing this in the php-debug resolveDebugConfiguration
if (folder && folder.uri.scheme !== 'file') {
// replace
if (debugConfiguration.pathMappings) {
for (const key in debugConfiguration.pathMappings) {
debugConfiguration.pathMappings[key] = debugConfiguration.pathMappings[key].replace('${workspaceFolder}', folder.uri.toString())
}
}
}(This just replaces the variable in one specific key, should be everywhere...)
Label: debug