You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update menu when reassigning keybindings or installing keybinding extension #14625
Below, Ctrl+S has been reassigned to workbench.action.relaodWindow, and Ctrl+I has been assigned to workbench.action.files.save, but he File context menu has not been updated appropriately.
changed the title [-]reassinging keyboard shortcuts does not impact the shortcuts displayed in menu bar[/-][+]reassigning keyboard shortcuts does not impact the shortcuts displayed in menu bar[/+]on Oct 27, 2016
changed the title [-]reassigning keyboard shortcuts does not impact the shortcuts displayed in menu bar[/-][+]Update menu when reassigning keybindings[/+]on Oct 28, 2016
I think I need to make changes in vscode/out/vs/base/common/keybinding.js and vscode/out/vs/code/electron-main/menus.js, but I don't know how to debug these files since the code has already been run when vscode is opened.
How do I access user's keybindings.json file for the user's new keys?
That is true. On startup we read the keybindings from a cached location on disk, then we start a window and ask that window to resolve all keybindings. If the keybindings differ, we update the menu once again. Ugly, but the only way possible atm.
Hi Benjamin Pasero (@bpasero), I'm trying to create a listener for keybindings.json, but I can't get the keybindings.json file path right. Here is my code in the registerListeners function of /vscode/out/vs/code/electron-main/menus.js:
Here is the error output:
Another question that I have is if I place these code inside src/vs/code/electron-main/menus.ts that piece of code wouldn't run, which means the error message wouldn't even show up. Please help. Thank you so much!
changed the title [-]Update menu when reassigning keybindings[/-][+]Update menu when reassigning keybindings or installing keybinding extension[/+]on Dec 22, 2016
Also applies to when installing a keymap extension (/cc Christof Marti (@chrmarti)). happy to review a PR on this one, I think what is needed is to:
update the menu when a change to keybindings.json is detected (for example by using ConfigWatcher)
update the menu when a keymap extension gets installed (ideally this could be triggered also from the main side by listening to extension events that happen in the shared process)
Activity
[-]reassinging keyboard shortcuts does not impact the shortcuts displayed in menu bar[/-][+]reassigning keyboard shortcuts does not impact the shortcuts displayed in menu bar[/+]bpasero commentedon Oct 28, 2016
Yes, that has always been like that but I think we can fix it easily.
[-]reassigning keyboard shortcuts does not impact the shortcuts displayed in menu bar[/-][+]Update menu when reassigning keybindings[/+]arthur801031 commentedon Nov 13, 2016
Benjamin Pasero (@bpasero) May I work on this? I'm a first time contributor to vscode.
bpasero commentedon Nov 13, 2016
Sure, feel free.
arthur801031 commentedon Nov 14, 2016
Benjamin Pasero (@bpasero) Could you please help me out with these questions? Thank you!
bpasero commentedon Nov 14, 2016
Let me forward the debug questions to our debug team: roblourens Andre Weinand (@weinand) Isidor Nikolic (@isidorn) are we able to debug the Electron main side these days?
I-Chun (Arthur) Liu (@arthur801031) I suggest to check how keybindings are resolved today right on startup (https://github.com/Microsoft/vscode/blob/master/src/vs/code/electron-main/menus.ts#L180) and then add a listener for keybindings.json changes to run a similar call to update the menu.
arthur801031 commentedon Nov 14, 2016
Benjamin Pasero (@bpasero)
It seems that Electron does not support updating menus dynamically: https://github.com/Microsoft/vscode/blob/master/src/vs/code/electron-main/menus.ts#L197
If the user quits and restarts vscode, the menus are updated according to keybindings.json. As long as the user restarts vscode, the menus should show the correct keybindings.
bpasero commentedon Nov 14, 2016
That is true. On startup we read the keybindings from a cached location on disk, then we start a window and ask that window to resolve all keybindings. If the keybindings differ, we update the menu once again. Ugly, but the only way possible atm.
arthur801031 commentedon Nov 14, 2016
I've changed 2 keys in keybindings.json and I restarted vscode. When vscode was opened, the menus' shortcut keys have been updated accordingly.


It seems what mousetraps ran into was that she didn't restart vscode after updating keybindings.json, so the menus were not updated accordingly.
bpasero commentedon Nov 14, 2016
I-Chun (Arthur) Liu (@arthur801031) yes, this issue is about updating the menu without the need for restart.
arthur801031 commentedon Nov 15, 2016
Hi Benjamin Pasero (@bpasero), I'm trying to create a listener for keybindings.json, but I can't get the keybindings.json file path right. Here is my code in the registerListeners function of /vscode/out/vs/code/electron-main/menus.js:

Here is the error output:

Another question that I have is if I place these code inside src/vs/code/electron-main/menus.ts that piece of code wouldn't run, which means the error message wouldn't even show up. Please help. Thank you so much!
[-]Update menu when reassigning keybindings[/-][+]Update menu when reassigning keybindings or installing keybinding extension[/+]bpasero commentedon Dec 22, 2016
Also applies to when installing a keymap extension (/cc Christof Marti (@chrmarti)). happy to review a PR on this one, I think what is needed is to:
keybindings.jsonis detected (for example by usingConfigWatcher)Update menu when reassigning keybindings or installing keybinding ext…