Skip to content

Allow extensions to modify terminal environment variables #46696

@DanTup

Description

@DanTup

Users sometimes want to set SDK paths local to their project to pin the versions of them (or to progressively move projects to the next version). There are two places where they'd want these paths to apply:

  1. The extension uses it to load the correct SDK (eg. for language services, debugger, etc.)
  2. In the integrated terminal

Currently it doesn't seem like there's a way to provide a path once to be used for both of these purposes so the user has to set the path in two places (one in extensions settings and the other in terminal path) and keep them in sync.

I thought maybe I could read the terminals path and use that when locating my SDK, but I tried this:

{
  "terminal.integrated.env.windows": {
    "PATH": "${env:PATH};C:\bin"
  }
}

However if I read that value from "terminal.integrated.env.windows" I get the literal string above without the ${env:PATH} being resolved. Although I could resolve that myself as a special case, maybe there's a better way to handle this (like allowing the user to specify paths that will be prepended to the terminal paths that extensions could use too).

Metadata

Metadata

Assignees

Labels

apiapi-finalizationfeature-requestRequest for new features or functionalityterminalGeneral terminal issues that don't fall under another labelverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions