问题
wondering if you could assist. Really challenging in determining a solution to this from my research.
Ive downloaded Visual Studio code two weeks ago and has come across an error once I try to debug a file. The file appears to open but once I run the debugger it shows accordingly:
'${workspaceFolder}' can not be resolved. Please open a folder.
Can't seem to find or replicate a similar solution. I've also tried to reinstall Visual Studio code (no easy feat). I'm trying to at least understand the problem and its source.
The file is a .js file that I've been working on, running a simple function. It is not meant to operate in tandem with a larger workspace/program.
回答1:
If you are using the latest Visual Studio 1.44, make sure to upgrade to 1.44.2.
The issue microsoft/vscode issue 94725 has been resolved.
It featured the same error message:
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 because 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}
.
This is fixed in commit ae97613.
回答2:
Replace ${workspaceFolder}
with ${FOLDER_NAME:workspaceFolder}
in your *.code-workspace
file. (from [here][1])
By the way, same goes to ${workspaceRoot}
, you can replace it with ${FOLDER_NAME:workspaceRoot}
.
Any more folder variables ca be fixed with this FOLDER_NAME:
prefix? My workspaces did not use them so far.
Worked for me in Version: 1.44.2
.
回答3:
I recently had this problem and so did I read the answers above but being a beginner I was unable to solve it .In my answer I don't have exactly what you should do but I will show what worked for me.
- Go to the explorer and you will see there is no folder added.
- Browse for .vscode folder and select it.
- Issue solved {this atleast worked for me.It**(.vscode)** had .json extension file in it}.
回答4:
in vs code go to file --> Add folder to workspace And select the folder where the program files are located.
来源:https://stackoverflow.com/questions/61238046/workspacefolder-can-not-be-resolved-please-open-a-folder-on-visual-studi