Fix #129581
This commit is contained in:
parent
a491a1e07f
commit
302af5ff63
|
@ -1201,17 +1201,17 @@ export class ObjectSettingDropdownWidget extends AbstractListSettingWidget<IObje
|
|||
|
||||
private renderEnumEditWidget(
|
||||
keyOrValue: IObjectEnumData,
|
||||
{ isKey, originalItem, update }: IObjectRenderEditWidgetOptions,
|
||||
{ isKey, changedItem, update }: IObjectRenderEditWidgetOptions,
|
||||
) {
|
||||
const selectBox = this.createBasicSelectBox(keyOrValue);
|
||||
|
||||
const originalKeyOrValue = isKey ? originalItem.key : originalItem.value;
|
||||
const changedKeyOrValue = isKey ? changedItem.key : changedItem.value;
|
||||
this.listDisposables.add(
|
||||
selectBox.onDidSelect(({ selected }) =>
|
||||
update(
|
||||
originalKeyOrValue.type === 'boolean'
|
||||
? { ...originalKeyOrValue, data: selected === 'true' ? true : false }
|
||||
: { ...originalKeyOrValue, data: selected },
|
||||
changedKeyOrValue.type === 'boolean'
|
||||
? { ...changedKeyOrValue, data: selected === 'true' ? true : false }
|
||||
: { ...changedKeyOrValue, data: selected },
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -1227,10 +1227,13 @@ export class ObjectSettingDropdownWidget extends AbstractListSettingWidget<IObje
|
|||
const selected = keyOrValue.options.findIndex(option => keyOrValue.data === option.value);
|
||||
if (selected === -1 && keyOrValue.options.length) {
|
||||
update(
|
||||
originalKeyOrValue.type === 'boolean'
|
||||
? { ...originalKeyOrValue, data: true }
|
||||
: { ...originalKeyOrValue, data: keyOrValue.options[0].value }
|
||||
changedKeyOrValue.type === 'boolean'
|
||||
? { ...changedKeyOrValue, data: true }
|
||||
: { ...changedKeyOrValue, data: keyOrValue.options[0].value }
|
||||
);
|
||||
} else if (changedKeyOrValue.type === 'boolean') {
|
||||
// https://github.com/microsoft/vscode/issues/129581
|
||||
update({ ...changedKeyOrValue, data: keyOrValue.data === 'true' });
|
||||
}
|
||||
|
||||
return { widget: selectBox, element: wrapper };
|
||||
|
|
Loading…
Reference in a new issue