Skip to content

Commit

Permalink
deprate registerWorkbenchAction more but make it leak less (#159668)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken authored Aug 31, 2022
1 parent 70c7237 commit 2ccc23b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/vs/platform/actions/common/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,9 @@ export class MenuItemAction implements IAction {
}
}

/**
* @deprecated Use {@link registerAction2} instead.
*/
export class SyncActionDescriptor {

private readonly _descriptor: SyncDescriptor0<Action>;
Expand Down
10 changes: 3 additions & 7 deletions src/vs/workbench/common/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Registry.add(Extensions.WorkbenchActions, new class implements IWorkbenchActionR
// keybinding
const weight = (typeof descriptor.keybindingWeight === 'undefined' ? KeybindingWeight.WorkbenchContrib : descriptor.keybindingWeight);
const keybindings = descriptor.keybindings;
KeybindingsRegistry.registerKeybindingRule({
registrations.add(KeybindingsRegistry.registerKeybindingRule({
id: descriptor.id,
weight: weight,
when:
Expand All @@ -56,7 +56,7 @@ Registry.add(Extensions.WorkbenchActions, new class implements IWorkbenchActionR
win: keybindings?.win,
mac: keybindings?.mac,
linux: keybindings?.linux
});
}));

// menu item
// TODO@Rob slightly weird if-check required because of
Expand All @@ -76,14 +76,10 @@ Registry.add(Extensions.WorkbenchActions, new class implements IWorkbenchActionR
category: category ? { value: category, original: categoryOriginal } : undefined
};

MenuRegistry.addCommand(command);
registrations.add(MenuRegistry.addCommand(command));

registrations.add(MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command, when }));
}

// TODO@alex,joh
// support removal of keybinding rule
// support removal of command-ui
return registrations;
}

Expand Down

0 comments on commit 2ccc23b

Please sign in to comment.