-
Notifications
You must be signed in to change notification settings - Fork 27.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add several basic predefined variables for use in launch.json - e.g. ${uid}, ${gid}, ${user}, ${home} #101172
Comments
USER and HOME are already available as environment variables: We are not planning to introduce arbitrary variables that are already available by other means. |
HOME is already supported, being named Meanwhile there are 3 other very important variables that we need:
These 3 variables are essential for allowing us to use configure paths to tools or virtualenvs that are not clashing when a workspace is mounted on multiple systems. To give a clear explanation, python virtualenvs are not portable and this means that a folder like My main development box is a MacOS host where I also use Parallels to run a Windows Vm and a Linux VM, both of them have my code mounted on them, so I do not need to sync any code change. And here is where the joy starts, as as soon I create a python .venv inside the project, vscode detects it and starts using it on all platforms, basically at any point in time only one is working and the other ones do not. I got the same problem with tox but for tox there is a workaround as you can configure it to include the platform name inside its virtualenv, so you can make it work cross-platform. Still, with vscode itself, there is no way to configure that yet: "python.defaultInterpreterPath": "${workspaceFolder}/venv-${platform}/bin/python" If we would have And yes, I do also run vscode under each of these VMs because I happen to code extensions for vscode, so I need to check how it behaves on each. Implementing platform reporting with node is very simple, process.platform does a decent job. Can a core engineer ack if a pull-request to add this would be accepted? |
@ssbarnea did you try to use an environment variable that is defined outside of VS Code? You can easily access that as `${env:variable}´. |
While using env trick is awesome, it cannot work for this use-case because someone decided to use |
@ssbarnea I was actually suggesting to introduce a new env variable and assign it to different values on the different platforms. |
Please expose several basic predefined variables for use in
launch.json
like${uid}
,${gid}
,${user}
,${home}
(and potentially insettings.json
too, as per #2809).Example use cases:
The text was updated successfully, but these errors were encountered: