Developed commands to change focus between preview editor and references within Peek View#85859
Developed commands to change focus between preview editor and references within Peek View#85859jrieken merged 4 commits intomicrosoft:masterfrom GustavoASC:master
Conversation
…ces within Peek View
| id: 'changeFocusFromEmbeddedEditor', | ||
| weight: KeybindingWeight.EditorContrib + 50, | ||
| primary: KeyCode.F2, | ||
| when: PeekContext.inPeekEditor, |
There was a problem hiding this comment.
needs a try but I believe that this isn't needed anymore now that when supports OR
There was a problem hiding this comment.
If KeyCode.F2 is set to primary then 'when' conditions correctly appear on Keyboard Shortcuts screen:
But if I remove line 308 'primary: KeyCode.F2' or change it to KeyCode.Unknown, 'when' conditions do not appear anymore.
Should they appear? Is it a bug? Because if they really shouldn't appear I could simply remove 'when' clause from this new command.
There was a problem hiding this comment.
On the other hand, the when clause is highly associated with the specified KeyBinding. If no KeyBinding is set on 'primary' option, then I think it makes sense to be empty as well...
Maybe I just should set when clause to undefined or something similar.
There was a problem hiding this comment.
yeah, the when-clause only comes to use with a keybinding. I think it's OK to add a keybinding but not one that is in use already
| KeybindingsRegistry.registerCommandAndKeybindingRule({ | ||
| id: 'changeFocusFromEmbeddedEditor', | ||
| weight: KeybindingWeight.EditorContrib + 50, | ||
| primary: KeyCode.F2, |
There was a problem hiding this comment.
👎 for using F2. Given the amount of VS Code users there certainly will be some that want to rename. Leaving unbound or using something like ctrl+left and ctrl+right.
| }); | ||
| } | ||
|
|
||
| async changeFocusBetweenPreviewAndReferences() { |
There was a problem hiding this comment.
Thanks for your feedback! I will make these changes and commit again.
jrieken
left a comment
There was a problem hiding this comment.
lgtm - will merge once master is open for business again
|
@jrieken Hi! The link for this PR is missing on 1.42 release notes 😅 could you add it please? I've also updated my profile with my name (Gustavo Cassel) today. Big thank you! |
|
Sorry, issue had the wrong milestone... I will update |
|
No problem! Thank you 😅 |


This PR fixes part of #23001 because now one can, from within Peek View, change focus between preview editor and references tree with KeyCode.F2.
I said 'part of' because there is still no setting available yet, to select which component will receive focus by default when Peek View is opened (preview editor or references).
I chose KeyCode.F2 to by default fire this command because: