@@ -46,6 +46,7 @@ export const SHOW_ALL_FILES_SETTING = `${SKETCHBOOK_SETTING}.showAllFiles`;
46
46
export interface Settings {
47
47
editorFontSize : number ; // `editor.fontSize`
48
48
themeId : string ; // `workbench.colorTheme`
49
+ prevThemeId : string ; // `workbench.prevColorTheme`
49
50
autoSave : Settings . AutoSave ; // `files.autoSave`
50
51
quickSuggestions : Record < 'other' | 'comments' | 'strings' , boolean > ; // `editor.quickSuggestions`
51
52
@@ -123,6 +124,7 @@ export class SettingsService {
123
124
currentLanguage ,
124
125
editorFontSize ,
125
126
themeId ,
127
+ prevThemeId ,
126
128
autoSave ,
127
129
quickSuggestions ,
128
130
autoScaleInterface ,
@@ -144,6 +146,7 @@ export class SettingsService {
144
146
? 'arduino-theme-dark'
145
147
: 'arduino-theme'
146
148
) ,
149
+ this . preferenceService . get < string > ( 'workbench.prevColorTheme' , '' ) ,
147
150
this . preferenceService . get < Settings . AutoSave > (
148
151
AUTO_SAVE_SETTING ,
149
152
Settings . AutoSave . DEFAULT_ON
@@ -169,6 +172,7 @@ export class SettingsService {
169
172
return {
170
173
editorFontSize,
171
174
themeId,
175
+ prevThemeId,
172
176
languages,
173
177
currentLanguage,
174
178
autoSave,
@@ -204,10 +208,14 @@ export class SettingsService {
204
208
}
205
209
}
206
210
207
- async reset ( ) : Promise < void > {
211
+ async reset ( resetFromDialog : boolean ) : Promise < void > {
212
+ const prevThemeId = this . _settings . prevThemeId ;
208
213
const settings = await this . loadSettings ( ) ;
209
214
await this . update ( settings , false ) ;
210
215
this . onDidResetEmitter . fire ( this . _settings ) ;
216
+ if ( resetFromDialog && prevThemeId ) {
217
+ ThemeService . get ( ) . setCurrentTheme ( prevThemeId ) ;
218
+ }
211
219
}
212
220
213
221
async validate (
@@ -259,6 +267,7 @@ export class SettingsService {
259
267
currentLanguage,
260
268
editorFontSize,
261
269
themeId,
270
+ prevThemeId,
262
271
autoSave,
263
272
quickSuggestions,
264
273
autoScaleInterface,
@@ -283,6 +292,7 @@ export class SettingsService {
283
292
284
293
await this . savePreference ( 'editor.fontSize' , editorFontSize ) ;
285
294
await this . savePreference ( 'workbench.colorTheme' , themeId ) ;
295
+ await this . savePreference ( 'workbench.prevColorTheme' , prevThemeId ) ;
286
296
await this . savePreference ( AUTO_SAVE_SETTING , autoSave ) ;
287
297
await this . savePreference ( 'editor.quickSuggestions' , quickSuggestions ) ;
288
298
await this . savePreference ( AUTO_SCALE_SETTING , autoScaleInterface ) ;
0 commit comments