Skip to content
Prev Previous commit
Next Next commit
change reset function
  • Loading branch information
francescospissu committed Aug 5, 2022
commit d323b66460ad7c9fc5f4215f09cc0aae09ab8dc3
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class Settings extends SketchContribution {
await this.settingsService.update(settings);
await this.settingsService.save();
} else {
await this.settingsService.reset(true);
await this.settingsService.resetFromDialog();
}
},
isEnabled: () => !this.settingsOpened,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class SettingsDialog extends AbstractDialog<Promise<Settings>> {

// calling settingsService.reset() in order to reload the settings from the preferenceService
// and update the UI including changes triggered from the command palette
this.settingsService.reset(false);
this.settingsService.reset();

this.widget.activate();
}
Expand Down
10 changes: 7 additions & 3 deletions arduino-ide-extension/src/browser/dialogs/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,18 @@ export class SettingsService {
}
}

async reset(resetFromDialog: boolean): Promise<void> {
const prevThemeId = this._settings.prevThemeId;
async reset(): Promise<void> {
const settings = await this.loadSettings();
await this.update(settings, false);
this.onDidResetEmitter.fire(this._settings);
if (resetFromDialog && prevThemeId) {
}

async resetFromDialog(): Promise<void> {
const prevThemeId = this._settings.prevThemeId;
if (prevThemeId) {
ThemeService.get().setCurrentTheme(prevThemeId);
}
this.reset();
}

async validate(
Expand Down