@@ -276,7 +276,7 @@ endfunction
276
276
277
277
function ! arduino#GetBoardOptions (board) abort
278
278
if g: arduino_use_cli
279
- let ret = {}
279
+ let ret = []
280
280
let data = s: get_json_output (' arduino-cli board details ' . a: board . ' --format json' )
281
281
if ! has_key (data, ' config_options' )
282
282
return ret
@@ -290,7 +290,11 @@ function! arduino#GetBoardOptions(board) abort
290
290
\ ' value' : entry[' value' ]
291
291
\ })
292
292
endfor
293
- let ret [opt [' option' ]] = values
293
+ call add (ret , {
294
+ \ ' option' : opt [' option' ],
295
+ \ ' option_label' : opt [' option_label' ],
296
+ \ ' values' : values
297
+ \ })
294
298
endfor
295
299
return ret
296
300
endif
@@ -330,10 +334,18 @@ function! arduino#GetBoardOptions(board) abort
330
334
endif
331
335
endfor
332
336
if matched
333
- return options
337
+ let ret = []
338
+ for value in keys (options )
339
+ call add (ret , {
340
+ \ ' option' : value,
341
+ \ ' option_label' : value,
342
+ \ ' values' : options [value]
343
+ \ })
344
+ endfor
345
+ return ret
334
346
endif
335
347
endfor
336
- return {}
348
+ return []
337
349
endfunction
338
350
339
351
function ! arduino#GetProgrammers () abort
@@ -448,10 +460,10 @@ endfunction
448
460
" Prompt user for the next unselected board option
449
461
function ! arduino#ChooseBoardOption () abort
450
462
let available_opts = s: callback_data .available_opts
451
- for opt in keys ( available_opts)
452
- if ! has_key (s: callback_data .opts, opt )
453
- let s: callback_data .active_option = opt
454
- call arduino#Choose (opt , available_opts[ opt ] , ' arduino#SelectOption' )
463
+ for opt in available_opts
464
+ if ! has_key (s: callback_data .opts, opt . option )
465
+ let s: callback_data .active_option = opt . option
466
+ call arduino#Choose (opt .option_label, opt . values , ' arduino#SelectOption' )
455
467
return
456
468
endif
457
469
endfor
0 commit comments