terminalEnvironment.ts ×7

Frontier kind: Joint frontier

unlabeled · c_6622c56ff57a

1 test · 24860 LOC · 126 files · introduces 1 test · 54 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges54 lines · 2 files
Tests
1 test

Contains — complete concept membership

All code (extent)
2720 ranges24860 lines · 126 files · Browse complete extent
All tests (intent)
1 testBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

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 native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

1 test introduced at this concept.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 54 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts 52 introduced LOC · 7 ranges

Open complete file

23 export function mergeEnvironments(parent: IProcessEnvironment, other: ITerminalEnvironment | undefined): void {
24 if (!other) {
25 > return; terminalEnvironment.ts
26 > }
27
28 // On Windows apply the new values ignoring case, while still retaining
71 }
72
73 > function mergeNonNullKeys(env: IProcessEnvironment, other: ITerminalEnvironment | undefined) { terminalEnvironment.ts
74 > if (!other) {
75 return;
76 }
77 > for (const key of Object.keys(other)) { terminalEnvironment.ts
78 > const value = other[key];
79 > if (value !== undefined && value !== null) {
80 > env[key] = value;
81 > }
82 > }
83 > }
84
85 async function resolveConfigurationVariables(variableResolver: VariableResolver, env: ITerminalEnvironment): Promise<ITerminalEnvironment> {
242 }
243
244 > export async function createTerminalEnvironment( terminalEnvironment.ts
245 > shellLaunchConfig: IShellLaunchConfig,
246 > envFromConfig: ITerminalEnvironment | undefined,
247 > variableResolver: VariableResolver | undefined,
248 > version: string | undefined,
249 > detectLocale: 'auto' | 'off' | 'on',
250 > baseEnv: IProcessEnvironment
251 > ): Promise<IProcessEnvironment> {
252 > // Create a terminal environment based on settings, launch config and permissions
253 > const env: IProcessEnvironment = {};
254 > if (shellLaunchConfig.strictEnv) {
255 // strictEnv is true, only use the requested env (ignoring null entries)
256 mergeNonNullKeys(env, shellLaunchConfig.env);
257 > } else { terminalEnvironment.ts
258 > // Merge process env with the env from config and from shellLaunchConfig
259 > mergeNonNullKeys(env, baseEnv);
260 >
261 > const allowedEnvFromConfig = { ...envFromConfig };
262 >
263 > // Resolve env vars from config and shell
264 > if (variableResolver) {
265 if (allowedEnvFromConfig) {
266 await resolveConfigurationVariables(variableResolver, allowedEnvFromConfig);
270 }
271 }
273 > // Workaround for https://github.com/microsoft/vscode/issues/204005
274 > // We should restore the following environment variables when a user
275 > // launches the application using the CLI so that integrated terminal
276 > // can still inherit these variables.
277 > // We are not bypassing the restrictions implied in https://github.com/electron/electron/pull/40770
278 > // since this only affects integrated terminal and not the application itself.
279 > if (isMacintosh) {
280 // Restore NODE_OPTIONS if it was set
281 if (env['VSCODE_NODE_OPTIONS']) {
290 }
291 }
293 > // Sanitize the environment, removing any undesirable VS Code and Electron environment
294 > // variables
295 > sanitizeProcessEnvironment(env, 'VSCODE_IPC_HOOK_CLI');
296 >
297 > // Merge config (settings) and ShellLaunchConfig environments
298 > mergeEnvironments(env, allowedEnvFromConfig);
299 > mergeEnvironments(env, shellLaunchConfig.env);
300 >
301 > // Adding other env keys necessary to create the process
302 > addTerminalEnvironmentKeys(env, version, language, detectLocale);
303 > }
304 > return env;
305 > }
306
307 /**
src/vs/base/common/processes.ts 2 introduced LOC · 1 range

Open complete file

104 export function sanitizeProcessEnvironment(env: IProcessEnvironment, ...preserve: string[]): void {
105 const set = preserve.reduce<Record<string, boolean>>((set, key) => {
106 > set[key] = true; processes.ts
107 > return set;
108 }, {});
109 const keysToRemove = [