@@ -74,12 +74,12 @@ function handlers(app, opts, done){
7474
7575 const builtName = `untitled${ untitledLast + 1 } ` ;
7676
77- workspace . newFile ( builtName , '' ) ;
78-
79- userConfig . set ( 'last-file' , builtName ) ;
80-
81- documents . create ( path . join ( cwd , builtName ) , '' ) ;
82- documents . focus ( ) ;
77+ workspace . newFile ( builtName , '' )
78+ . then ( ( ) => userConfig . set ( 'last-file' , builtName ) )
79+ . then ( function ( ) {
80+ documents . create ( path . join ( cwd , builtName ) , '' ) ;
81+ documents . focus ( ) ;
82+ } ) ;
8383 }
8484
8585 function saveFile ( ) {
@@ -165,10 +165,9 @@ function handlers(app, opts, done){
165165
166166 // TODO: handle error
167167 workspace . changeFile ( filename )
168+ . then ( ( ) => userConfig . set ( 'last-file' , filename ) )
168169 . then ( ( ) => {
169170 const { content } = workspace . getState ( ) ;
170- userConfig . set ( 'last-file' , filename ) ;
171-
172171 documents . create ( path . join ( cwd , filename ) , content ) ;
173172 documents . focus ( ) ;
174173 } ) ;
@@ -183,10 +182,8 @@ function handlers(app, opts, done){
183182 const dirpath = path . join ( '/' , projectName ) ;
184183
185184 return workspace . changeDirectory ( dirpath )
186- . then ( ( ) => {
187- userConfig . set ( 'cwd' , dirpath ) ;
188- userConfig . set ( 'last-file' , '' ) ;
189- } ) ;
185+ . then ( ( ) => userConfig . set ( 'cwd' , dirpath ) )
186+ . then ( ( ) => userConfig . unset ( 'last-file' ) ) ;
190187 }
191188
192189 function deleteProject ( projectName ) {
0 commit comments