Skip to content

Commit cb2a371

Browse files
Akos Kittakittaakos
Akos Kitta
authored andcommitted
fix: update themeId settings after theme change
In Theia, the theme ID is not always in sync with the persisted `workbench.colorTheme` preference value. For example, one can preview a theme with the `CtrlCmd+K` + `CtrlCmd+T` key chords. On quick pick selection change events, the theme changes, but the change is persisted only on accept (user presses `Enter`). IDE2 has its own way of showing and managing different settings in the UI. When the theme is changed from outside of the IDE2's UI, the model could get out of sync. This PR ensures that on `workbench.colorTheme` preference change, IDE2's settings model is synchronized with persisted Theia preferences. Closes #1987 Signed-off-by: Akos Kitta <[email protected]>
1 parent 96da5bb commit cb2a371

File tree

1 file changed

+11
-0
lines changed
  • arduino-ide-extension/src/browser/dialogs/settings

1 file changed

+11
-0
lines changed

arduino-ide-extension/src/browser/dialogs/settings/settings.ts

+11
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ export class SettingsService {
123123
this._settings = deepClone(settings);
124124
this.ready.resolve();
125125
});
126+
this.preferenceService.onPreferenceChanged(async (event) => {
127+
await this.ready.promise;
128+
const { preferenceName, newValue } = event;
129+
if (
130+
preferenceName === 'workbench.colorTheme' &&
131+
typeof newValue === 'string' &&
132+
this._settings.themeId !== newValue
133+
) {
134+
this.reset();
135+
}
136+
});
126137
}
127138

128139
protected async loadSettings(): Promise<Settings> {

0 commit comments

Comments
 (0)