src/vs/platform/actions/common/menuService.ts/createMenuHide
function createMenuHide(menu: MenuId, command: ICommandAction | ISubmenuItem, states: PersistedMenuHideState): IMenuItemHide {

	const id = isISubmenuItem(command) ? command.submenu.id : command.id;
	const title = typeof command.title === 'string' ? command.title : command.title.value;

	const hide = toAction({
		id: `hide/${menu.id}/${id}`,
		label: localize('hide.label', 'Hide \'{0}\'', title),
		run() { states.updateHidden(menu, id, true); }
	});

	const toggle = toAction({
		id: `toggle/${menu.id}/${id}`,
		label: title,
		get checked() { return !states.isHidden(menu, id); },
		run() {
			const newValue = !states.isHidden(menu, id);
			states.updateHidden(menu, id, newValue);
		}
	});

	return {
		hide,
		toggle,
		get isHidden() { return !toggle.checked; },
	};
}