@@ -276,7 +276,7 @@ endfunction
276276
277277function ! arduino#GetBoardOptions (board) abort
278278 if g: arduino_use_cli
279- let ret = {}
279+ let ret = []
280280 let data = s: get_json_output (' arduino-cli board details ' . a: board . ' --format json' )
281281 if ! has_key (data, ' config_options' )
282282 return ret
@@ -290,7 +290,11 @@ function! arduino#GetBoardOptions(board) abort
290290 \ ' value' : entry[' value' ]
291291 \ })
292292 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+ \ })
294298 endfor
295299 return ret
296300 endif
@@ -330,10 +334,18 @@ function! arduino#GetBoardOptions(board) abort
330334 endif
331335 endfor
332336 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
334346 endif
335347 endfor
336- return {}
348+ return []
337349endfunction
338350
339351function ! arduino#GetProgrammers () abort
@@ -448,10 +460,10 @@ endfunction
448460" Prompt user for the next unselected board option
449461function ! arduino#ChooseBoardOption () abort
450462 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' )
455467 return
456468 endif
457469 endfor
0 commit comments