Skip to content
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

feat: Substitute variables in config args #215

Merged
merged 1 commit into from
May 2, 2022

Conversation

grahambates
Copy link
Contributor

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.

@grahambates grahambates force-pushed the config_variable_substitution branch from d3173c1 to 155641f Compare May 2, 2022 12:29
@prb28
Copy link
Owner

prb28 commented May 2, 2022

@grahambates Yes I think it's a good feature to add.
If you can add some tests that would be great.
Thanks.

Replicate VSCode behaviour to substitute variables in core config for
custom properties.
@grahambates grahambates force-pushed the config_variable_substitution branch from 155641f to b8ea471 Compare May 2, 2022 19:41
@prb28 prb28 merged commit 1626a3f into prb28:master May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants