vscode: '${workspaceFolder}' can not be resolved in a multi folder workspace
- VSCode Version: 1.44.0
- OS Version: Windows 10 Pro 1909 Build 18363.720
Steps to Reproduce:
- Create a workspace
- Add a folder to that workspace.
- Add a launch configuration “Node.js: Attach to Process” in the workspace file.
- Start the debug session.
Here is my workspace file:
{
"folders": [
{
"path": "."
},
{
"path": "app"
}
],
"launch": {
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"skipFiles": [
"<node_internals>/**"
]
}
],
"compounds": []
},
"settings": {}
}
Here is a screenshot of the error:
Does this issue occur when all extensions are disabled?: Yes
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 13
- Comments: 17 (9 by maintainers)
Commits related to this issue
- Fix microsoft/vscode#94725 — committed to microsoft/vscode-node-debug by roblourens 4 years ago
- Merge pull request #207 from microsoft/roblou/limitWorkspaceFolder Fix microsoft/vscode#94725 — committed to microsoft/vscode-node-debug by roblourens 4 years ago
VS Code 1.44.2 (with node-debug 1.44.5) is out now. This should fix the issue.
I’m also seeing this in a workspace that already uses the
:
syntax; indeed, it still fails if I change the config to remove allworkspaceFolder
entirely.Can confirm that the latest release has fixed this 👍
After some investigation the problem is the following for the workspace configuration our debug extensions appends the following attribute
__workspaceFolder:'${workspaceFolder}'
And the configuration resolver properly tries to resolve this and complains becuase the scope of the folder is not specified. In a multi root workspace scope has to be specified, otherwise the resolver does not know against which folder to resolve the variables.Proposed fix: the node extension which adds this attribute should scope it if it sees that we are in a multi root folder. So instead of
${workspaceFolder}
use${FOLDER_NAME:workspaceFolder}
.Forwarding to @roblourens and @connor4312 as they might know more about the changes in node debug. Adding label regression and candidate.
@axeldavid You can either downgrade Code itself to 1.43 or upgrade the node-debug extension to 1.44.5 by searching for
ms-vscode.node-debug
and selecting Manage > Install Another Version….I realized that previously we only set it when useV3 is set, now we set it all the time. I suggest that we just restore that setting check for the candidate.
Looks similar to a problem I was going to report. I am doing simple Node.js debugging without folders or workspace. Things were working fine in 1.43.2 but when I upgraded to 1.44 I started seeing popup errors related to missing ${workspaceFolder}. Downgraded to 1.43.2 and the error went away. Most likely related to this.
I also have the problem under Win 7, VS Code 1.44 and I am not able to debug a remote node process. I don´t have any ${workspaceFolder} variable entry in my configuration. It is also a multi folder workspace. Furthermore I don´t have problems to debug with the Chrome debug plugin.
With 1.43 my debug configuration worked without any problems. So I am using the previous version right now,
I hope these informations are helpful.