Skip to content

Commit

Permalink
Activate environment when not using integrated terminal for debugging (
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj authored Aug 29, 2023
1 parent 98428cd commit 1204011
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { getProgram, IDebugEnvironmentVariablesService } from './helper';

@injectable()
export class LaunchConfigurationResolver extends BaseConfigurationResolver<LaunchRequestArguments> {
private isPythonSet = false;
private isCustomPythonSet = false;

constructor(
@inject(IDiagnosticsService)
Expand All @@ -38,7 +38,7 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver<Launc
debugConfiguration: LaunchRequestArguments,
_token?: CancellationToken,
): Promise<LaunchRequestArguments | undefined> {
this.isPythonSet = debugConfiguration.python !== undefined;
this.isCustomPythonSet = debugConfiguration.python !== undefined;
if (
debugConfiguration.name === undefined &&
debugConfiguration.type === undefined &&
Expand Down Expand Up @@ -110,7 +110,9 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver<Launc
debugConfiguration.envFile = settings.envFile;
}
let baseEnvVars: EnvironmentVariables | undefined;
if (this.isPythonSet) {
if (this.isCustomPythonSet || debugConfiguration.console !== 'integratedTerminal') {
// We only have the right activated environment present in integrated terminal if no custom Python path
// is specified. Otherwise, we need to explicitly set the variables.
baseEnvVars = await this.environmentActivationService.getActivatedEnvironmentVariables(
workspaceFolder,
await this.interpreterService.getInterpreterDetails(debugConfiguration.python ?? ''),
Expand Down

0 comments on commit 1204011

Please sign in to comment.