@@ -25,6 +25,14 @@ export class InteractiveEditorInput extends EditorInput implements ICompositeNot
2525 return instantiationService . createInstance ( InteractiveEditorInput , resource , inputResource , title , language ) ;
2626 }
2727
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+
2836 static readonly ID : string = 'workbench.input.interactive' ;
2937
3038 public override get editorId ( ) : string {
@@ -35,7 +43,7 @@ export class InteractiveEditorInput extends EditorInput implements ICompositeNot
3543 return InteractiveEditorInput . ID ;
3644 }
3745
38- private _initTitle ? : string ;
46+ private name : string ;
3947
4048 get language ( ) {
4149 return this . _inputModelRef ?. object . textEditorModel . getLanguageId ( ) ?? this . _initLanguage ;
@@ -91,7 +99,7 @@ export class InteractiveEditorInput extends EditorInput implements ICompositeNot
9199 super ( ) ;
92100 this . _notebookEditorInput = input ;
93101 this . _register ( this . _notebookEditorInput ) ;
94- this . _initTitle = title ;
102+ this . name = title ?? InteractiveEditorInput . windowNames [ resource . path ] ?? paths . basename ( resource . path , paths . extname ( resource . path ) ) ;
95103 this . _initLanguage = languageId ;
96104 this . _resource = resource ;
97105 this . _inputResource = inputResource ;
@@ -209,14 +217,7 @@ export class InteractiveEditorInput extends EditorInput implements ICompositeNot
209217 }
210218
211219 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 ;
220221 }
221222
222223 override isModified ( ) {
0 commit comments