@@ -45,6 +45,12 @@ export interface IDeviceContext {
45
45
46
46
debugger_ : string ;
47
47
48
+ /**
49
+ * Current selected programmer.
50
+ * @property {string }
51
+ */
52
+ programmer : string ;
53
+
48
54
/**
49
55
* Arduino custom board configuration
50
56
* @property {string }
@@ -88,6 +94,8 @@ export class DeviceContext implements IDeviceContext, vscode.Disposable {
88
94
89
95
private _prebuild : string ;
90
96
97
+ private _programmer : string ;
98
+
91
99
/**
92
100
* @constructor
93
101
*/
@@ -145,6 +153,7 @@ export class DeviceContext implements IDeviceContext, vscode.Disposable {
145
153
this . _debugger = deviceConfigJson [ "debugger" ] ;
146
154
this . _onDidChange . fire ( ) ;
147
155
this . _prebuild = deviceConfigJson . prebuild ;
156
+ this . _programmer = deviceConfigJson . programmer ;
148
157
} else {
149
158
Logger . notifyUserError ( "arduinoFileError" , new Error ( constants . messages . ARDUINO_FILE_ERROR ) ) ;
150
159
}
@@ -157,6 +166,7 @@ export class DeviceContext implements IDeviceContext, vscode.Disposable {
157
166
this . _debugger = null ;
158
167
this . _onDidChange . fire ( ) ;
159
168
this . _prebuild = null ;
169
+ this . _programmer = null ;
160
170
}
161
171
return this ;
162
172
} , ( reason ) => {
@@ -174,6 +184,7 @@ export class DeviceContext implements IDeviceContext, vscode.Disposable {
174
184
this . _debugger = null ;
175
185
this . _onDidChange . fire ( ) ;
176
186
this . _prebuild = null ;
187
+ this . _programmer = null ;
177
188
178
189
return this ;
179
190
} ) ;
@@ -207,6 +218,7 @@ export class DeviceContext implements IDeviceContext, vscode.Disposable {
207
218
deviceConfigJson . output = this . output ;
208
219
deviceConfigJson [ "debugger" ] = this . debugger_ ;
209
220
deviceConfigJson . configuration = this . configuration ;
221
+ deviceConfigJson . programmer = this . programmer ;
210
222
211
223
util . mkdirRecursivelySync ( path . dirname ( deviceConfigFile ) ) ;
212
224
fs . writeFileSync ( deviceConfigFile , JSON . stringify ( deviceConfigJson , ( key , value ) => {
@@ -279,6 +291,15 @@ export class DeviceContext implements IDeviceContext, vscode.Disposable {
279
291
this . saveContext ( ) ;
280
292
}
281
293
294
+ public get programmer ( ) {
295
+ return this . _programmer ;
296
+ }
297
+
298
+ public set programmer ( value : string ) {
299
+ this . _programmer = value ;
300
+ this . saveContext ( ) ;
301
+ }
302
+
282
303
public async initialize ( ) {
283
304
if ( ArduinoWorkspace . rootPath && util . fileExistsSync ( path . join ( ArduinoWorkspace . rootPath , ARDUINO_CONFIG_FILE ) ) ) {
284
305
vscode . window . showInformationMessage ( "Arduino.json is already generated." ) ;
0 commit comments