Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
const workspaceFolder = this.getWorkspaceFolder(resource);
const settings = this.configurationService.getSettings(resource);
const envVarCollection = this.getEnvironmentVariableCollection({ workspaceFolder });
// Clear any previously set env vars from collection
envVarCollection.clear();
if (!settings.terminal.activateEnvironment) {
envVarCollection.clear();
traceVerbose('Activating environments in terminal is disabled for', resource?.fsPath);
return;
}
Expand All @@ -150,6 +149,7 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
return;
}
await this.trackTerminalPrompt(shell, resource, env);
envVarCollection.clear();
this.processEnvVars = undefined;
return;
}
Expand All @@ -164,6 +164,8 @@ 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);

// Clear any previously set env vars from collection
envVarCollection.clear();
Object.keys(env).forEach((key) => {
if (shouldSkip(key)) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ suite('Terminal Environment Variable Collection Service', () => {
await terminalEnvVarCollectionService._applyCollection(undefined, customShell);

verify(collection.replace('CONDA_PREFIX', 'prefix/to/conda', anything())).once();
verify(collection.clear()).twice();
verify(collection.clear()).once();
});

test('If no activated variables are returned for default shell, clear collection', async () => {
Expand Down