PowerShell / PowerShell/vscode-powershell

Feature Request: Support the "env" key in launch.json for debugging Environment Variable setup

Open
#4,998 3 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Enhancement Up for Grabs
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

Prerequisites
  • I have written a descriptive issue title.
  • 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.
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the PowerShell extension reads debugging configurations from launch.json and compare that handling with other VS Code configuration types that support env. Done means a PowerShell debug configuration can define environment variables and the launched script receives them; verify the behavior with the extension's existing debugging checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript, vscode
Domain
developer-experience, devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
66/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.