@@ -8,14 +8,15 @@ import { Uri } from 'vscode';
8
8
import { IExtensionSingleActivationService } from '../../../../activation/types' ;
9
9
import { ICommandManager } from '../../../../common/application/types' ;
10
10
import { Commands } from '../../../../common/constants' ;
11
- import { IConfigurationService , IDisposable , IDisposableRegistry } from '../../../../common/types' ;
11
+ import { IDisposable , IDisposableRegistry } from '../../../../common/types' ;
12
+ import { IInterpreterService } from '../../../../interpreter/contracts' ;
12
13
13
14
@injectable ( )
14
15
export class InterpreterPathCommand implements IExtensionSingleActivationService {
15
16
public readonly supportedWorkspaceTypes = { untrustedWorkspace : false , virtualWorkspace : false } ;
16
17
constructor (
17
18
@inject ( ICommandManager ) private readonly commandManager : ICommandManager ,
18
- @inject ( IConfigurationService ) private readonly configurationService : IConfigurationService ,
19
+ @inject ( IInterpreterService ) private readonly interpreterService : IInterpreterService ,
19
20
@inject ( IDisposableRegistry ) private readonly disposables : IDisposable [ ] ,
20
21
) { }
21
22
@@ -27,7 +28,7 @@ export class InterpreterPathCommand implements IExtensionSingleActivationService
27
28
) ;
28
29
}
29
30
30
- public _getSelectedInterpreterPath ( args : { workspaceFolder : string } | string [ ] ) : string {
31
+ public async _getSelectedInterpreterPath ( args : { workspaceFolder : string } | string [ ] ) : Promise < string > {
31
32
// If `launch.json` is launching this command, `args.workspaceFolder` carries the workspaceFolder
32
33
// If `tasks.json` is launching this command, `args[1]` carries the workspaceFolder
33
34
const workspaceFolder = 'workspaceFolder' in args ? args . workspaceFolder : args [ 1 ] ? args [ 1 ] : undefined ;
@@ -38,6 +39,6 @@ export class InterpreterPathCommand implements IExtensionSingleActivationService
38
39
workspaceFolderUri = undefined ;
39
40
}
40
41
41
- return this . configurationService . getSettings ( workspaceFolderUri ) . pythonPath ;
42
+ return ( await this . interpreterService . getActiveInterpreter ( workspaceFolderUri ) ) ?. path ?? 'python' ;
42
43
}
43
44
}
0 commit comments