src/vs/platform/terminal/common/environmentVariable.ts

93 LOC · 93 covered · 0 uncovered · 1 ranges · 2299 concepts · 1 introducers · 1085 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- environmentVariable.ts ×1
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { IProcessEnvironment } from '../../../base/common/platform.js';
7 > import { IWorkspaceFolderData } from '../../workspace/common/workspace.js';
8 >
9 > export enum EnvironmentVariableMutatorType {
10 > Replace = 1,
11 > Append = 2,
12 > Prepend = 3
13 > }
14 > export interface IEnvironmentVariableMutator {
15 > readonly variable: string;
16 > readonly value: string;
17 > readonly type: EnvironmentVariableMutatorType;
18 > readonly scope?: EnvironmentVariableScope;
19 > readonly options?: IEnvironmentVariableMutatorOptions;
20 > }
21 >
22 > export interface IEnvironmentVariableCollectionDescription {
23 > readonly description: string | undefined;
24 > readonly scope?: EnvironmentVariableScope;
25 > }
26 >
27 > export interface IEnvironmentVariableMutatorOptions {
28 > applyAtProcessCreation?: boolean;
29 > applyAtShellIntegration?: boolean;
30 > }
31 >
32 > export type EnvironmentVariableScope = {
33 > workspaceFolder?: IWorkspaceFolderData;
34 > };
35 >
36 > export interface IEnvironmentVariableCollection {
37 > readonly map: ReadonlyMap<string, IEnvironmentVariableMutator>;
38 > readonly descriptionMap?: ReadonlyMap<string, IEnvironmentVariableCollectionDescription>;
39 > }
40 >
41 > /** [variable, mutator] */
42 > export type ISerializableEnvironmentVariableCollection = [string, IEnvironmentVariableMutator][];
43 >
44 > export type ISerializableEnvironmentDescriptionMap = [string, IEnvironmentVariableCollectionDescription][];
45 > export interface IExtensionOwnedEnvironmentDescriptionMutator extends IEnvironmentVariableCollectionDescription {
46 > readonly extensionIdentifier: string;
47 > }
48 >
49 > /** [extension, collection, description] */
50 > export type ISerializableEnvironmentVariableCollections = [string, ISerializableEnvironmentVariableCollection, ISerializableEnvironmentDescriptionMap][];
51 >
52 > export interface IExtensionOwnedEnvironmentVariableMutator extends IEnvironmentVariableMutator {
53 > readonly extensionIdentifier: string;
54 > }
55 >
56 > export interface IMergedEnvironmentVariableCollectionDiff {
57 > added: ReadonlyMap<string, IExtensionOwnedEnvironmentVariableMutator[]>;
58 > changed: ReadonlyMap<string, IExtensionOwnedEnvironmentVariableMutator[]>;
59 > removed: ReadonlyMap<string, IExtensionOwnedEnvironmentVariableMutator[]>;
60 > }
61 >
62 > type VariableResolver = (str: string) => Promise<string>;
63 >
64 > /**
65 > * Represents an environment variable collection that results from merging several collections
66 > * together.
67 > */
68 > export interface IMergedEnvironmentVariableCollection {
69 > readonly collections: ReadonlyMap<string, IEnvironmentVariableCollection>;
70 > /**
71 > * Gets the variable map for a given scope.
72 > * @param scope The scope to get the variable map for. If undefined, the global scope is used.
73 > */
74 > getVariableMap(scope: EnvironmentVariableScope | undefined): Map<string, IExtensionOwnedEnvironmentVariableMutator[]>;
75 > /**
76 > * Gets the description map for a given scope.
77 > * @param scope The scope to get the description map for. If undefined, description map for the
78 > * global scope is returned.
79 > */
80 > getDescriptionMap(scope: EnvironmentVariableScope | undefined): Map<string, string | undefined>;
81 > /**
82 > * Applies this collection to a process environment.
83 > * @param variableResolver An optional function to use to resolve variables within the
84 > * environment values.
85 > */
86 > applyToProcessEnvironment(env: IProcessEnvironment, scope: EnvironmentVariableScope | undefined, variableResolver?: VariableResolver): Promise<void>;
87 >
88 > /**
89 > * Generates a diff of this collection against another. Returns undefined if the collections are
90 > * the same.
91 > */
92 > diff(other: IMergedEnvironmentVariableCollection, scope: EnvironmentVariableScope | undefined): IMergedEnvironmentVariableCollectionDiff | undefined;
93 > }