From a35be98f748050a57b664b8b95f178ca41b25924 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Tue, 26 Jul 2022 10:31:24 -0700 Subject: [PATCH] Fix prompt that shows up when debugging using an invalid Python --- src/client/common/utils/localize.ts | 2 +- .../debugger/extension/configuration/resolvers/base.ts | 5 ++++- .../debugger/extension/configuration/resolvers/launch.ts | 5 +---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index 80ca63cc431e..5690e64bcfce 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -34,7 +34,7 @@ export namespace Diagnostics { ); export const invalidPythonPathInDebuggerSettings = localize( 'diagnostics.invalidPythonPathInDebuggerSettings', - 'You need to select a Python interpreter before you start debugging.\n\nTip: click on "Select Python Interpreter" in the status bar.', + 'You need to select a Python interpreter before you start debugging.\n\nTip: click on "Select Interpreter" in the status bar.', ); export const invalidPythonPathInDebuggerLaunch = localize( 'diagnostics.invalidPythonPathInDebuggerLaunch', diff --git a/src/client/debugger/extension/configuration/resolvers/base.ts b/src/client/debugger/extension/configuration/resolvers/base.ts index 88d6e50d484d..89da8e5a96f2 100644 --- a/src/client/debugger/extension/configuration/resolvers/base.ts +++ b/src/client/debugger/extension/configuration/resolvers/base.ts @@ -124,9 +124,12 @@ export abstract class BaseConfigurationResolver (await this.interpreterService.getActiveInterpreter(workspaceFolder))?.path ?? this.configurationService.getSettings(workspaceFolder).pythonPath; debugConfiguration.pythonPath = interpreterPath; - this.pythonPathSource = PythonPathSource.settingsJson; } else { debugConfiguration.pythonPath = systemVariables.resolveAny(debugConfiguration.pythonPath); + } + if (debugConfiguration.python === '${command:python.interpreterPath}' || !debugConfiguration.python) { + this.pythonPathSource = PythonPathSource.settingsJson; + } else { this.pythonPathSource = PythonPathSource.launchJson; } debugConfiguration.python = systemVariables.resolveAny(debugConfiguration.python); diff --git a/src/client/debugger/extension/configuration/resolvers/launch.ts b/src/client/debugger/extension/configuration/resolvers/launch.ts index f8b3bb56725b..4fc3763ee5e4 100644 --- a/src/client/debugger/extension/configuration/resolvers/launch.ts +++ b/src/client/debugger/extension/configuration/resolvers/launch.ts @@ -13,7 +13,6 @@ import { IConfigurationService } from '../../../../common/types'; import { IInterpreterService } from '../../../../interpreter/contracts'; import { DebuggerTypeName } from '../../../constants'; import { DebugOptions, DebugPurpose, LaunchRequestArguments } from '../../../types'; -import { PythonPathSource } from '../../types'; import { BaseConfigurationResolver } from './base'; import { IDebugEnvironmentVariablesService } from './helper'; @@ -195,9 +194,7 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver