feat: Substitute variables in config args #215
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prompted by a query on EAB, it's not currently possible to use dynamic values such as environment variables in custom properties for task or debug config. According to the VS Code docs this is expected behaviour and variables are only expanded in a limited set of core properties.
I'd hoped that there would be an API to expose the core substitution behavour so extensions could apply it elsewhere. It turns out I'm not alone in this hope, but it's not currently possible. The workaround for now is to reimplement the core behaviour. There is an npm module mentioned in that thread, but it's currently lacking types and various null checks so I've just put the logic in the extension. This could eventually be removed if MS respond to the feature request and expose a public API.
I've applied the substitutions where I could see it makes sense but there may be other places it could be used. @prb28 let me know if you're happy in applying this feature and if so I'll add some tests.