@@ -34,6 +34,27 @@ import {
34
34
ProxySettings ,
35
35
} from '../common/protocol' ;
36
36
37
+ const EDITOR_SETTING = 'editor' ;
38
+ const FONT_SIZE_SETTING = `${ EDITOR_SETTING } .fontSize` ;
39
+ const AUTO_SAVE_SETTING = `${ EDITOR_SETTING } .autoSave` ;
40
+ const QUICK_SUGGESTIONS_SETTING = `${ EDITOR_SETTING } .quickSuggestions` ;
41
+ const ARDUINO_SETTING = 'arduino' ;
42
+ const WINDOW_SETTING = `${ ARDUINO_SETTING } .window` ;
43
+ // const IDE_SETTING = `${ARDUINO_SETTING}.ide`;
44
+ const COMPILE_SETTING = `${ ARDUINO_SETTING } .compile` ;
45
+ const UPLOAD_SETTING = `${ ARDUINO_SETTING } .upload` ;
46
+ const LANGUAGE_SETTING = `${ ARDUINO_SETTING } .language` ;
47
+ const SKETCHBOOK_SETTING = `${ ARDUINO_SETTING } .sketchbook` ;
48
+ const AUTO_SCALE_SETTING = `${ WINDOW_SETTING } .autoScale` ;
49
+ const ZOOM_LEVEL_SETTING = `${ WINDOW_SETTING } .zoomLevel` ;
50
+ // const AUTO_UPDATE_SETTING = `${IDE_SETTING}.autoUpdate`;
51
+ const COMPILE_VERBOSE_SETTING = `${ COMPILE_SETTING } .verbose` ;
52
+ const COMPILE_WARNINGS_SETTING = `${ COMPILE_SETTING } .warnings` ;
53
+ const UPLOAD_VERBOSE_SETTING = `${ UPLOAD_SETTING } .verbose` ;
54
+ const UPLOAD_VERIFY_SETTING = `${ UPLOAD_SETTING } .verify` ;
55
+ const LANGUAGE_LOG_SETTING = `${ LANGUAGE_SETTING } .log` ;
56
+ const SHOW_ALL_FILES_SETTING = `${ SKETCHBOOK_SETTING } .showAllFiles` ;
57
+
37
58
export interface Settings extends Index {
38
59
editorFontSize : number ; // `editor.fontSize`
39
60
themeId : string ; // `workbench.colorTheme`
@@ -109,32 +130,28 @@ export class SettingsService {
109
130
sketchbookShowAllFiles ,
110
131
cliConfig ,
111
132
] = await Promise . all ( [
112
- this . preferenceService . get < number > ( 'editor.fontSize' , 12 ) ,
133
+ this . preferenceService . get < number > ( FONT_SIZE_SETTING , 12 ) ,
113
134
this . preferenceService . get < string > (
114
135
'workbench.colorTheme' ,
115
136
'arduino-theme'
116
137
) ,
117
- this . preferenceService . get < 'on' | 'off' > ( 'editor.autoSave' , 'on' ) ,
118
- this . preferenceService . get < Record < string , unknown > > (
119
- 'editor.quickSuggestion' ,
120
- {
121
- other : false ,
122
- comments : false ,
123
- strings : false ,
124
- }
125
- ) ,
126
- this . preferenceService . get < boolean > ( 'arduino.window.autoScale' , true ) ,
127
- this . preferenceService . get < number > ( 'arduino.window.zoomLevel' , 0 ) ,
128
- // this.preferenceService.get<string>('arduino.ide.autoUpdate', true),
129
- this . preferenceService . get < boolean > ( 'arduino.compile.verbose' , true ) ,
130
- this . preferenceService . get < any > ( 'arduino.compile.warnings' , 'None' ) ,
131
- this . preferenceService . get < boolean > ( 'arduino.upload.verbose' , true ) ,
132
- this . preferenceService . get < boolean > ( 'arduino.upload.verify' , true ) ,
133
- this . preferenceService . get < boolean > ( 'arduino.language.log' , true ) ,
134
- this . preferenceService . get < boolean > (
135
- 'arduino.sketchbook.showAllFiles' ,
136
- false
137
- ) ,
138
+ this . preferenceService . get < 'on' | 'off' > ( AUTO_SAVE_SETTING , 'on' ) ,
139
+ this . preferenceService . get <
140
+ Record < 'other' | 'comments' | 'strings' , boolean >
141
+ > ( QUICK_SUGGESTIONS_SETTING , {
142
+ other : false ,
143
+ comments : false ,
144
+ strings : false ,
145
+ } ) ,
146
+ this . preferenceService . get < boolean > ( AUTO_SCALE_SETTING , true ) ,
147
+ this . preferenceService . get < number > ( ZOOM_LEVEL_SETTING , 0 ) ,
148
+ // this.preferenceService.get<string>(AUTO_UPDATE_SETTING, true),
149
+ this . preferenceService . get < boolean > ( COMPILE_VERBOSE_SETTING , true ) ,
150
+ this . preferenceService . get < any > ( COMPILE_WARNINGS_SETTING , 'None' ) ,
151
+ this . preferenceService . get < boolean > ( UPLOAD_VERBOSE_SETTING , true ) ,
152
+ this . preferenceService . get < boolean > ( UPLOAD_VERIFY_SETTING , true ) ,
153
+ this . preferenceService . get < boolean > ( LANGUAGE_LOG_SETTING , true ) ,
154
+ this . preferenceService . get < boolean > ( SHOW_ALL_FILES_SETTING , false ) ,
138
155
this . configService . getConfiguration ( ) ,
139
156
] ) ;
140
157
const { additionalUrls, sketchDirUri, network } = cliConfig ;
@@ -257,43 +274,43 @@ export class SettingsService {
257
274
PreferenceScope . User
258
275
) ,
259
276
this . preferenceService . set (
260
- 'arduino.window.autoScale' ,
277
+ AUTO_SCALE_SETTING ,
261
278
autoScaleInterface ,
262
279
PreferenceScope . User
263
280
) ,
264
281
this . preferenceService . set (
265
- 'arduino.window.zoomLevel' ,
282
+ ZOOM_LEVEL_SETTING ,
266
283
interfaceScale ,
267
284
PreferenceScope . User
268
285
) ,
269
- // this.preferenceService.set('arduino.ide.autoUpdate' , checkForUpdates, PreferenceScope.User),
286
+ // this.preferenceService.set(AUTO_UPDATE_SETTING , checkForUpdates, PreferenceScope.User),
270
287
this . preferenceService . set (
271
- 'arduino.compile.verbose' ,
288
+ COMPILE_VERBOSE_SETTING ,
272
289
verboseOnCompile ,
273
290
PreferenceScope . User
274
291
) ,
275
292
this . preferenceService . set (
276
- 'arduino.compile.warnings' ,
293
+ COMPILE_WARNINGS_SETTING ,
277
294
compilerWarnings ,
278
295
PreferenceScope . User
279
296
) ,
280
297
this . preferenceService . set (
281
- 'arduino.upload.verbose' ,
298
+ UPLOAD_VERBOSE_SETTING ,
282
299
verboseOnUpload ,
283
300
PreferenceScope . User
284
301
) ,
285
302
this . preferenceService . set (
286
- 'arduino.upload.verify' ,
303
+ UPLOAD_VERIFY_SETTING ,
287
304
verifyAfterUpload ,
288
305
PreferenceScope . User
289
306
) ,
290
307
this . preferenceService . set (
291
- 'arduino.language.log' ,
308
+ LANGUAGE_LOG_SETTING ,
292
309
enableLsLogs ,
293
310
PreferenceScope . User
294
311
) ,
295
312
this . preferenceService . set (
296
- 'arduino.sketchbook.showAllFiles' ,
313
+ SHOW_ALL_FILES_SETTING ,
297
314
sketchbookShowAllFiles ,
298
315
PreferenceScope . User
299
316
) ,
0 commit comments