Skip to content

Commit 5db6ce5

Browse files
Kartik Rajwesm
Kartik Raj
authored andcommitted
Fix prompt that shows up when debugging using an invalid Python (microsoft/vscode-python#19561)
1 parent f7bd5c0 commit 5db6ce5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

extensions/positron-python/src/client/common/utils/localize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export namespace Diagnostics {
3434
);
3535
export const invalidPythonPathInDebuggerSettings = localize(
3636
'diagnostics.invalidPythonPathInDebuggerSettings',
37-
'You need to select a Python interpreter before you start debugging.\n\nTip: click on "Select Python Interpreter" in the status bar.',
37+
'You need to select a Python interpreter before you start debugging.\n\nTip: click on "Select Interpreter" in the status bar.',
3838
);
3939
export const invalidPythonPathInDebuggerLaunch = localize(
4040
'diagnostics.invalidPythonPathInDebuggerLaunch',

extensions/positron-python/src/client/debugger/extension/configuration/resolvers/base.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,12 @@ export abstract class BaseConfigurationResolver<T extends DebugConfiguration>
124124
(await this.interpreterService.getActiveInterpreter(workspaceFolder))?.path ??
125125
this.configurationService.getSettings(workspaceFolder).pythonPath;
126126
debugConfiguration.pythonPath = interpreterPath;
127-
this.pythonPathSource = PythonPathSource.settingsJson;
128127
} else {
129128
debugConfiguration.pythonPath = systemVariables.resolveAny(debugConfiguration.pythonPath);
129+
}
130+
if (debugConfiguration.python === '${command:python.interpreterPath}' || !debugConfiguration.python) {
131+
this.pythonPathSource = PythonPathSource.settingsJson;
132+
} else {
130133
this.pythonPathSource = PythonPathSource.launchJson;
131134
}
132135
debugConfiguration.python = systemVariables.resolveAny(debugConfiguration.python);

extensions/positron-python/src/client/debugger/extension/configuration/resolvers/launch.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { IConfigurationService } from '../../../../common/types';
1313
import { IInterpreterService } from '../../../../interpreter/contracts';
1414
import { DebuggerTypeName } from '../../../constants';
1515
import { DebugOptions, DebugPurpose, LaunchRequestArguments } from '../../../types';
16-
import { PythonPathSource } from '../../types';
1716
import { BaseConfigurationResolver } from './base';
1817
import { IDebugEnvironmentVariablesService } from './helper';
1918

@@ -195,9 +194,7 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver<Launc
195194
debugConfiguration.debugAdapterPython,
196195
debugConfiguration.debugLauncherPython,
197196
]) {
198-
const source =
199-
executable === debugConfiguration.pythonPath ? this.pythonPathSource : PythonPathSource.launchJson;
200-
if (!(await diagnosticService.validatePythonPath(executable, source, folder?.uri))) {
197+
if (!(await diagnosticService.validatePythonPath(executable, this.pythonPathSource, folder?.uri))) {
201198
return false;
202199
}
203200
}

0 commit comments

Comments
 (0)