-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Resolve env vars in settings.json #148514
Conversation
Thanks for your effort on this contribution. I am sorry that this solution is not an ideal/best because because of following reasons
|
@sandy081: Thank you for your reply - could you please elaborate on some of the points you mentioned?
In all of the points I'm willing to contribute given the right direction/pointers/test scenarios from your side. |
Any code impacts our start up performance because, configuration service is one of the first services that is being initialised in the very beginning and is sitting in the critical path of start up perf.
It is possible but it won't makes the feature complete.
All callers of configuration service now have to stop resolving the variables and also the values before and after might not be same.
That's true and hence this cannot be implemented in the configuration service. TBH I do not have very good answer for how to implement this. If you ask me this has to be exposed as an API just like this service - IConfigurationResolverService CC @alexr00 |
Feature request for having this as API: #140056 |
@sandy081: Thank you for your explanation. I understand now that this feature should be implemented not as part of the configuration service in the @alexr00: Would it suffice if I added the kind of resolve functionality described to the |
@alexr00: No problem, thanks for getting back to me! Please let me know whenever a feasible solution/approach for this has been decided on in the future (and if help is wanted). 👍 |
Feature contribution
.vscode/settings.json
of the form${env:...}
Use cases
vscode-eslint
Fixes Use of environment variables in options values vscode-eslint#1425
Fixes Support variables when resolving values in settings #2809 (comment)
Implementation
src/vs/platform/configuration/common/configuration.ts
addToValueTree(), addedsrc/vs/workbench/services/configurationResolver/common/variableResolver.ts
forresolveWithEnvironment()
since importing it results in violated imports warning:Imports violates 'vs/base/common/** or vs/base/parts/*/common/** or vs/platform/*/common/** ...
replaceAsync()
replaced byreplaceSync()
to keepaddToValueTree()
/toValueTree()
synchronousevaluateSingleVariable()
simplified to only cover for 'env' case but could be extendedTests
{ 'a': 1, 'b': '${env:VALUE_FOR_B} }' => { 'a': 1, 'b': '2' }
{'a': 'string1', 'b': 'string${env:VALUE_FOR_B}'} => {'a': 'string1', 'b': 'string2}