From 6838ccfcc5eccccc033a6872cf7c2448b349c30d Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Tue, 13 Feb 2024 15:38:26 +0530 Subject: [PATCH] Do not activate microvenv if terminal.activateEnvironment is set to false and when not in terminal experiment (#22909) --- src/client/terminals/envCollectionActivation/service.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/client/terminals/envCollectionActivation/service.ts b/src/client/terminals/envCollectionActivation/service.ts index 491ae786754b..aaa4ccf23bea 100644 --- a/src/client/terminals/envCollectionActivation/service.ts +++ b/src/client/terminals/envCollectionActivation/service.ts @@ -353,7 +353,16 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ private async handleMicroVenv(resource: Resource) { try { + const settings = this.configurationService.getSettings(resource); const workspaceFolder = this.getWorkspaceFolder(resource); + if (!settings.terminal.activateEnvironment) { + this.getEnvironmentVariableCollection({ workspaceFolder }).clear(); + traceVerbose( + 'Do not activate microvenv as activating environments in terminal is disabled for', + resource?.fsPath, + ); + return; + } const interpreter = await this.interpreterService.getActiveInterpreter(resource); if (interpreter?.envType === EnvironmentType.Venv) { const activatePath = path.join(path.dirname(interpreter.path), 'activate');