From bc9637c4ca1aecee9a8cc7d28e41177e5cd066d5 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Wed, 8 May 2024 11:52:29 -0700 Subject: [PATCH] show invalid interpreter when no interpreter is selected --- src/client/repl/replCommands.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/client/repl/replCommands.ts b/src/client/repl/replCommands.ts index 277a05abdf19..8000c0e12653 100644 --- a/src/client/repl/replCommands.ts +++ b/src/client/repl/replCommands.ts @@ -15,6 +15,7 @@ import { } from 'vscode'; import { Disposable } from 'vscode-jsonrpc'; import { Commands, PVSC_EXTENSION_ID } from '../common/constants'; +import { noop } from '../common/utils/misc'; import { IInterpreterService } from '../interpreter/contracts'; import { getMultiLineSelectionText, getSingleLineSelectionText } from '../terminals/codeExecution/helper'; import { createReplController } from './replController'; @@ -63,6 +64,10 @@ export async function registerReplCommands( disposables.push( commands.registerCommand(Commands.Exec_In_REPL, async (uri: Uri) => { const interpreter = await interpreterService.getActiveInterpreter(uri); + if (!interpreter) { + commands.executeCommand(Commands.TriggerEnvironmentSelection, uri).then(noop, noop); + return; + } if (interpreter) { const interpreterPath = interpreter.path; // How do we get instance of interactive window from Python extension?