vscode-powershell
vscode-powershell copied to clipboard
Feature Request: Support the "env" key in launch.json for debugging Environment Variable setup
Prerequisites
- [X] I have written a descriptive issue title.
- [X] I have searched all issues to ensure it has not already been reported.
Summary
When debugging PowerShell scripts it is necessary at times to set environment variables to be used for given debug configuration.
This use-case is especially necessary when debugging scripts that are to be used in conjunction with Azure devops YAML pipelines as all pipeline variables are environment variables. Example: Where we have multiple pipeline steps emitting variables (YAML template expression "each" usage) and we use a PowerShell script to gather the outputs for processing and formatting (YAML template expression "join" used to pass parameters to the PowerShell script). Debugging this use-case is harder than it needs to be right now and suggested work arounds, whilst usable, are cumbersome.
Proposed Design
Support for an "env" key for "PowerShell" debugging as per other configuration types please, e.g.
Thanks for the submission! Have you considered using a pester test and setting up the env variables in that? You can then debug the pester test either with the codelens or with the Pester Tests extension.
That said, this could be possible but there's a lot of considerations for cleanup, etc., I'll flag it as up for grabs.
It's been a year, maybe it's time to take this seriously ?