@@ -47,7 +47,7 @@ import { captureTelemetry, sendTelemetryEvent } from '../../telemetry';
4747import { generateCellRangesFromDocument } from '../cellFactory' ;
4848import { CellMatcher } from '../cellMatcher' ;
4949import { addToUriList , translateKernelLanguageToMonaco } from '../common' ;
50- import { Commands , Identifiers , Telemetry } from '../constants' ;
50+ import { Commands , Identifiers , Settings , Telemetry } from '../constants' ;
5151import { ColumnWarningSize , IDataViewerFactory } from '../data-viewing/types' ;
5252import {
5353 IAddedSysInfo ,
@@ -865,9 +865,54 @@ export abstract class InteractiveBase extends WebviewPanelHost<IInteractiveWindo
865865 } catch ( e ) {
866866 this . errorHandler . handleError ( e ) . ignoreErrors ( ) ;
867867 }
868+ } else {
869+ // Just send a kernel update so it shows something
870+ this . postMessage ( InteractiveWindowMessages . UpdateKernel , {
871+ jupyterServerStatus : ServerStatus . NotStarted ,
872+ serverName : await this . getServerDisplayName ( undefined ) ,
873+ kernelName : '' ,
874+ language : PYTHON_LANGUAGE
875+ } ) . ignoreErrors ( ) ;
868876 }
869877 }
870878
879+ protected async getServerDisplayName ( serverConnection : INotebookProviderConnection | undefined ) : Promise < string > {
880+ // If we don't have a server connection, make one if remote. We need the remote connection in order
881+ // to compute the display name. However only do this if the user is allowing auto start.
882+ if (
883+ ! serverConnection &&
884+ this . configService . getSettings ( this . owningResource ) . datascience . jupyterServerURI !==
885+ Settings . JupyterServerLocalLaunch &&
886+ ! this . configService . getSettings ( this . owningResource ) . datascience . disableJupyterAutoStart
887+ ) {
888+ serverConnection = await this . notebookProvider . connect ( { disableUI : true } ) ;
889+ }
890+
891+ let displayName =
892+ serverConnection ?. displayName ||
893+ ( ! serverConnection ?. localLaunch ? serverConnection ?. url : undefined ) ||
894+ ( this . configService . getSettings ( ) . datascience . jupyterServerURI === Settings . JupyterServerLocalLaunch
895+ ? localize . DataScience . localJupyterServer ( )
896+ : localize . DataScience . serverNotStarted ( ) ) ;
897+
898+ if ( serverConnection ) {
899+ // Determine the connection URI of the connected server to display
900+ if ( serverConnection . localLaunch ) {
901+ displayName = localize . DataScience . localJupyterServer ( ) ;
902+ } else {
903+ // Log this remote URI into our MRU list
904+ addToUriList (
905+ this . globalStorage ,
906+ ! isNil ( serverConnection . url ) ? serverConnection . url : serverConnection . displayName ,
907+ Date . now ( ) ,
908+ serverConnection . displayName
909+ ) ;
910+ }
911+ }
912+
913+ return displayName ;
914+ }
915+
871916 private combineData (
872917 oldData : nbformat . ICodeCell | nbformat . IRawCell | nbformat . IMarkdownCell | undefined ,
873918 cell : ICell
@@ -1154,36 +1199,15 @@ export abstract class InteractiveBase extends WebviewPanelHost<IInteractiveWindo
11541199 return notebook ;
11551200 }
11561201
1157- private getServerUri ( serverConnection : INotebookProviderConnection | undefined ) : string {
1158- let localizedUri = '' ;
1159-
1160- if ( serverConnection ) {
1161- // Determine the connection URI of the connected server to display
1162- if ( serverConnection . localLaunch ) {
1163- localizedUri = localize . DataScience . localJupyterServer ( ) ;
1164- } else {
1165- // Log this remote URI into our MRU list
1166- addToUriList (
1167- this . globalStorage ,
1168- ! isNil ( serverConnection . url ) ? serverConnection . url : serverConnection . displayName ,
1169- Date . now ( ) ,
1170- serverConnection . displayName
1171- ) ;
1172- }
1173- }
1174-
1175- return localizedUri ;
1176- }
1177-
11781202 private async listenToNotebookEvents ( notebook : INotebook ) : Promise < void > {
11791203 const statusChangeHandler = async ( status : ServerStatus ) => {
11801204 const connectionMetadata = notebook . getKernelConnection ( ) ;
11811205 const name = getDisplayNameOrNameOfKernelConnection ( connectionMetadata ) ;
11821206
11831207 await this . postMessage ( InteractiveWindowMessages . UpdateKernel , {
11841208 jupyterServerStatus : status ,
1185- localizedUri : this . getServerUri ( notebook . connection ) ,
1186- displayName : name ,
1209+ serverName : await this . getServerDisplayName ( notebook . connection ) ,
1210+ kernelName : name ,
11871211 language : translateKernelLanguageToMonaco (
11881212 getKernelConnectionLanguage ( connectionMetadata ) || PYTHON_LANGUAGE
11891213 )
@@ -1205,8 +1229,8 @@ export abstract class InteractiveBase extends WebviewPanelHost<IInteractiveWindo
12051229 // While waiting make the notebook look busy
12061230 this . postMessage ( InteractiveWindowMessages . UpdateKernel , {
12071231 jupyterServerStatus : ServerStatus . Busy ,
1208- localizedUri : this . getServerUri ( serverConnection ) ,
1209- displayName : '' ,
1232+ serverName : await this . getServerDisplayName ( serverConnection ) ,
1233+ kernelName : '' ,
12101234 language : PYTHON_LANGUAGE
12111235 } ) . ignoreErrors ( ) ;
12121236
@@ -1234,8 +1258,8 @@ export abstract class InteractiveBase extends WebviewPanelHost<IInteractiveWindo
12341258 // No notebook, send update to UI anyway
12351259 this . postMessage ( InteractiveWindowMessages . UpdateKernel , {
12361260 jupyterServerStatus : ServerStatus . NotStarted ,
1237- localizedUri : '' ,
1238- displayName : getDisplayNameOrNameOfKernelConnection ( data . kernelConnection ) ,
1261+ serverName : await this . getServerDisplayName ( undefined ) ,
1262+ kernelName : getDisplayNameOrNameOfKernelConnection ( data . kernelConnection ) ,
12391263 language : translateKernelLanguageToMonaco (
12401264 getKernelConnectionLanguage ( data . kernelConnection ) || PYTHON_LANGUAGE
12411265 )
0 commit comments