Skip to main content

Module TerminalEnvCollection

Expand description

TerminalEnvCollection: per-extension env-var mutations applied at every PTY spawn. Backed by VS Code’s EnvironmentVariableCollection API. See ActivateExtension.ts for the wire calls and TerminalProvider.rs for the spawn-time application point. Global registry of per-extension EnvironmentVariableCollection mutations.

Each extension that calls context.environmentVariableCollection.replace( variable, value) lands a Mutator in this registry keyed by (ExtensionId, VariableName). Every PTY spawn consults the registry and applies the accumulated mutations to the child env BEFORE the shell process is launched, so terminals created after an extension’s activation observe the env it requested.

Persistence: persistent=true mutations survive a window reload via Mountain’s storage provider (key __envCollection:<extensionId>). Non-persistent mutations live only for the current session.

Wire format matches VS Code’s EnvironmentVariableMutator: • Type::Replace (1) - set to value, ignore inherited • Type::Append (2) - inherited + value • Type::Prepend (3) - value + inherited

applyAtProcessCreation (default true) is the only application point in the Tauri+PTY world; the upstream applyAtShellIntegration second-chance hook is irrelevant when we already control the spawn.

Structs§

ExtensionCollection
Mutator

Enums§

MutatorType

Statics§

REGISTRY 🔒

Functions§

Append
ApplyToEnv
Apply every registered mutation across every extension to the supplied env map. Mutations are deterministic per (extensionId, variable); across extensions the order is iteration-stable but unordered, so avoid relying on cross-extension ordering for the same variable (matches VS Code’s documented behavior).
Clear
Delete
Get 🔒
ParsePayload
Parse the wire payload { extensionId, variable, value, persistent, description } into a uniform tuple. Missing fields surface as empty strings / None; the dispatcher discards calls whose ExtensionId is empty.
Prepend
Replace
SetDescription
SetPersistent