VS Code API
    Preparing search index...

    Interface EnvironmentVariableCollection

    A collection of mutations that an extension can apply to a process environment.

    interface EnvironmentVariableCollection {
        description: string | MarkdownString | undefined;
        persistent: boolean;
        "[iterator]"(): Iterator<
            [variable: string, mutator: EnvironmentVariableMutator],
            any,
            any,
        >;
        append(
            variable: string,
            value: string,
            options?: EnvironmentVariableMutatorOptions,
        ): void;
        clear(): void;
        delete(variable: string): void;
        forEach(
            callback: (
                variable: string,
                mutator: EnvironmentVariableMutator,
                collection: EnvironmentVariableCollection,
            ) => any,
            thisArg?: any,
        ): void;
        get(variable: string): EnvironmentVariableMutator | undefined;
        prepend(
            variable: string,
            value: string,
            options?: EnvironmentVariableMutatorOptions,
        ): void;
        replace(
            variable: string,
            value: string,
            options?: EnvironmentVariableMutatorOptions,
        ): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    description: string | MarkdownString | undefined

    A description for the environment variable collection, this will be used to describe the changes in the UI.

    persistent: boolean

    Whether the collection should be cached for the workspace and applied to the terminal across window reloads. When true the collection will be active immediately such when the window reloads. Additionally, this API will return the cached version if it exists. The collection will be invalidated when the extension is uninstalled or when the collection is cleared. Defaults to true.

    Methods

    • Append a value to an environment variable.

      Note that an extension can only make a single change to any one variable, so this will overwrite any previous calls to replace, append or prepend.

      Parameters

      • variable: string

        The variable to append to.

      • value: string

        The value to append to the variable.

      • Optionaloptions: EnvironmentVariableMutatorOptions

        Options applied to the mutator, when no options are provided this will default to { applyAtProcessCreation: true }.

      Returns void

    • Clears all mutators from this collection.

      Returns void

    • Deletes this collection's mutator for a variable.

      Parameters

      • variable: string

        The variable to delete the mutator for.

      Returns void

    • Prepend a value to an environment variable.

      Note that an extension can only make a single change to any one variable, so this will overwrite any previous calls to replace, append or prepend.

      Parameters

      • variable: string

        The variable to prepend.

      • value: string

        The value to prepend to the variable.

      • Optionaloptions: EnvironmentVariableMutatorOptions

        Options applied to the mutator, when no options are provided this will default to { applyAtProcessCreation: true }.

      Returns void

    • Replace an environment variable with a value.

      Note that an extension can only make a single change to any one variable, so this will overwrite any previous calls to replace, append or prepend.

      Parameters

      • variable: string

        The variable to replace.

      • value: string

        The value to replace the variable with.

      • Optionaloptions: EnvironmentVariableMutatorOptions

        Options applied to the mutator, when no options are provided this will default to { applyAtProcessCreation: true }.

      Returns void