Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite0e783d

Browse files
committed
sort key when dump project config.
use globalState, not workspaceStae
1 parent48f8b24 commite0e783d

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

‎src/EIDETypeDefine.ts‎

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,36 @@ export class ProjectConfiguration<T extends BuilderConfigData>
511511
}
512512

513513
staticdumpProjectFile<T>(obj:ProjectConfigData<T>):string{
514-
returnyaml.stringify(obj,{indent:2,lineWidth:1000});
514+
constkeyOrder=[
515+
'version',
516+
'name',
517+
'type',
518+
'deviceName',
519+
'packDir',
520+
'srcDirs',
521+
'virtualFolder',
522+
'dependenceList',
523+
'outDir',
524+
'miscInfo',
525+
'targets'
526+
];
527+
returnyaml.stringify(obj,{
528+
indent:2,
529+
lineWidth:1000,
530+
sortMapEntries:(a:any,b:any)=>{
531+
consti_a=keyOrder.findIndex(e=>e==a.key);
532+
consti_b=keyOrder.findIndex(e=>e==b.key);
533+
if(i_a==-1&&i_b==-1){
534+
returna.key<b.key ?-1 :a.key>b.key ?1 :0;
535+
}elseif(i_a==-1){
536+
return1;
537+
}elseif(i_b==-1){
538+
return-1;
539+
}else{
540+
returni_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-
constkey=`eide.user-ctx.${this.config.miscInfo.uid||'tmp'}`;
1405+
constkey=`project.${this.config.miscInfo.uid||'unknown'}`;
13761406
constval=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-
constkey=`eide.user-ctx.${this.config.miscInfo.uid||'tmp'}`;
1418+
constkey=`project.${this.config.miscInfo.uid||'unknown'}`;
13891419
constval=this.workspaceState.get<string>(key);
13901420
constsaveVal=JSON.stringify(data);
13911421
if(val!==saveVal){

‎src/extension.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ export async function activate(context: vscode.ExtensionContext) {
310310
projectExplorer.enableAutoSave(true);
311311

312312
// load project in this workspace
313-
projectExplorer.loadWorkspace(context.workspaceState);
313+
projectExplorer.loadWorkspace(context.globalState);
314314

315315
// hook
316316
postLaunchHook(context);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp