@@ -16,16 +16,18 @@ import {
16
16
import { EXTENSION_ROOT_DIR } from '../../../constants' ;
17
17
import { IInterpreterService } from '../../../interpreter/contracts' ;
18
18
import { traceLog , traceVerbose } from '../../../logging' ;
19
- import { PythonEnvironment } from '../../../pythonEnvironments/info' ;
19
+ import { EnvironmentType , PythonEnvironment } from '../../../pythonEnvironments/info' ;
20
20
import { sendTelemetryEvent } from '../../../telemetry' ;
21
21
import { EventName } from '../../../telemetry/constants' ;
22
22
import { AttachRequestArguments , LaunchRequestArguments } from '../../types' ;
23
23
import { IDebugAdapterDescriptorFactory } from '../types' ;
24
24
import { showErrorMessage } from '../../../common/vscodeApis/windowApis' ;
25
25
import { Common , Interpreters } from '../../../common/utils/localize' ;
26
- import { IPersistentStateFactory } from '../../../common/types' ;
26
+ import { IExperimentService , IPersistentStateFactory } from '../../../common/types' ;
27
27
import { Commands } from '../../../common/constants' ;
28
28
import { ICommandManager } from '../../../common/application/types' ;
29
+ import { inTerminalEnvVarExperiment } from '../../../common/experiments/helpers' ;
30
+ import { Conda } from '../../../pythonEnvironments/common/environmentManagers/conda' ;
29
31
30
32
// persistent state names, exported to make use of in testing
31
33
export enum debugStateKeys {
@@ -38,6 +40,7 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac
38
40
@inject ( ICommandManager ) private readonly commandManager : ICommandManager ,
39
41
@inject ( IInterpreterService ) private readonly interpreterService : IInterpreterService ,
40
42
@inject ( IPersistentStateFactory ) private persistentState : IPersistentStateFactory ,
43
+ @inject ( IExperimentService ) private experimentService : IExperimentService ,
41
44
) { }
42
45
43
46
public async createDebugAdapterDescriptor (
@@ -186,6 +189,23 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac
186
189
if ( ( interpreter . version ?. major ?? 0 ) < 3 || ( interpreter . version ?. minor ?? 0 ) <= 6 ) {
187
190
this . showDeprecatedPythonMessage ( ) ;
188
191
}
192
+ if ( interpreter . envType === EnvironmentType . Conda && inTerminalEnvVarExperiment ( this . experimentService ) ) {
193
+ const conda = await Conda . getConda ( ) ;
194
+ if ( conda ) {
195
+ const args = await conda . getRunPythonArgs (
196
+ {
197
+ prefix : interpreter . envPath ?? '' ,
198
+ name : interpreter . envName ,
199
+ } ,
200
+ false ,
201
+ false ,
202
+ false ,
203
+ ) ;
204
+ if ( args ) {
205
+ return args ;
206
+ }
207
+ }
208
+ }
189
209
return interpreter . path . length > 0 ? [ interpreter . path ] : [ ] ;
190
210
}
191
211
return [ ] ;
0 commit comments