Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log options being passed when using environment collection APIs #22907

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions src/client/terminals/envCollectionActivation/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ

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

// Clear any previously set env vars from collection
envVarCollection.clear();
Expand All @@ -213,8 +213,12 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
if (value !== undefined) {
if (key === 'PS1') {
// We cannot have the full PS1 without executing in terminal, which we do not. Hence prepend it.
traceVerbose(`Prepending environment variable ${key} in collection with ${value}`);
envVarCollection.prepend(key, value, prependOptions);
traceVerbose(
`Prepending environment variable ${key} in collection with ${value} ${JSON.stringify(
defaultPrependOptions,
)}`,
);
envVarCollection.prepend(key, value, defaultPrependOptions);
return;
}
if (key === 'PATH') {
Expand All @@ -229,7 +233,11 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
if (deactivate) {
value = `${deactivate}${this.separator}${value}`;
}
traceVerbose(`Prepending environment variable ${key} in collection with ${value}`);
traceVerbose(
`Prepending environment variable ${key} in collection with ${value} ${JSON.stringify(
options,
)}`,
);
envVarCollection.prepend(key, value, options);
} else {
if (!value.endsWith(this.separator)) {
Expand All @@ -238,16 +246,23 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
if (deactivate) {
value = `${deactivate}${this.separator}${value}`;
}
traceVerbose(`Prepending environment variable ${key} in collection to ${value}`);
traceVerbose(
`Prepending environment variable ${key} in collection to ${value} ${JSON.stringify(
options,
)}`,
);
envVarCollection.prepend(key, value, options);
}
return;
}
traceVerbose(`Setting environment variable ${key} in collection to ${value}`);
envVarCollection.replace(key, value, {
const options = {
applyAtShellIntegration: true,
applyAtProcessCreation: true,
});
};
traceVerbose(
`Setting environment variable ${key} in collection to ${value} ${JSON.stringify(options)}`,
);
envVarCollection.replace(key, value, options);
}
}
});
Expand Down
Loading