Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/client/repl/nativeRepl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ export class NativeRepl implements Disposable {
/**
* Function that opens interactive repl, selects kernel, and send/execute code to the native repl.
*/
public async sendToNativeRepl(code?: string): Promise<void> {
const notebookEditor = await openInteractiveREPL(this.replController, this.notebookDocument);
public async sendToNativeRepl(code?: string | undefined, preserveFocus: boolean = true): Promise<void> {
const notebookEditor = await openInteractiveREPL(this.replController, this.notebookDocument, preserveFocus);
this.notebookDocument = notebookEditor.notebook;

if (this.notebookDocument) {
this.replController.updateNotebookAffinity(this.notebookDocument, NotebookControllerAffinity.Default);
this.replController.updateNotebookAffinity(this.notebookDocument, NotebookControllerAffinity.Preferred);
await selectNotebookKernel(notebookEditor, this.replController.id, PVSC_EXTENSION_ID);
if (code) {
await executeNotebookCell(notebookEditor, code);
Expand Down
3 changes: 2 additions & 1 deletion src/client/repl/replCommandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { PVSC_EXTENSION_ID } from '../common/constants';
export async function openInteractiveREPL(
notebookController: NotebookController,
notebookDocument: NotebookDocument | undefined,
preserveFocus: boolean = true,
): Promise<NotebookEditor> {
let viewColumn = ViewColumn.Beside;

Expand All @@ -34,7 +35,7 @@ export async function openInteractiveREPL(
const editor = window.showNotebookDocument(notebookDocument!, {
viewColumn,
asRepl: 'Python REPL',
preserveFocus: true,
preserveFocus,
});
await commands.executeCommand('notebook.selectKernel', {
editor,
Expand Down
6 changes: 2 additions & 4 deletions src/client/repl/replCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ export async function registerStartNativeReplCommand(
sendTelemetryEvent(EventName.REPL, undefined, { replType: 'Native' });
const interpreter = await getActiveInterpreter(uri, interpreterService);
if (interpreter) {
if (interpreter) {
const nativeRepl = await getNativeRepl(interpreter, disposables);
await nativeRepl.sendToNativeRepl();
}
const nativeRepl = await getNativeRepl(interpreter, disposables);
await nativeRepl.sendToNativeRepl(undefined, false);
}
}),
);
Expand Down
Loading