Skip to content

Commit 54b4cda

Browse files
authored
update CC when keybindings change, fixes #150897 (#151713)
1 parent 2be9947 commit 54b4cda

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/vs/workbench/browser/parts/titlebar/commandCenterControl.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,21 @@ export class CommandCenterControl {
147147
};
148148
menuUpdater();
149149
this._disposables.add(menu.onDidChange(menuUpdater));
150+
this._disposables.add(keybindingService.onDidUpdateKeybindings(e => {
151+
if (!e.keybindings?.length) {
152+
// when resetting a keybinding it isn't properly reported and we are better safe
153+
// than sorry. See https://github.com/microsoft/vscode/issues/151712
154+
menuUpdater();
155+
return;
156+
}
157+
const commands = new Set(e.keybindings.map(kb => kb.command));
158+
for (let i = 0, len = titleToolbar.getItemsLength(); i < len; i++) {
159+
if (commands.has(titleToolbar.getItemAction(i).id)) {
160+
menuUpdater();
161+
break;
162+
}
163+
}
164+
}));
150165
this._disposables.add(quickInputService.onShow(this._setVisibility.bind(this, false)));
151166
this._disposables.add(quickInputService.onHide(this._setVisibility.bind(this, true)));
152167
}

0 commit comments

Comments
 (0)