@@ -225,14 +225,14 @@ export async function loadChanges(files: (CurrentTextFile | CurrentBinaryFile)[]
225225 content = ( await api . getDoc ( file . name , file . uri ) ) . result . content ;
226226 } else {
227227 // Insert/update the storage part of class definition.
228- content = new TextDecoder ( ' utf-8' ) . decode ( await vscode . workspace . fs . readFile ( file . uri ) ) . split ( / \r ? \n / g) ;
229- let storageBegin : number ; // the last "Storage ..." line
230- let storageEnd : number ; // the first " }" after storageBegin
231- let classEnd : number ; // the last " }"
232- for ( let i = 0 ; i < content . length ; i ++ ) {
228+ content = new TextDecoder ( " utf-8" ) . decode ( await vscode . workspace . fs . readFile ( file . uri ) ) . split ( / \r ? \n / g) ;
229+ let storageBegin : number ; // the last "Storage ..." line
230+ let storageEnd : number ; // the first " }" after storageBegin
231+ let classEnd : number ; // the last " }"
232+ for ( let i = 0 ; i < content . length ; i ++ ) {
233233 if ( content [ i ] . startsWith ( "Storage " ) ) {
234234 storageBegin = i ;
235- } else if ( ( storageBegin !== undefined ) && ( storageEnd === undefined ) && content [ i ] . startsWith ( "}" ) ) {
235+ } else if ( storageBegin !== undefined && storageEnd === undefined && content [ i ] . startsWith ( "}" ) ) {
236236 storageEnd = i ;
237237 } else if ( content [ i ] . startsWith ( "}" ) ) {
238238 classEnd = i ;
@@ -242,12 +242,12 @@ export async function loadChanges(files: (CurrentTextFile | CurrentBinaryFile)[]
242242 storage = Buffer . isBuffer ( storage ) ? new TextDecoder ( ) . decode ( storage ) . split ( / \r ? \n / g) : storage ;
243243 if ( ( storageBegin && storageEnd ) !== undefined ) {
244244 // when replacing an existing storage definition, we don't need extra empty lines (if any).
245- while ( storage [ storage . length - 1 ] == "" ) {
246- storage . pop ( )
245+ while ( storage [ storage . length - 1 ] == "" ) {
246+ storage . pop ( ) ;
247247 }
248- content . splice ( storageBegin , 1 + storageEnd - storageBegin , ...storage )
248+ content . splice ( storageBegin , 1 + storageEnd - storageBegin , ...storage ) ;
249249 } else {
250- content . splice ( classEnd , 0 , ...storage )
250+ content . splice ( classEnd , 0 , ...storage ) ;
251251 }
252252 }
253253 exportedUris . add ( file . uri . toString ( ) ) ; // Set optimistically
0 commit comments