@@ -115,7 +115,7 @@ export class Workspace implements IWorkspace {
115115 }
116116 }
117117
118- initWindow ( ) {
118+ async initWindow ( ) {
119119 if ( ! this . defaultResourceType || this . enableAutoOpenFirstWindow === false ) {
120120 return ;
121121 }
@@ -127,6 +127,7 @@ export class Workspace implements IWorkspace {
127127 this . window = new EditorWindow ( resource , this , {
128128 title : resource . title ,
129129 } ) ;
130+ await this . window . init ( ) ;
130131 this . editorWindowMap . set ( this . window . id , this . window ) ;
131132 this . windows = [ ...this . windows , this . window ] ;
132133 this . emitChangeWindow ( ) ;
@@ -196,6 +197,9 @@ export class Workspace implements IWorkspace {
196197 this . windows . splice ( index , 1 ) ;
197198 if ( this . window === window ) {
198199 this . window = this . windows [ index ] || this . windows [ index + 1 ] || this . windows [ index - 1 ] ;
200+ if ( this . window . sleep ) {
201+ this . window . init ( ) ;
202+ }
199203 this . emitChangeActiveWindow ( ) ;
200204 }
201205 this . emitChangeWindow ( ) ;
@@ -206,10 +210,13 @@ export class Workspace implements IWorkspace {
206210 this . remove ( index ) ;
207211 }
208212
209- openEditorWindowById ( id : string ) {
213+ async openEditorWindowById ( id : string ) {
210214 const window = this . editorWindowMap . get ( id ) ;
211215 if ( window ) {
212216 this . window = window ;
217+ if ( window . sleep ) {
218+ await window . init ( ) ;
219+ }
213220 this . emitChangeActiveWindow ( ) ;
214221 }
215222 }
@@ -252,6 +259,7 @@ export class Workspace implements IWorkspace {
252259 this . editorWindowMap . set ( window . id , window ) ;
253260 if ( ! sleep ) {
254261 this . window = window ;
262+ await this . window . init ( ) ;
255263 }
256264 this . emitChangeWindow ( ) ;
257265 this . emitChangeActiveWindow ( ) ;
0 commit comments