Skip to content

Commit

Permalink
Add change Interpreter Button
Browse files Browse the repository at this point in the history
  • Loading branch information
paulacamargo25 committed Nov 17, 2022
1 parent 0603cef commit f554489
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export namespace Common {
export const alwaysIgnore = localize('Common.alwaysIgnore', 'Always Ignore');
export const ignore = localize('Common.ignore', 'Ignore');
export const selectPythonInterpreter = localize('Common.selectPythonInterpreter', 'Select Python Interpreter');
export const changePythonInterpreter = localize('Common.changePythonInterpreter', 'Change Python Interpreter');
export const openLaunch = localize('Common.openLaunch', 'Open launch.json');
export const useCommandPrompt = localize('Common.useCommandPrompt', 'Use Command Prompt');
export const download = localize('Common.download', 'Download');
Expand Down
8 changes: 7 additions & 1 deletion src/client/debugger/extension/adapter/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import * as nls from 'vscode-nls';
import { showErrorMessage } from '../../../common/vscodeApis/windowApis';
import { Common } from '../../../common/utils/localize';
import { IPersistentStateFactory } from '../../../common/types';
import { Commands } from '../../../common/constants';
import { ICommandManager } from '../../../common/application/types';

const localize: nls.LocalizeFunc = nls.loadMessageBundle();

Expand All @@ -35,6 +37,7 @@ export enum debugStateKeys {
@injectable()
export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFactory {
constructor(
@inject(ICommandManager) private readonly commandManager: ICommandManager,
@inject(IInterpreterService) private readonly interpreterService: IInterpreterService,
@inject(IPersistentStateFactory) private persistentState: IPersistentStateFactory,
) {}
Expand Down Expand Up @@ -160,7 +163,7 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac
if (notificationPromptEnabled.value) {
return;
}
const prompts = [Common.doNotShowAgain];
const prompts = [Common.changePythonInterpreter, Common.doNotShowAgain];
const selection = await showErrorMessage(
localize(
'deprecatedDebuggerError',
Expand All @@ -172,6 +175,9 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac
if (!selection) {
return;
}
if (selection == Common.changePythonInterpreter) {
await this.commandManager.executeCommand(Commands.Set_Interpreter);
}
if (selection == Common.doNotShowAgain) {
// Never show the message again
await this.persistentState
Expand Down

0 comments on commit f554489

Please sign in to comment.