Skip to content

Commit 2ccc23b

Browse files
authored
deprate registerWorkbenchAction more but make it leak less (microsoft#159668)
1 parent 70c7237 commit 2ccc23b

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/vs/platform/actions/common/actions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,9 @@ export class MenuItemAction implements IAction {
466466
}
467467
}
468468

469+
/**
470+
* @deprecated Use {@link registerAction2} instead.
471+
*/
469472
export class SyncActionDescriptor {
470473

471474
private readonly _descriptor: SyncDescriptor0<Action>;

src/vs/workbench/common/actions.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Registry.add(Extensions.WorkbenchActions, new class implements IWorkbenchActionR
4444
// keybinding
4545
const weight = (typeof descriptor.keybindingWeight === 'undefined' ? KeybindingWeight.WorkbenchContrib : descriptor.keybindingWeight);
4646
const keybindings = descriptor.keybindings;
47-
KeybindingsRegistry.registerKeybindingRule({
47+
registrations.add(KeybindingsRegistry.registerKeybindingRule({
4848
id: descriptor.id,
4949
weight: weight,
5050
when:
@@ -56,7 +56,7 @@ Registry.add(Extensions.WorkbenchActions, new class implements IWorkbenchActionR
5656
win: keybindings?.win,
5757
mac: keybindings?.mac,
5858
linux: keybindings?.linux
59-
});
59+
}));
6060

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

79-
MenuRegistry.addCommand(command);
79+
registrations.add(MenuRegistry.addCommand(command));
8080

8181
registrations.add(MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command, when }));
8282
}
83-
84-
// TODO@alex,joh
85-
// support removal of keybinding rule
86-
// support removal of command-ui
8783
return registrations;
8884
}
8985

0 commit comments

Comments
 (0)