@@ -47,7 +47,7 @@ import { captureTelemetry, sendTelemetryEvent } from '../../telemetry';
47
47
import { generateCellRangesFromDocument } from '../cellFactory' ;
48
48
import { CellMatcher } from '../cellMatcher' ;
49
49
import { addToUriList , translateKernelLanguageToMonaco } from '../common' ;
50
- import { Commands , Identifiers , Telemetry } from '../constants' ;
50
+ import { Commands , Identifiers , Settings , Telemetry } from '../constants' ;
51
51
import { ColumnWarningSize , IDataViewerFactory } from '../data-viewing/types' ;
52
52
import {
53
53
IAddedSysInfo ,
@@ -865,9 +865,54 @@ export abstract class InteractiveBase extends WebviewPanelHost<IInteractiveWindo
865
865
} catch ( e ) {
866
866
this . errorHandler . handleError ( e ) . ignoreErrors ( ) ;
867
867
}
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 ( ) ;
868
876
}
869
877
}
870
878
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
+
871
916
private combineData (
872
917
oldData : nbformat . ICodeCell | nbformat . IRawCell | nbformat . IMarkdownCell | undefined ,
873
918
cell : ICell
@@ -1154,36 +1199,15 @@ export abstract class InteractiveBase extends WebviewPanelHost<IInteractiveWindo
1154
1199
return notebook ;
1155
1200
}
1156
1201
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
-
1178
1202
private async listenToNotebookEvents ( notebook : INotebook ) : Promise < void > {
1179
1203
const statusChangeHandler = async ( status : ServerStatus ) => {
1180
1204
const connectionMetadata = notebook . getKernelConnection ( ) ;
1181
1205
const name = getDisplayNameOrNameOfKernelConnection ( connectionMetadata ) ;
1182
1206
1183
1207
await this . postMessage ( InteractiveWindowMessages . UpdateKernel , {
1184
1208
jupyterServerStatus : status ,
1185
- localizedUri : this . getServerUri ( notebook . connection ) ,
1186
- displayName : name ,
1209
+ serverName : await this . getServerDisplayName ( notebook . connection ) ,
1210
+ kernelName : name ,
1187
1211
language : translateKernelLanguageToMonaco (
1188
1212
getKernelConnectionLanguage ( connectionMetadata ) || PYTHON_LANGUAGE
1189
1213
)
@@ -1205,8 +1229,8 @@ export abstract class InteractiveBase extends WebviewPanelHost<IInteractiveWindo
1205
1229
// While waiting make the notebook look busy
1206
1230
this . postMessage ( InteractiveWindowMessages . UpdateKernel , {
1207
1231
jupyterServerStatus : ServerStatus . Busy ,
1208
- localizedUri : this . getServerUri ( serverConnection ) ,
1209
- displayName : '' ,
1232
+ serverName : await this . getServerDisplayName ( serverConnection ) ,
1233
+ kernelName : '' ,
1210
1234
language : PYTHON_LANGUAGE
1211
1235
} ) . ignoreErrors ( ) ;
1212
1236
@@ -1234,8 +1258,8 @@ export abstract class InteractiveBase extends WebviewPanelHost<IInteractiveWindo
1234
1258
// No notebook, send update to UI anyway
1235
1259
this . postMessage ( InteractiveWindowMessages . UpdateKernel , {
1236
1260
jupyterServerStatus : ServerStatus . NotStarted ,
1237
- localizedUri : '' ,
1238
- displayName : getDisplayNameOrNameOfKernelConnection ( data . kernelConnection ) ,
1261
+ serverName : await this . getServerDisplayName ( undefined ) ,
1262
+ kernelName : getDisplayNameOrNameOfKernelConnection ( data . kernelConnection ) ,
1239
1263
language : translateKernelLanguageToMonaco (
1240
1264
getKernelConnectionLanguage ( data . kernelConnection ) || PYTHON_LANGUAGE
1241
1265
)
0 commit comments