@@ -24,6 +24,7 @@ export interface Settings extends Index {
24
24
editorFontSize : number ; // `editor.fontSize`
25
25
themeId : string ; // `workbench.colorTheme`
26
26
autoSave : 'on' | 'off' ; // `editor.autoSave`
27
+ quickSuggestions : Record < 'other' | 'comments' | 'strings' , boolean > ; // `editor.quickSuggestions`
27
28
28
29
autoScaleInterface : boolean ; // `arduino.window.autoScale`
29
30
interfaceScale : number ; // `arduino.window.zoomLevel` https://github.com/eclipse-theia/theia/issues/8751
@@ -84,6 +85,7 @@ export class SettingsService {
84
85
editorFontSize ,
85
86
themeId ,
86
87
autoSave ,
88
+ quickSuggestions ,
87
89
autoScaleInterface ,
88
90
interfaceScale ,
89
91
// checkForUpdates,
@@ -97,6 +99,11 @@ export class SettingsService {
97
99
this . preferenceService . get < number > ( 'editor.fontSize' , 12 ) ,
98
100
this . preferenceService . get < string > ( 'workbench.colorTheme' , 'arduino-theme' ) ,
99
101
this . preferenceService . get < 'on' | 'off' > ( 'editor.autoSave' , 'on' ) ,
102
+ this . preferenceService . get < object > ( 'editor.quickSuggestion' , {
103
+ 'other' : false ,
104
+ 'comments' : false ,
105
+ 'strings' : false
106
+ } ) ,
100
107
this . preferenceService . get < boolean > ( 'arduino.window.autoScale' , true ) ,
101
108
this . preferenceService . get < number > ( 'arduino.window.zoomLevel' , 0 ) ,
102
109
// this.preferenceService.get<string>('arduino.ide.autoUpdate', true),
@@ -113,6 +120,7 @@ export class SettingsService {
113
120
editorFontSize,
114
121
themeId,
115
122
autoSave,
123
+ quickSuggestions,
116
124
autoScaleInterface,
117
125
interfaceScale,
118
126
// checkForUpdates,
@@ -155,10 +163,10 @@ export class SettingsService {
155
163
return `Invalid sketchbook location: ${ sketchbookPath } ` ;
156
164
}
157
165
if ( editorFontSize <= 0 ) {
158
- return ` Invalid editor font size. It must be a positive integer.` ;
166
+ return ' Invalid editor font size. It must be a positive integer.' ;
159
167
}
160
168
if ( ! ThemeService . get ( ) . getThemes ( ) . find ( ( { id } ) => id === themeId ) ) {
161
- return ` Invalid theme.` ;
169
+ return ' Invalid theme.' ;
162
170
}
163
171
return true ;
164
172
} catch ( err ) {
@@ -175,6 +183,7 @@ export class SettingsService {
175
183
editorFontSize,
176
184
themeId,
177
185
autoSave,
186
+ quickSuggestions,
178
187
autoScaleInterface,
179
188
interfaceScale,
180
189
// checkForUpdates,
@@ -199,6 +208,7 @@ export class SettingsService {
199
208
this . preferenceService . set ( 'editor.fontSize' , editorFontSize , PreferenceScope . User ) ,
200
209
this . preferenceService . set ( 'workbench.colorTheme' , themeId , PreferenceScope . User ) ,
201
210
this . preferenceService . set ( 'editor.autoSave' , autoSave , PreferenceScope . User ) ,
211
+ this . preferenceService . set ( 'editor.quickSuggestions' , quickSuggestions , PreferenceScope . User ) ,
202
212
this . preferenceService . set ( 'arduino.window.autoScale' , autoScaleInterface , PreferenceScope . User ) ,
203
213
this . preferenceService . set ( 'arduino.window.zoomLevel' , interfaceScale , PreferenceScope . User ) ,
204
214
// this.preferenceService.set('arduino.ide.autoUpdate', checkForUpdates, PreferenceScope.User),
@@ -360,6 +370,13 @@ export class SettingsComponent extends React.Component<SettingsComponent.Props,
360
370
onChange = { this . autoSaveDidChange } />
361
371
Auto save
362
372
</ label >
373
+ < label className = 'flex-line' >
374
+ < input
375
+ type = 'checkbox'
376
+ checked = { this . state . quickSuggestions . other === true }
377
+ onChange = { this . quickSuggestionsOtherDidChange } />
378
+ Editor Quick Suggestions
379
+ </ label >
363
380
< label className = 'flex-line' >
364
381
< input
365
382
type = 'checkbox'
@@ -551,6 +568,21 @@ export class SettingsComponent extends React.Component<SettingsComponent.Props,
551
568
this . setState ( { autoSave : event . target . checked ? 'on' : 'off' } ) ;
552
569
} ;
553
570
571
+ protected quickSuggestionsOtherDidChange = ( event : React . ChangeEvent < HTMLInputElement > ) => {
572
+
573
+ // need to persist react events through lifecycle https://reactjs.org/docs/events.html#event-pooling
574
+ const newVal = event . target . checked ? true : false
575
+
576
+ this . setState ( prevState => {
577
+ return {
578
+ quickSuggestions : {
579
+ ...prevState . quickSuggestions ,
580
+ other : newVal
581
+ }
582
+ }
583
+ } ) ;
584
+ } ;
585
+
554
586
protected themeDidChange = ( event : React . ChangeEvent < HTMLSelectElement > ) => {
555
587
const { selectedIndex } = event . target . options ;
556
588
const theme = ThemeService . get ( ) . getThemes ( ) [ selectedIndex ] ;
0 commit comments