Skip to content

Commit ccbf154

Browse files
author
Kartik Raj
committed
Support ${command:python.interpreterPath} with this envs
1 parent 22ccb95 commit ccbf154

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/client/debugger/extension/configuration/launch.json/interpreterPathCommand.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ import { Uri } from 'vscode';
88
import { IExtensionSingleActivationService } from '../../../../activation/types';
99
import { ICommandManager } from '../../../../common/application/types';
1010
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';
1213

1314
@injectable()
1415
export class InterpreterPathCommand implements IExtensionSingleActivationService {
1516
public readonly supportedWorkspaceTypes = { untrustedWorkspace: false, virtualWorkspace: false };
1617
constructor(
1718
@inject(ICommandManager) private readonly commandManager: ICommandManager,
18-
@inject(IConfigurationService) private readonly configurationService: IConfigurationService,
19+
@inject(IInterpreterService) private readonly interpreterService: IInterpreterService,
1920
@inject(IDisposableRegistry) private readonly disposables: IDisposable[],
2021
) {}
2122

@@ -27,7 +28,7 @@ export class InterpreterPathCommand implements IExtensionSingleActivationService
2728
);
2829
}
2930

30-
public _getSelectedInterpreterPath(args: { workspaceFolder: string } | string[]): string {
31+
public async _getSelectedInterpreterPath(args: { workspaceFolder: string } | string[]): Promise<string> {
3132
// If `launch.json` is launching this command, `args.workspaceFolder` carries the workspaceFolder
3233
// If `tasks.json` is launching this command, `args[1]` carries the workspaceFolder
3334
const workspaceFolder = 'workspaceFolder' in args ? args.workspaceFolder : args[1] ? args[1] : undefined;
@@ -38,6 +39,6 @@ export class InterpreterPathCommand implements IExtensionSingleActivationService
3839
workspaceFolderUri = undefined;
3940
}
4041

41-
return this.configurationService.getSettings(workspaceFolderUri).pythonPath;
42+
return (await this.interpreterService.getActiveInterpreter(workspaceFolderUri))?.path ?? 'python';
4243
}
4344
}

0 commit comments

Comments
 (0)