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
Variable substitution with environment - allow for fallback to default #92854
Comments
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation. Happy Coding! |
Hooorray, 20 👍 |
🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation. Happy Coding! |
Any way to circumvent this for now? I want to do use XDG basedir spec and prepend something to XDG_DATA_DIRS. To this end I need to retrieve the value of XDG_DATA_DIRS if it’s set and use a default when it isn’t set, which would look like this: "env": {
"XDG_DATA_DIRS": "${workspaceFolder}/something:${env:XDG_DATA_DIRS-/usr/local/share:/usr/share}"
} There seems to be no way to currently do this in a launch configuration, and falling back to the empty string will break every GUI application launched with that env value set. |
Instead of using |
When doing variable substitution with environment (at debugging launch, but could be useful for tasks too -
${env:Name}
), I would like to provide a fallback (default) when the environment variable is not set.As an example, see the variable substitution scheme for Docker Compose: https://docs.docker.com/compose/compose-file/#variable-substitution
The syntax for VS Code could be
${env:Name:-default}
and${env:Name-default}
with the same logic.VS Code version 1.42.1
The text was updated successfully, but these errors were encountered: