Merge from vscode 1df23554b2e3d5f1efc6fbc76ee61d3f7f186c6d

This commit is contained in:
ADS Merger
2020-03-12 06:51:03 +00:00
parent a68a6b9e44
commit b5592959c7
56 changed files with 1091 additions and 558 deletions

View File

@@ -378,7 +378,7 @@ export interface IAction2Options extends ICommandAction {
/**
* One or many menu items.
*/
menu?: OneOrN<{ id: MenuId } & Omit<IMenuItem, 'command'> & { command?: Partial<Omit<ICommandAction, 'id'>> }>;
menu?: OneOrN<{ id: MenuId } & Omit<IMenuItem, 'command'>>;
/**
* One keybinding.
@@ -401,7 +401,7 @@ export function registerAction2(ctor: { new(): Action2 }): IDisposable {
const disposables = new DisposableStore();
const action = new ctor();
const { f1, menu: menus, keybinding, description, ...command } = action.desc;
const { f1, menu, keybinding, description, ...command } = action.desc;
// command
disposables.add(CommandsRegistry.registerCommand({
@@ -411,14 +411,12 @@ export function registerAction2(ctor: { new(): Action2 }): IDisposable {
}));
// menu
if (Array.isArray(menus)) {
for (let item of menus) {
const { command: commandOverrides, ...menu } = item;
disposables.add(MenuRegistry.appendMenuItem(item.id, { command: { ...command, ...commandOverrides }, ...menu }));
if (Array.isArray(menu)) {
for (let item of menu) {
disposables.add(MenuRegistry.appendMenuItem(item.id, { command: { ...command }, ...item }));
}
} else if (menus) {
const { command: commandOverrides, ...menu } = menus;
disposables.add(MenuRegistry.appendMenuItem(menu.id, { command: { ...command, ...commandOverrides }, ...menu }));
} else if (menu) {
disposables.add(MenuRegistry.appendMenuItem(menu.id, { command: { ...command }, ...menu }));
}
if (f1) {
disposables.add(MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: command }));