@@ -11,6 +11,7 @@ import { PYTHON_LANGUAGE } from '../../../../common/constants';
11
11
import { IPlatformService } from '../../../../common/platform/types' ;
12
12
import { IConfigurationService } from '../../../../common/types' ;
13
13
import { SystemVariables } from '../../../../common/variables/systemVariables' ;
14
+ import { IInterpreterService } from '../../../../interpreter/contracts' ;
14
15
import { sendTelemetryEvent } from '../../../../telemetry' ;
15
16
import { EventName } from '../../../../telemetry/constants' ;
16
17
import { DebuggerTelemetry } from '../../../../telemetry/types' ;
@@ -28,6 +29,7 @@ export abstract class BaseConfigurationResolver<T extends DebugConfiguration>
28
29
protected readonly documentManager : IDocumentManager ,
29
30
protected readonly platformService : IPlatformService ,
30
31
protected readonly configurationService : IConfigurationService ,
32
+ protected readonly interpreterService : IInterpreterService ,
31
33
) { }
32
34
33
35
// This is a legacy hook used solely for backwards-compatible manual substitution
@@ -81,12 +83,12 @@ export abstract class BaseConfigurationResolver<T extends DebugConfiguration>
81
83
}
82
84
}
83
85
84
- protected resolveAndUpdatePaths (
86
+ protected async resolveAndUpdatePaths (
85
87
workspaceFolder : Uri | undefined ,
86
88
debugConfiguration : LaunchRequestArguments ,
87
- ) : void {
89
+ ) : Promise < void > {
88
90
this . resolveAndUpdateEnvFilePath ( workspaceFolder , debugConfiguration ) ;
89
- this . resolveAndUpdatePythonPath ( workspaceFolder , debugConfiguration ) ;
91
+ await this . resolveAndUpdatePythonPath ( workspaceFolder , debugConfiguration ) ;
90
92
}
91
93
92
94
protected resolveAndUpdateEnvFilePath (
@@ -105,10 +107,10 @@ export abstract class BaseConfigurationResolver<T extends DebugConfiguration>
105
107
}
106
108
}
107
109
108
- protected resolveAndUpdatePythonPath (
110
+ protected async resolveAndUpdatePythonPath (
109
111
workspaceFolder : Uri | undefined ,
110
112
debugConfiguration : LaunchRequestArguments ,
111
- ) : void {
113
+ ) : Promise < void > {
112
114
if ( ! debugConfiguration ) {
113
115
return ;
114
116
}
@@ -118,8 +120,9 @@ export abstract class BaseConfigurationResolver<T extends DebugConfiguration>
118
120
this . workspaceService ,
119
121
) ;
120
122
if ( debugConfiguration . pythonPath === '${command:python.interpreterPath}' || ! debugConfiguration . pythonPath ) {
121
- const pythonPath = this . configurationService . getSettings ( workspaceFolder ) . pythonPath ;
122
- debugConfiguration . pythonPath = pythonPath ;
123
+ const interpreterPath =
124
+ ( await this . interpreterService . getActiveInterpreter ( workspaceFolder ) ) ?. path ?? 'python' ;
125
+ debugConfiguration . pythonPath = interpreterPath ;
123
126
this . pythonPathSource = PythonPathSource . settingsJson ;
124
127
} else {
125
128
debugConfiguration . pythonPath = systemVariables . resolveAny ( debugConfiguration . pythonPath ) ;
0 commit comments