Note: it is not advised to use workspace.workspaceFile to write
configuration data into the file. You can use workspace.getConfiguration().update()
for that purpose which will work both when a single folder is opened as
well as an untitled or saved workspace.
The location of the workspace file, for example:
file:///Users/name/Development/myProject.code-workspaceor
untitled:1555503116870for a workspace that is untitled and not yet saved.
Depending on the workspace that is opened, the value will be:
undefinedwhen no workspace is openedUriotherwise. if the workspace is untitled, the returned URI will use theuntitled:schemeThe location can e.g. be used with the
vscode.openFoldercommand to open the workspace again after it has been closed.Example:
Refer to https://code.visualstudio.com/docs/editor/workspaces for more information on the concept of workspaces.
Note: it is not advised to use
workspace.workspaceFileto write configuration data into the file. You can useworkspace.getConfiguration().update()for that purpose which will work both when a single folder is opened as well as an untitled or saved workspace.