Skip to content

Commit 1204011

Browse files
author
Kartik Raj
authored
Activate environment when not using integrated terminal for debugging (#21880)
For #4300
1 parent 98428cd commit 1204011

File tree

1 file changed

+5
-3
lines changed
  • src/client/debugger/extension/configuration/resolvers

1 file changed

+5
-3
lines changed

src/client/debugger/extension/configuration/resolvers/launch.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { getProgram, IDebugEnvironmentVariablesService } from './helper';
1919

2020
@injectable()
2121
export class LaunchConfigurationResolver extends BaseConfigurationResolver<LaunchRequestArguments> {
22-
private isPythonSet = false;
22+
private isCustomPythonSet = false;
2323

2424
constructor(
2525
@inject(IDiagnosticsService)
@@ -38,7 +38,7 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver<Launc
3838
debugConfiguration: LaunchRequestArguments,
3939
_token?: CancellationToken,
4040
): Promise<LaunchRequestArguments | undefined> {
41-
this.isPythonSet = debugConfiguration.python !== undefined;
41+
this.isCustomPythonSet = debugConfiguration.python !== undefined;
4242
if (
4343
debugConfiguration.name === undefined &&
4444
debugConfiguration.type === undefined &&
@@ -110,7 +110,9 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver<Launc
110110
debugConfiguration.envFile = settings.envFile;
111111
}
112112
let baseEnvVars: EnvironmentVariables | undefined;
113-
if (this.isPythonSet) {
113+
if (this.isCustomPythonSet || debugConfiguration.console !== 'integratedTerminal') {
114+
// We only have the right activated environment present in integrated terminal if no custom Python path
115+
// is specified. Otherwise, we need to explicitly set the variables.
114116
baseEnvVars = await this.environmentActivationService.getActivatedEnvironmentVariables(
115117
workspaceFolder,
116118
await this.interpreterService.getInterpreterDetails(debugConfiguration.python ?? ''),

0 commit comments

Comments
 (0)