Skip to content

Update menu when reassigning keybindings or installing keybinding extension #14625

Closed

Description

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.

image

Activity

  1. 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
  2. bpasero commented on Oct 28, 2016

    @bpasero
    Contributor

    Yes, that has always been like that but I think we can fix it easily.

  3. added
    feature-request
    on Oct 28, 2016
  4. added
    help wanted
    on Oct 28, 2016
  5. changed the title [-]reassigning keyboard shortcuts does not impact the shortcuts displayed in menu bar[/-] [+]Update menu when reassigning keybindings[/+] on Oct 28, 2016
  6. arthur801031 commented on Nov 13, 2016

    @arthur801031

    Benjamin Pasero (@bpasero) May I work on this? I'm a first time contributor to vscode.

  7. bpasero commented on Nov 13, 2016

    @bpasero
    Contributor

    Sure, feel free.

  8. arthur801031 commented on Nov 14, 2016

    @arthur801031

    Benjamin Pasero (@bpasero) Could you please help me out with these questions? Thank you!

    • 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?
  9. bpasero commented on Nov 14, 2016

    @bpasero
    Contributor

    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.

  10. arthur801031 commented on Nov 14, 2016

    @arthur801031

    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.

  11. bpasero commented on Nov 14, 2016

    @bpasero
    Contributor

    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.

  12. arthur801031 commented on Nov 14, 2016

    @arthur801031

    I've changed 2 keys in keybindings.json and I restarted vscode. When vscode was opened, the menus' shortcut keys have been updated accordingly.
    screen shot 2016-11-14 at 5 02 39 pm
    screen shot 2016-11-14 at 5 02 25 pm

    It seems what mousetraps ran into was that she didn't restart vscode after updating keybindings.json, so the menus were not updated accordingly.

  13. bpasero commented on Nov 14, 2016

    @bpasero
    Contributor

    I-Chun (Arthur) Liu (@arthur801031) yes, this issue is about updating the menu without the need for restart.

  14. arthur801031 commented on Nov 15, 2016

    @arthur801031

    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:
    screen shot 2016-11-15 at 9 31 02 am

    Here is the error output:
    screen shot 2016-11-15 at 9 32 17 am

    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!

  15. changed the title [-]Update menu when reassigning keybindings[/-] [+]Update menu when reassigning keybindings or installing keybinding extension[/+] on Dec 22, 2016
  16. bpasero commented on Dec 22, 2016

    @bpasero
    Contributor

    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)
  17. added
    verification-needed
    on Jan 7, 2017
  18. removed
    verification-needed
    on Jan 8, 2017
  19. added
    verification-needed
    on Jan 9, 2017
  20. removed
    verification-needed
    on Jan 17, 2017
  21. locked and limited conversation to collaborators on Nov 18, 2017
  22. added a commit that references this issue on Sep 6, 2026
    a09d5dd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requesthelp wanted

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions