Skip to content

Commit 07e3baf

Browse files
committed
Fix native repl to use env extension interpreter
1 parent 0b477a3 commit 07e3baf

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/client/repl/replCommands.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { commands, Uri, window } from 'vscode';
22
import { Disposable } from 'vscode-jsonrpc';
33
import { ICommandManager } from '../common/application/types';
44
import { Commands } from '../common/constants';
5-
import { noop } from '../common/utils/misc';
65
import { IInterpreterService } from '../interpreter/contracts';
76
import { ICodeExecutionHelper } from '../terminals/types';
87
import { getNativeRepl } from './nativeRepl';
@@ -102,14 +101,13 @@ export async function registerReplExecuteOnEnter(
102101
}
103102

104103
async function onInputEnter(
105-
uri: Uri,
104+
uri: Uri | undefined,
106105
commandName: string,
107106
interpreterService: IInterpreterService,
108107
disposables: Disposable[],
109108
): Promise<void> {
110-
const interpreter = await interpreterService.getActiveInterpreter(uri);
109+
const interpreter = await getActiveInterpreter(uri, interpreterService);
111110
if (!interpreter) {
112-
commands.executeCommand(Commands.TriggerEnvironmentSelection, uri).then(noop, noop);
113111
return;
114112
}
115113

src/client/repl/replUtils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,13 @@ export function isMultiLineText(textEditor: TextEditor): boolean {
6666
* Function will also return undefined or active interpreter
6767
*/
6868
export async function getActiveInterpreter(
69-
uri: Uri,
69+
uri: Uri | undefined,
7070
interpreterService: IInterpreterService,
7171
): Promise<PythonEnvironment | undefined> {
72-
const interpreter = await interpreterService.getActiveInterpreter(uri);
72+
const resource = uri ?? getActiveResource();
73+
const interpreter = await interpreterService.getActiveInterpreter(resource);
7374
if (!interpreter) {
74-
commands.executeCommand(Commands.TriggerEnvironmentSelection, uri).then(noop, noop);
75+
commands.executeCommand(Commands.TriggerEnvironmentSelection, resource).then(noop, noop);
7576
return undefined;
7677
}
7778
return interpreter;

0 commit comments

Comments
 (0)