File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
arduino-ide-extension/src/browser/dialogs/settings Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -201,12 +201,7 @@ export class SettingsComponent extends React.Component<
201201 < div className = "flex-line" >
202202 < select
203203 className = "theia-select"
204- value = {
205- ThemeService . get ( )
206- . getThemes ( )
207- . find ( ( { id } ) => id === this . state . themeId ) ?. label ||
208- nls . localize ( 'arduino/common/unknown' , 'Unknown' )
209- }
204+ value = { ThemeService . get ( ) . getCurrentTheme ( ) . label }
210205 onChange = { this . themeDidChange }
211206 >
212207 { ThemeService . get ( )
@@ -591,6 +586,9 @@ export class SettingsComponent extends React.Component<
591586 const theme = ThemeService . get ( ) . getThemes ( ) [ selectedIndex ] ;
592587 if ( theme ) {
593588 this . setState ( { themeId : theme . id } ) ;
589+ if ( ThemeService . get ( ) . getCurrentTheme ( ) . id !== theme . id ) {
590+ ThemeService . get ( ) . setCurrentTheme ( theme . id ) ;
591+ }
594592 }
595593 } ;
596594
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { SettingsComponent } from './settings-component';
1616import { AsyncLocalizationProvider } from '@theia/core/lib/common/i18n/localization' ;
1717import { AdditionalUrls } from '../../../common/protocol' ;
1818import { AbstractDialog } from '../../theia/dialogs/dialogs' ;
19+ import { ThemeService } from '@theia/core/lib/browser/theming' ;
1920
2021@injectable ( )
2122export class SettingsWidget extends ReactWidget {
@@ -118,6 +119,17 @@ export class SettingsDialog extends AbstractDialog<Promise<Settings>> {
118119
119120 this . widget . activate ( ) ;
120121 }
122+
123+ override async open ( ) : Promise < Promise < Settings > | undefined > {
124+ const themeIdBeforeOpen = ThemeService . get ( ) . getCurrentTheme ( ) . id ;
125+ const result = await super . open ( ) ;
126+ if ( ! result ) {
127+ if ( ThemeService . get ( ) . getCurrentTheme ( ) . id !== themeIdBeforeOpen ) {
128+ ThemeService . get ( ) . setCurrentTheme ( themeIdBeforeOpen ) ;
129+ }
130+ }
131+ return result ;
132+ }
121133}
122134
123135export class AdditionalUrlsDialog extends AbstractDialog < string [ ] > {
You can’t perform that action at this time.
0 commit comments