@@ -25,6 +25,14 @@ export class InteractiveEditorInput extends EditorInput implements ICompositeNot
25
25
return instantiationService . createInstance ( InteractiveEditorInput , resource , inputResource , title , language ) ;
26
26
}
27
27
28
+ private static windowNames : Record < string , string > = { } ;
29
+
30
+ static setName ( notebookUri : URI , title : string | undefined ) {
31
+ if ( title ) {
32
+ this . windowNames [ notebookUri . path ] = title ;
33
+ }
34
+ }
35
+
28
36
static readonly ID : string = 'workbench.input.interactive' ;
29
37
30
38
public override get editorId ( ) : string {
@@ -35,7 +43,7 @@ export class InteractiveEditorInput extends EditorInput implements ICompositeNot
35
43
return InteractiveEditorInput . ID ;
36
44
}
37
45
38
- private _initTitle ? : string ;
46
+ private name : string ;
39
47
40
48
get language ( ) {
41
49
return this . _inputModelRef ?. object . textEditorModel . getLanguageId ( ) ?? this . _initLanguage ;
@@ -91,7 +99,7 @@ export class InteractiveEditorInput extends EditorInput implements ICompositeNot
91
99
super ( ) ;
92
100
this . _notebookEditorInput = input ;
93
101
this . _register ( this . _notebookEditorInput ) ;
94
- this . _initTitle = title ;
102
+ this . name = title ?? InteractiveEditorInput . windowNames [ resource . path ] ?? paths . basename ( resource . path , paths . extname ( resource . path ) ) ;
95
103
this . _initLanguage = languageId ;
96
104
this . _resource = resource ;
97
105
this . _inputResource = inputResource ;
@@ -209,14 +217,7 @@ export class InteractiveEditorInput extends EditorInput implements ICompositeNot
209
217
}
210
218
211
219
override getName ( ) {
212
- if ( this . _initTitle ) {
213
- return this . _initTitle ;
214
- }
215
-
216
- const p = this . primary . resource ! . path ;
217
- const basename = paths . basename ( p ) ;
218
-
219
- return basename . substr ( 0 , basename . length - paths . extname ( p ) . length ) ;
220
+ return this . name ;
220
221
}
221
222
222
223
override isModified ( ) {
0 commit comments