Skip to content

Commit 2dc158e

Browse files
author
Kartik Raj
authored
Log options being passed when using environment collection APIs (#22907)
For #22899
1 parent 5f971ae commit 2dc158e

File tree

1 file changed

+23
-8
lines changed
  • src/client/terminals/envCollectionActivation

1 file changed

+23
-8
lines changed

src/client/terminals/envCollectionActivation/service.ts

+23-8
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
198198

199199
// PS1 in some cases is a shell variable (not an env variable) so "env" might not contain it, calculate it in that case.
200200
env.PS1 = await this.getPS1(shell, resource, env);
201-
const prependOptions = await this.getPrependOptions();
201+
const defaultPrependOptions = await this.getPrependOptions();
202202

203203
// Clear any previously set env vars from collection
204204
envVarCollection.clear();
@@ -213,8 +213,12 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
213213
if (value !== undefined) {
214214
if (key === 'PS1') {
215215
// We cannot have the full PS1 without executing in terminal, which we do not. Hence prepend it.
216-
traceVerbose(`Prepending environment variable ${key} in collection with ${value}`);
217-
envVarCollection.prepend(key, value, prependOptions);
216+
traceVerbose(
217+
`Prepending environment variable ${key} in collection with ${value} ${JSON.stringify(
218+
defaultPrependOptions,
219+
)}`,
220+
);
221+
envVarCollection.prepend(key, value, defaultPrependOptions);
218222
return;
219223
}
220224
if (key === 'PATH') {
@@ -229,7 +233,11 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
229233
if (deactivate) {
230234
value = `${deactivate}${this.separator}${value}`;
231235
}
232-
traceVerbose(`Prepending environment variable ${key} in collection with ${value}`);
236+
traceVerbose(
237+
`Prepending environment variable ${key} in collection with ${value} ${JSON.stringify(
238+
options,
239+
)}`,
240+
);
233241
envVarCollection.prepend(key, value, options);
234242
} else {
235243
if (!value.endsWith(this.separator)) {
@@ -238,16 +246,23 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
238246
if (deactivate) {
239247
value = `${deactivate}${this.separator}${value}`;
240248
}
241-
traceVerbose(`Prepending environment variable ${key} in collection to ${value}`);
249+
traceVerbose(
250+
`Prepending environment variable ${key} in collection to ${value} ${JSON.stringify(
251+
options,
252+
)}`,
253+
);
242254
envVarCollection.prepend(key, value, options);
243255
}
244256
return;
245257
}
246-
traceVerbose(`Setting environment variable ${key} in collection to ${value}`);
247-
envVarCollection.replace(key, value, {
258+
const options = {
248259
applyAtShellIntegration: true,
249260
applyAtProcessCreation: true,
250-
});
261+
};
262+
traceVerbose(
263+
`Setting environment variable ${key} in collection to ${value} ${JSON.stringify(options)}`,
264+
);
265+
envVarCollection.replace(key, value, options);
251266
}
252267
}
253268
});

0 commit comments

Comments
 (0)