Skip to content

Commit 441726f

Browse files
committed
envsExtExperiment
1 parent 7d8ac2f commit 441726f

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,15 +456,17 @@
456456
"pythonPromptNewToolsExt",
457457
"pythonTerminalEnvVarActivation",
458458
"pythonDiscoveryUsingWorkers",
459-
"pythonTestAdapter"
459+
"pythonTestAdapter",
460+
"pythonEnvExtEnabled"
460461
],
461462
"enumDescriptions": [
462463
"%python.experiments.All.description%",
463464
"%python.experiments.pythonSurveyNotification.description%",
464465
"%python.experiments.pythonPromptNewToolsExt.description%",
465466
"%python.experiments.pythonTerminalEnvVarActivation.description%",
466467
"%python.experiments.pythonDiscoveryUsingWorkers.description%",
467-
"%python.experiments.pythonTestAdapter.description%"
468+
"%python.experiments.pythonTestAdapter.description%",
469+
"%python.experiments.pythonEnvExtEnabled.description%"
468470
]
469471
},
470472
"scope": "window",
@@ -481,15 +483,17 @@
481483
"pythonPromptNewToolsExt",
482484
"pythonTerminalEnvVarActivation",
483485
"pythonDiscoveryUsingWorkers",
484-
"pythonTestAdapter"
486+
"pythonTestAdapter",
487+
"pythonEnvExtEnabled"
485488
],
486489
"enumDescriptions": [
487490
"%python.experiments.All.description%",
488491
"%python.experiments.pythonSurveyNotification.description%",
489492
"%python.experiments.pythonPromptNewToolsExt.description%",
490493
"%python.experiments.pythonTerminalEnvVarActivation.description%",
491494
"%python.experiments.pythonDiscoveryUsingWorkers.description%",
492-
"%python.experiments.pythonTestAdapter.description%"
495+
"%python.experiments.pythonTestAdapter.description%",
496+
"%python.experiments.pythonEnvExtEnabled.description%"
493497
]
494498
},
495499
"scope": "window",

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"python.experiments.pythonSurveyNotification.description": "Denotes the Python Survey Notification experiment.",
4646
"python.experiments.pythonPromptNewToolsExt.description": "Denotes the Python Prompt New Tools Extension experiment.",
4747
"python.experiments.pythonTerminalEnvVarActivation.description": "Enables use of environment variables to activate terminals instead of sending activation commands.",
48+
"python.experiments.pythonEnvExtEnabled.description": "Enables the Python Environment Extension to be enabled by default.",
4849
"python.experiments.pythonDiscoveryUsingWorkers.description": "Enables use of worker threads to do heavy computation when discovering interpreters.",
4950
"python.experiments.pythonTestAdapter.description": "Denotes the Python Test Adapter experiment.",
5051
"python.experiments.pythonRecommendTensorboardExt.description": "Denotes the Tensorboard Extension recommendation experiment.",

src/client/common/experiments/groups.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ export enum TerminalEnvVarActivation {
1111
experiment = 'pythonTerminalEnvVarActivation',
1212
}
1313

14+
export enum EnvExtEnabled {
15+
experiment = 'pythonEnvExtEnabled',
16+
}
17+
1418
export enum DiscoveryUsingWorkers {
1519
experiment = 'pythonDiscoveryUsingWorkers',
1620
}

src/client/common/experiments/helpers.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55

66
import { env, workspace } from 'vscode';
77
import { IExperimentService } from '../types';
8-
import { TerminalEnvVarActivation } from './groups';
8+
import { EnvExtEnabled, TerminalEnvVarActivation } from './groups';
99
import { isTestExecution } from '../constants';
1010
import { traceInfo } from '../../logging';
11+
import { inExperiment } from '../../pythonEnvironments/common/externalDependencies';
1112

1213
export function inTerminalEnvVarExperiment(experimentService: IExperimentService): boolean {
1314
if (!isTestExecution() && env.remoteName && workspace.workspaceFolders && workspace.workspaceFolders.length > 1) {
@@ -20,3 +21,7 @@ export function inTerminalEnvVarExperiment(experimentService: IExperimentService
2021
}
2122
return true;
2223
}
24+
25+
export function inEnvExtEnabledExperiment(): boolean {
26+
return inExperiment(EnvExtEnabled.experiment);
27+
}

src/client/envExt/api.internal.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from './types';
1515
import { executeCommand } from '../common/vscodeApis/commandApis';
1616
import { IInterpreterPathService } from '../common/types';
17+
import { inEnvExtEnabledExperiment } from '../common/experiments/helpers';
1718

1819
export const ENVS_EXTENSION_ID = 'ms-python.vscode-python-envs';
1920

@@ -22,7 +23,8 @@ export function useEnvExtension(): boolean {
2223
if (_useExt !== undefined) {
2324
return _useExt;
2425
}
25-
_useExt = !!getExtension(ENVS_EXTENSION_ID);
26+
// If extension is installed and in experiment, then use it.
27+
_useExt = !!getExtension(ENVS_EXTENSION_ID) && inEnvExtEnabledExperiment();
2628
return _useExt;
2729
}
2830

0 commit comments

Comments
 (0)