@@ -80,7 +80,6 @@ import {
8080 IInteractiveWindowInfo ,
8181 IInteractiveWindowListener ,
8282 IJupyterDebugger ,
83- IJupyterExecution ,
8483 IJupyterKernelSpec ,
8584 IJupyterVariableDataProviderFactory ,
8685 IJupyterVariables ,
@@ -134,7 +133,6 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
134133 @unmanaged ( ) cssGenerator : ICodeCssGenerator ,
135134 @unmanaged ( ) themeFinder : IThemeFinder ,
136135 @unmanaged ( ) private statusProvider : IStatusProvider ,
137- @unmanaged ( ) protected jupyterExecution : IJupyterExecution ,
138136 @unmanaged ( ) protected fileSystem : IFileSystem ,
139137 @unmanaged ( ) protected configuration : IConfigurationService ,
140138 @unmanaged ( ) protected jupyterExporter : INotebookExporter ,
@@ -178,9 +176,6 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
178176 const handler = this . documentManager . onDidChangeActiveTextEditor ( ( ) => this . activating ( ) ) ;
179177 this . disposables . push ( handler ) ;
180178
181- // If our execution changes its liveshare session, we need to close our server
182- this . jupyterExecution . sessionChanged ( ( ) => this . reloadAfterShutdown ( ) ) ;
183-
184179 // For each listener sign up for their post events
185180 this . listeners . forEach ( ( l ) => l . postMessage ( ( e ) => this . postMessageInternal ( e . message , e . payload ) ) ) ;
186181 // Channel for listeners to send messages to the interactive base.
@@ -199,8 +194,8 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
199194 . ignoreErrors ( ) ;
200195 } , 0 ) ;
201196
202- // When a server starts, make sure we create a notebook if the server matches
203- jupyterExecution . serverStarted ( this . checkForNotebookProviderConnection . bind ( this ) ) ;
197+ // When a notebook provider first makes its connection check it to see if we should create a notebook
198+ this . disposables . push ( notebookProvider . onConnectionMade ( this . checkForNotebookProviderConnection . bind ( this ) ) ) ;
204199
205200 // When the variable service requests a refresh, refresh our variable list
206201 this . disposables . push ( this . jupyterVariables . refreshRequired ( this . refreshVariables . bind ( this ) ) ) ;
@@ -1046,27 +1041,6 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
10461041 sendTelemetryEvent ( event ) ;
10471042 } ;
10481043
1049- private async stopServer ( ) : Promise < void > {
1050- // Finish either of our notebook promises
1051- if ( this . connectionAndNotebookPromise ) {
1052- await this . connectionAndNotebookPromise ;
1053- this . connectionAndNotebookPromise = undefined ;
1054- }
1055- if ( this . notebookPromise ) {
1056- await this . notebookPromise ;
1057- this . notebookPromise = undefined ;
1058- }
1059- // If we have a notebook dispose of it
1060- if ( this . _notebook ) {
1061- const notebook = this . _notebook ;
1062- this . _notebook = undefined ;
1063- await notebook . dispose ( ) ;
1064- }
1065-
1066- // Disconnect from our notebook provider
1067- await this . notebookProvider . disconnect ( { getOnly : true } ) ;
1068- }
1069-
10701044 // ensureNotebook can be called apart from ensureNotebookAndServer and it needs
10711045 // the same protection to not be called twice
10721046 // tslint:disable-next-line: member-ordering
@@ -1205,20 +1179,6 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
12051179 }
12061180 }
12071181
1208- private async reloadAfterShutdown ( ) : Promise < void > {
1209- try {
1210- await this . stopServer ( ) ;
1211- } catch {
1212- // We just switched from host to guest mode. Don't really care
1213- // if closing the host server kills it.
1214- this . _notebook = undefined ;
1215- } finally {
1216- this . connectionAndNotebookPromise = undefined ;
1217- this . notebookPromise = undefined ;
1218- }
1219- await this . ensureConnectionAndNotebook ( ) ;
1220- }
1221-
12221182 @captureTelemetry ( Telemetry . GotoSourceCode , undefined , false )
12231183 private gotoCode ( args : IGotoCode ) {
12241184 this . gotoCodeInternal ( args . file , args . line ) . catch ( ( err ) => {
0 commit comments