You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The EnvironmentVariableCollection allows extensions to change the terminal's process environment which enables features like the js-debug auto attach and git's authentication being handled VS Code. It's getting a new API proposal that allows specifying exactly when the variable "mutators" are applied.
Previously they would always be applied as the process is being created but now they can optionally be applied in the shell integration script as well which is done after shell initialization scripts are run. The specific problem this helps us solve is when setting the environment is critically important, such as environment activation in the Python extension, we can ensure that environment variables being touched in shell init scripts doesn't negatively impact the feature (when shell integration is enabled).
Current proposal:
declare module 'vscode'{// https://github.com/microsoft/vscode/issues/179476/** * Options applied to the mutator. */exportinterfaceEnvironmentVariableMutatorOptions{/** * Apply to the environment just before the process is created. * * Defaults to true. */applyAtProcessCreation?: boolean;/** * Apply to the environment in the shell integration script. Note that this _will not_ apply * the mutator if shell integration is disabled or not working for some reason. * * Defaults to false. */applyAtShellIntegration?: boolean;}/** * A type of mutation and its value to be applied to an environment variable. */exportinterfaceEnvironmentVariableMutator{/** * Options applied to the mutator. */readonlyoptions: EnvironmentVariableMutatorOptions;}exportinterfaceEnvironmentVariableCollectionextendsIterable<[variable: string,mutator: EnvironmentVariableMutator]>{/** * @param options Options applied to the mutator. */replace(variable: string,value: string,options?: EnvironmentVariableMutatorOptions): void;/** * @param options Options applied to the mutator. */append(variable: string,value: string,options?: EnvironmentVariableMutatorOptions): void;/** * @param options Options applied to the mutator. */prepend(variable: string,value: string,options?: EnvironmentVariableMutatorOptions): void;}}
Test the following:
The API docs make sense
replace, append and prepend all apply the variable as expected
Test with and without options - to tell the difference between applyAtShellIntegration, try changing variables in your shell startup script, that should happen after applyAtProcessCreation and before applyAtShellIntegration
Test all combinations of applyAtProcessCreation and applyAtShellIntegration.
When applyAtProcessCreation is false and applyAtShellIntegration is false or undefined it should throw.
applyAtShellIntegration should not apply when shell integration is disabled (terminal.integrated.shellIntegration.enabled)
The text was updated successfully, but these errors were encountered:
Refs: #179476
Complexity: 4
Create Issue
The
EnvironmentVariableCollection
allows extensions to change the terminal's process environment which enables features like the js-debug auto attach and git's authentication being handled VS Code. It's getting a new API proposal that allows specifying exactly when the variable "mutators" are applied.Previously they would always be applied as the process is being created but now they can optionally be applied in the shell integration script as well which is done after shell initialization scripts are run. The specific problem this helps us solve is when setting the environment is critically important, such as environment activation in the Python extension, we can ensure that environment variables being touched in shell init scripts doesn't negatively impact the feature (when shell integration is enabled).
Current proposal:
Test the following:
replace
,append
andprepend
all apply the variable as expectedapplyAtShellIntegration
, try changing variables in your shell startup script, that should happen afterapplyAtProcessCreation
and beforeapplyAtShellIntegration
applyAtProcessCreation
andapplyAtShellIntegration
.applyAtProcessCreation
isfalse
andapplyAtShellIntegration
isfalse
orundefined
it should throw.applyAtShellIntegration
should not apply when shell integration is disabled (terminal.integrated.shellIntegration.enabled
)The text was updated successfully, but these errors were encountered: