in src/report.ts [829:851]
async removeOptionsMenuCommand(commandName: string, optionsMenuTitle: string): Promise<IHttpPostMessageResponse<void>> {
if (isRDLEmbed(this.config.embedUrl)) {
return Promise.reject(APINotSupportedForRDLError);
}
const commandCopy = JSON.parse(JSON.stringify(this.commands)) as ICommandExtension[];
const indexOfCommand: number = this.findCommandMenuIndex("visualOptionsMenu", commandCopy, commandName, optionsMenuTitle);
if (indexOfCommand === -1) {
throw CommonErrorCodes.NotFound;
}
// Delete the context options and not the entire command, since command can have context menu as well.
delete commandCopy[indexOfCommand].extend.visualOptionsMenu;
delete commandCopy[indexOfCommand].icon;
const newSetting: ISettings = {
extensions: {
commands: commandCopy,
groups: this.groups
}
};
return await this.updateSettings(newSetting);
}