mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-27 05:06:42 +00:00
feat: show the selected board config value on menu
closes #343 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
parent
d3a863911c
commit
af468a73bc
@ -80,16 +80,16 @@ export class BoardsDataMenuUpdater implements FrontendApplicationContribution {
|
|||||||
string,
|
string,
|
||||||
Disposable & { label: string }
|
Disposable & { label: string }
|
||||||
>();
|
>();
|
||||||
|
let selectedValue = '';
|
||||||
for (const value of values) {
|
for (const value of values) {
|
||||||
const id = `${fqbn}-${option}--${value.value}`;
|
const id = `${fqbn}-${option}--${value.value}`;
|
||||||
const command = { id };
|
const command = { id };
|
||||||
const selectedValue = value.value;
|
|
||||||
const handler = {
|
const handler = {
|
||||||
execute: () =>
|
execute: () =>
|
||||||
this.boardsDataStore.selectConfigOption({
|
this.boardsDataStore.selectConfigOption({
|
||||||
fqbn,
|
fqbn,
|
||||||
option,
|
option,
|
||||||
selectedValue,
|
selectedValue: value.value,
|
||||||
}),
|
}),
|
||||||
isToggled: () => value.selected,
|
isToggled: () => value.selected,
|
||||||
};
|
};
|
||||||
@ -100,8 +100,14 @@ export class BoardsDataMenuUpdater implements FrontendApplicationContribution {
|
|||||||
{ label: value.label }
|
{ label: value.label }
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
if (value.selected) {
|
||||||
|
selectedValue = value.label;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.menuRegistry.registerSubmenu(menuPath, label);
|
this.menuRegistry.registerSubmenu(
|
||||||
|
menuPath,
|
||||||
|
`${label}${selectedValue ? `: "${selectedValue}"` : ''}`
|
||||||
|
);
|
||||||
this.toDisposeOnBoardChange.pushAll([
|
this.toDisposeOnBoardChange.pushAll([
|
||||||
...commands.values(),
|
...commands.values(),
|
||||||
Disposable.create(() =>
|
Disposable.create(() =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user