Vscode-remote-release: Support ${remoteWorkspaceFolder} in devcontainer.json

Created on 2 Mar 2020  路  6Comments  路  Source: microsoft/vscode-remote-release

Provide a way to reference VS Code variables in Remote Containers devcontainer.json containerEnv and remoteEnv. Such as:

"containerEnv": { 
  "WORKSPACE_FOLDER": "${variable:workspaceFolder}" 
}
containers plan-item

All 6 comments

There is ${localWorkspaceFolder}, does that help?

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@chrmarti ${localWorkspaceFolder} resolves the host path for the workspace. I need the path in the remote container.

In my use case we have a "bin" folder, with executables, and wanted it to be part of an environment variable.

I made a trick using the postCreateCommand to make it work.

"postCreateCommand": "pip install -r virtualenv/requirements.txt; echo \"export PYTHONPATH=\"$(pwd):$(pwd)/pyplumbing\"\" >> \"$HOME/.bashrc\""

@felipecassiors Makes sense. (Thought we had this request somewhere, but can't find it anymore.)

Closed erroneously.

Do you think it might be useful to support other VS Code variables as well? I pointed it when opening the issue, but now I'm not sure if it is useful or not, but can possibly open opportunities for people exploring devcontainer.

https://code.visualstudio.com/docs/editor/variables-reference

Adding containerWorkspaceFolder, localWorkspaceFolderBasename and containerWorkspaceFolderBasename as per https://github.com/microsoft/vscode-remote-release/issues/2697#issuecomment-609854675.

Was this page helpful?
0 / 5 - 0 ratings