File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -145,12 +145,12 @@ export class NativeRepl implements Disposable {
145145 /**
146146 * Function that opens interactive repl, selects kernel, and send/execute code to the native repl.
147147 */
148- public async sendToNativeRepl ( code ?: string ) : Promise < void > {
149- const notebookEditor = await openInteractiveREPL ( this . replController , this . notebookDocument ) ;
148+ public async sendToNativeRepl ( code ?: string | undefined , preserveFocus : boolean = true ) : Promise < void > {
149+ const notebookEditor = await openInteractiveREPL ( this . replController , this . notebookDocument , preserveFocus ) ;
150150 this . notebookDocument = notebookEditor . notebook ;
151151
152152 if ( this . notebookDocument ) {
153- this . replController . updateNotebookAffinity ( this . notebookDocument , NotebookControllerAffinity . Default ) ;
153+ this . replController . updateNotebookAffinity ( this . notebookDocument , NotebookControllerAffinity . Preferred ) ;
154154 await selectNotebookKernel ( notebookEditor , this . replController . id , PVSC_EXTENSION_ID ) ;
155155 if ( code ) {
156156 await executeNotebookCell ( notebookEditor , code ) ;
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import { PVSC_EXTENSION_ID } from '../common/constants';
2020export async function openInteractiveREPL (
2121 notebookController : NotebookController ,
2222 notebookDocument : NotebookDocument | undefined ,
23+ preserveFocus : boolean = true ,
2324) : Promise < NotebookEditor > {
2425 let viewColumn = ViewColumn . Beside ;
2526
@@ -34,7 +35,7 @@ export async function openInteractiveREPL(
3435 const editor = window . showNotebookDocument ( notebookDocument ! , {
3536 viewColumn,
3637 asRepl : 'Python REPL' ,
37- preserveFocus : true ,
38+ preserveFocus,
3839 } ) ;
3940 await commands . executeCommand ( 'notebook.selectKernel' , {
4041 editor,
Original file line number Diff line number Diff line change @@ -31,10 +31,8 @@ export async function registerStartNativeReplCommand(
3131 sendTelemetryEvent ( EventName . REPL , undefined , { replType : 'Native' } ) ;
3232 const interpreter = await getActiveInterpreter ( uri , interpreterService ) ;
3333 if ( interpreter ) {
34- if ( interpreter ) {
35- const nativeRepl = await getNativeRepl ( interpreter , disposables ) ;
36- await nativeRepl . sendToNativeRepl ( ) ;
37- }
34+ const nativeRepl = await getNativeRepl ( interpreter , disposables ) ;
35+ await nativeRepl . sendToNativeRepl ( undefined , false ) ;
3836 }
3937 } ) ,
4038 ) ;
You can’t perform that action at this time.
0 commit comments