Skip to content
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

Add when context: isLastGroup / isFirstGroup / editorGroupIndex / isLeftGroup / isRightGroup / isTopGroup / isBottomGroup #57728

Closed
wants to merge 2 commits into from

Conversation

jaydenwindle
Copy link

This PR addresses #22755 by adding several context keys to support the configuration of keyboard shortcuts based on which editor group is currently active.

Editor Group Context Key Demo

@msftclas
Copy link

msftclas commented Sep 1, 2018

CLA assistant check
All CLA requirements met.

@jaydenwindle
Copy link
Author

jaydenwindle commented Sep 1, 2018

It is worth noting that in the current implementation, the isFirstGroup and isLastGroup context key values do not always correspond to the leftmost and rightmost editor groups visually, but instead to the order in which the groups were opened. For example, when stacking groups vertically or rearranging them horizontally:

Editor Group Context Key Vertical Demo

To be maximally useful to the original use case, it would be best to have the isLastGroup and isFirstGroup context keys set when the leftmost or rightmost editor group is active, or to create separate context keys (e.g. isLeftGroup and isRightGroup) to denote that.

@jaydenwindle
Copy link
Author

Update: I've added an (albeit hacky) implementation for isLeftGroup and isRightGroup context keys, as well as for isBottomGroup and isTopGroup.

Currently it works for the editor group configurations I've tested (see demo attached), but type casting to get access to the IEditorGroupView and then doing raw element getBoundingClientRect calculations seems much less than ideal. I'd love some tips on how to do this in a cleaner way.

Also, I haven't found a good way to write unit tests for these changes since there are some fairly complex editor setups that need to be tested. Any advice on how to proceed there would be amazing.

Demo: https://cl.ly/f0cdf8af9bc7

@bpasero bpasero self-assigned this Sep 1, 2018
@bpasero bpasero modified the milestones: On Deck, September 2018, Backlog Sep 1, 2018
@jaydenwindle jaydenwindle changed the title Add when context: isLastGroup / isFirstGroup / editorGroupIndex Add when context: isLastGroup / isFirstGroup / editorGroupIndex / isLeftGroup / isRightGroup / isTopGroup / isBottomGroup Sep 6, 2018
@bpasero
Copy link
Member

bpasero commented Aug 9, 2019

Thanks for the work but I ended up implementing this a bit different given some new support that I added recently. See 406b1f3

@bpasero bpasero closed this Aug 9, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants