Skip to content

Commit 8bd0cfe

Browse files
committed
clear pending save action when project file changed.
1 parent 2a12dde commit 8bd0cfe

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/EIDEProject.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,6 +1524,13 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
15241524
}
15251525
}
15261526

1527+
clearPendingSave() {
1528+
if (this.__saveDelayTimer) {
1529+
clearTimeout(this.__saveDelayTimer);
1530+
this.__saveDelayTimer = undefined;
1531+
}
1532+
}
1533+
15271534
InstallPack(packFile: File, reporter?: (progress?: number, message?: string) => void) {
15281535
return this.packManager.Install(packFile, reporter);
15291536
}

src/EIDEProjectExplorer.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem>, vsco
828828
break;
829829
}
830830

831-
prj.Save(false, 1000); // save project file with a delay
831+
prj.Save(false, 2500); // save project file with a delay
832832
}
833833

834834
LoadWorkspaceProject(workspaceState: vscode.Memento) {
@@ -3589,9 +3589,9 @@ export class ProjectExplorer implements CustomConfigurationProvider {
35893589
const uid = prj.getUid();
35903590
const wsf = prj.getWorkspaceFile();
35913591

3592-
//
3592+
prj.clearPendingSave();
3593+
35933594
// disable autosave
3594-
//
35953595
this.enableAutoSave(false);
35963596

35973597
if (this.__autosaveDisableTimeoutTimer) {
@@ -3603,9 +3603,7 @@ export class ProjectExplorer implements CustomConfigurationProvider {
36033603
}, 5 * 60 * 1000, this);
36043604
}
36053605

3606-
//
3607-
// do something
3608-
//
3606+
// ask user to reload project
36093607
const msg = view_str$prompt$need_reload_project.replace('{}', prj.getProjectName());
36103608
const ans = await vscode.window.showInformationMessage(msg, 'Yes', 'No');
36113609
if (ans == 'Yes') {
@@ -3617,9 +3615,7 @@ export class ProjectExplorer implements CustomConfigurationProvider {
36173615
this.__autosaveDisableTimeoutTimer = undefined;
36183616
}
36193617

3620-
//
36213618
// enable auto save
3622-
//
36233619
this.enableAutoSave(true);
36243620
}
36253621

0 commit comments

Comments
 (0)