vscode-go
vscode-go copied to clipboard
Environment Variable interpolation in settings.json
Describe the problem
VSCode does not resolve env vars in settings.json - this is left for extensions to implement themselves.
For example, in the following ${env:BAR} will not be replaced:
# .vscode/settings.json
{
"go.testEnvVars": {
"FOOBAR": "foo ${env:BAR}"
},
}
Describe the solution you'd like
Strings of the form ${env:FOOBAR} should be replaced with the environment variable value.
Describe alternatives you've considered You'd think this should be implemented in VSCode but that's not going to happen. See https://github.com/microsoft/vscode/issues/2809 and https://github.com/microsoft/vscode/pull/148514
I'm happy to contribute if there is agreement that this should be added.
Hi, thanks for this issue. IIRC, variable interpolation in settings.json is a bit hacky / ad-hoc (see for example https://github.com/golang/vscode-go/issues/2310#issuecomment-1176284842, and the change resolving that issue).
This does seem like a useful feature, but I am hesitant to accept a contribution here until we've discussed on the team (there may be gnarly history I'm not aware of).
I'll bring this up in our weekly triage meeting.
Ok, we discussed this in the team meeting, and unfortunately would like to put this on the back-burner for now. The reason is that the current handling for variable interpolation is somewhat unprincipled and inconsistent, and we are hesitant to add yet another interpolation feature right now.
CC @hyangah
Ok. That's disappointing but thanks for the explanation. :+1: