@@ -511,7 +511,36 @@ export class ProjectConfiguration<T extends BuilderConfigData>
511511 }
512512
513513 static dumpProjectFile < T > ( obj : ProjectConfigData < T > ) : string {
514- return yaml . stringify ( obj , { indent : 2 , lineWidth : 1000 } ) ;
514+ const keyOrder = [
515+ 'version' ,
516+ 'name' ,
517+ 'type' ,
518+ 'deviceName' ,
519+ 'packDir' ,
520+ 'srcDirs' ,
521+ 'virtualFolder' ,
522+ 'dependenceList' ,
523+ 'outDir' ,
524+ 'miscInfo' ,
525+ 'targets'
526+ ] ;
527+ return yaml . stringify ( obj , {
528+ indent : 2 ,
529+ lineWidth : 1000 ,
530+ sortMapEntries : ( a : any , b : any ) => {
531+ const i_a = keyOrder . findIndex ( e => e == a . key ) ;
532+ const i_b = keyOrder . findIndex ( e => e == b . key ) ;
533+ if ( i_a == - 1 && i_b == - 1 ) {
534+ return a . key < b . key ? - 1 : a . key > b . key ? 1 : 0 ;
535+ } else if ( i_a == - 1 ) {
536+ return 1 ;
537+ } else if ( i_b == - 1 ) {
538+ return - 1 ;
539+ } else {
540+ return i_a - i_b ;
541+ }
542+ }
543+ } ) ;
515544 }
516545
517546 private __fileChgEvtEmitDelayTimer : NodeJS . Timeout | undefined ;
@@ -757,7 +786,8 @@ export class ProjectConfiguration<T extends BuilderConfigData>
757786 this . config . compileConfig = this . compileConfigModel . data ; // bind obj
758787
759788 // update
760- this . compileConfigModel . copyCommonCompileConfigFrom ( oldToolchain , oldModel ) ;
789+ if ( ! oldCfg )
790+ this . compileConfigModel . copyCommonCompileConfigFrom ( oldToolchain , oldModel ) ;
761791 this . compileConfigModel . copyListenerFrom ( oldModel ) ;
762792 }
763793
@@ -1372,7 +1402,7 @@ export class ProjectConfiguration<T extends BuilderConfigData>
13721402 }
13731403
13741404 getProjectUsrCtx ( ) : ProjectUserContextData {
1375- const key = `eide.user-ctx. ${ this . config . miscInfo . uid || 'tmp ' } ` ;
1405+ const key = `project. ${ this . config . miscInfo . uid || 'unknown ' } ` ;
13761406 const val = this . workspaceState . get < string > ( key ) ;
13771407 if ( ! val )
13781408 return { } ;
@@ -1385,7 +1415,7 @@ export class ProjectConfiguration<T extends BuilderConfigData>
13851415 } ;
13861416
13871417 setProjectUsrCtx ( data : ProjectUserContextData ) {
1388- const key = `eide.user-ctx. ${ this . config . miscInfo . uid || 'tmp ' } ` ;
1418+ const key = `project. ${ this . config . miscInfo . uid || 'unknown ' } ` ;
13891419 const val = this . workspaceState . get < string > ( key ) ;
13901420 const saveVal = JSON . stringify ( data ) ;
13911421 if ( val !== saveVal ) {
0 commit comments