-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[keybindings] Aligned keybindings with VSCode #5326
Conversation
@marechal-p @akosyakov Do you guys mind reviewing when you get a chance as well since you were both involved in the convo on spectrum about this 😄 |
@JPinkney please reference fixed issue in the commit message |
packages/plugin-ext/src/main/browser/keybindings/keybindings-contribution-handler.ts
Show resolved
Hide resolved
this.keymaps[scope].push(binding); | ||
this.keybindingsChanged.fire(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a bit on sure about it, on each fire menus and keybinding widget gets rerendered, it would be better to fire once for the whole keymap and fire once after all keybindings contributions are loaded (don't fire before at all)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marechal-p @kittaakos could you help to check whether it would affect electron perf startup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some testing:
- for initial load everything is good, since no menus is rendered before all initial keybindins are loaded
- for consequent keybindings though for each binding registration top-level menus are rerendered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested registration of duplicate and usage of duplicate keybindings + reverting them. Generally it works good, except excessive events on each change. Depending on what clients are doing it can be not so harmful, e.g. rerendering browser menus is cheap, but not sure about an electron or updating the keybinding widget with some search.
I'm merging it if noone objets by the evening. If there are perf issues with electron we resolve them as follow-ups. |
I am giving it a try now... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase from the master
first.
I could not verify the performance as it is still using the old code which had the menu issues. Please rebase from the |
@JPinkney, please ping me if you have updated the PR and I try it again as soon as I can. |
a249873
to
5ce046e
Compare
@kittaakos I've rebased on master! |
Thank you, @JPinkney. I have verified the performance only, 👍 I did not check the code. |
@JPinkney please rebase and let's merge it |
I'm rebasing and merging it. |
Originally #5621 (comment) It seems to work correctly, but the Example:
[
{
"command": "core.close.tab",
"keybinding": "alt+a",
"context": ""
},
{
"command": "-core.close.tab",
"keybinding": "alt+w",
"context": ""
}
]
[
{
"command": "-core.close.tab",
"keybinding": "alt+w",
"context": ""
}
] This means that I will no longer be able to use the keybinding alt+w for |
@vince-fugnitto please take care of reviewing it after @JPinkney addresses the issue |
Sure! :) |
9d50407
to
2b74fd1
Compare
@vince-fugnitto I've fixed the issue with the reset! |
Great! I'll try it out :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the keybindings-widget
revert functionality, it all works correctly now thank you!
@akosyakov the comment I had about the revert has been addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reviewed code. It looks good except one place can be simplified.
Signed-off-by: Josh Pinkney <joshpinkney@gmail.com>
@akosyakov I don't think @tsmaeder has nominated me but I've fixed up your comment and it should be ready for merge |
This PR changes keybindings to align themselves with how VSCode keybinding policy works. In VSCode, keybindings always register even if there is a conflict and the one that is last registered (and has the highest priority wins i.e. scoping). For example, if I have a keybinding that opens the terminal and that same keybinding also creates a new file, when I press that keybinding the new file will be created because it was registered last.
It also makes it so that you are able to see all keybindings registered to a command, instead of just one and implements removal rules.
Signed-off-by: Josh Pinkney joshpinkney@gmail.com