diff --git a/package.json b/package.json index 0414e9df1b04..bd99da6f00a5 100644 --- a/package.json +++ b/package.json @@ -456,7 +456,8 @@ "pythonPromptNewToolsExt", "pythonTerminalEnvVarActivation", "pythonDiscoveryUsingWorkers", - "pythonTestAdapter" + "pythonTestAdapter", + "pythonEnvExtEnabled" ], "enumDescriptions": [ "%python.experiments.All.description%", @@ -464,7 +465,8 @@ "%python.experiments.pythonPromptNewToolsExt.description%", "%python.experiments.pythonTerminalEnvVarActivation.description%", "%python.experiments.pythonDiscoveryUsingWorkers.description%", - "%python.experiments.pythonTestAdapter.description%" + "%python.experiments.pythonTestAdapter.description%", + "%python.experiments.pythonEnvExtEnabled.description%" ] }, "scope": "window", @@ -481,7 +483,8 @@ "pythonPromptNewToolsExt", "pythonTerminalEnvVarActivation", "pythonDiscoveryUsingWorkers", - "pythonTestAdapter" + "pythonTestAdapter", + "pythonEnvExtEnabled" ], "enumDescriptions": [ "%python.experiments.All.description%", @@ -489,7 +492,8 @@ "%python.experiments.pythonPromptNewToolsExt.description%", "%python.experiments.pythonTerminalEnvVarActivation.description%", "%python.experiments.pythonDiscoveryUsingWorkers.description%", - "%python.experiments.pythonTestAdapter.description%" + "%python.experiments.pythonTestAdapter.description%", + "%python.experiments.pythonEnvExtEnabled.description%" ] }, "scope": "window", diff --git a/package.nls.json b/package.nls.json index b6ba75b332f2..a6ac7dfdcf60 100644 --- a/package.nls.json +++ b/package.nls.json @@ -45,6 +45,7 @@ "python.experiments.pythonSurveyNotification.description": "Denotes the Python Survey Notification experiment.", "python.experiments.pythonPromptNewToolsExt.description": "Denotes the Python Prompt New Tools Extension experiment.", "python.experiments.pythonTerminalEnvVarActivation.description": "Enables use of environment variables to activate terminals instead of sending activation commands.", + "python.experiments.pythonEnvExtEnabled.description": "Enables the Python Environments extension to be enabled by default.", "python.experiments.pythonDiscoveryUsingWorkers.description": "Enables use of worker threads to do heavy computation when discovering interpreters.", "python.experiments.pythonTestAdapter.description": "Denotes the Python Test Adapter experiment.", "python.experiments.pythonRecommendTensorboardExt.description": "Denotes the Tensorboard Extension recommendation experiment.", diff --git a/src/client/common/experiments/groups.ts b/src/client/common/experiments/groups.ts index 12f4ef89018b..decc3aa2f481 100644 --- a/src/client/common/experiments/groups.ts +++ b/src/client/common/experiments/groups.ts @@ -11,6 +11,10 @@ export enum TerminalEnvVarActivation { experiment = 'pythonTerminalEnvVarActivation', } +export enum EnvExtEnabled { + experiment = 'pythonEnvExtEnabled', +} + export enum DiscoveryUsingWorkers { experiment = 'pythonDiscoveryUsingWorkers', } diff --git a/src/client/common/experiments/helpers.ts b/src/client/common/experiments/helpers.ts index f6ae39d260f5..973e271fb9bc 100644 --- a/src/client/common/experiments/helpers.ts +++ b/src/client/common/experiments/helpers.ts @@ -5,9 +5,10 @@ import { env, workspace } from 'vscode'; import { IExperimentService } from '../types'; -import { TerminalEnvVarActivation } from './groups'; +import { EnvExtEnabled, TerminalEnvVarActivation } from './groups'; import { isTestExecution } from '../constants'; import { traceInfo } from '../../logging'; +import { inExperiment } from '../../pythonEnvironments/common/externalDependencies'; export function inTerminalEnvVarExperiment(experimentService: IExperimentService): boolean { if (!isTestExecution() && env.remoteName && workspace.workspaceFolders && workspace.workspaceFolders.length > 1) { @@ -20,3 +21,7 @@ export function inTerminalEnvVarExperiment(experimentService: IExperimentService } return true; } + +export function inEnvExtEnabledExperiment(): boolean { + return inExperiment(EnvExtEnabled.experiment); +} diff --git a/src/client/envExt/api.internal.ts b/src/client/envExt/api.internal.ts index 552e31a0598e..71c480200c2d 100644 --- a/src/client/envExt/api.internal.ts +++ b/src/client/envExt/api.internal.ts @@ -14,6 +14,7 @@ import { } from './types'; import { executeCommand } from '../common/vscodeApis/commandApis'; import { IInterpreterPathService } from '../common/types'; +import { inEnvExtEnabledExperiment } from '../common/experiments/helpers'; export const ENVS_EXTENSION_ID = 'ms-python.vscode-python-envs'; @@ -22,7 +23,8 @@ export function useEnvExtension(): boolean { if (_useExt !== undefined) { return _useExt; } - _useExt = !!getExtension(ENVS_EXTENSION_ID); + // If extension is installed and in experiment, then use it. + _useExt = !!getExtension(ENVS_EXTENSION_ID) && inEnvExtEnabledExperiment(); return _useExt; }