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

Adds basic keybinding for focusing on an element in outline pane #91799

Merged
merged 9 commits into from
Jun 12, 2020

Conversation

lambainsaan
Copy link
Contributor

This PR fixes #90732.

You can test out the change with the new key binding added under the name list.focus for the same feature.

@msftclas
Copy link

msftclas commented Feb 29, 2020

CLA assistant check
All CLA requirements met.

@jrieken jrieken requested a review from bpasero March 2, 2020 09:57
@jrieken jrieken removed their assignment Mar 2, 2020
@jrieken
Copy link
Member

jrieken commented Mar 2, 2020

Outline changes look legit - to @bpasero for changes on the list commands

Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very hard to understand until you realize that you added a list.focus command that is pretty much a copy of list.select with just a few modifications. Can you extract all the code of both commands into 1 reusable method and make the things that are actually different adjustable from the outside?

I also see that you changed from:

const fakeKeyboardEvent = getSelectionKeyboardEvent('keydown', false);

to

const fakeKeyboardEvent = getSelectionKeyboardEvent('keydown', true);

for the existing list.select. What is the reasoning?

@bpasero bpasero added this to the Backlog milestone Mar 2, 2020
@lambainsaan
Copy link
Contributor Author

This is very hard to understand until you realize that you added a list.focus command that is pretty much a copy of list.select with just a few modifications. Can you extract all the code of both commands into 1 reusable method and make the things that are actually different adjustable from the outside?

Agreed, I was thinking on the same lines, but I refrained from doing it. I will update the PR.

I also see that you changed from:

const fakeKeyboardEvent = getSelectionKeyboardEvent('keydown', false);

to

const fakeKeyboardEvent = getSelectionKeyboardEvent('keydown', true);

for the existing list.select. What is the reasoning?

Oh yes, looking back at it, it does not make sense to me. It should not have changed. I will switch to the older version for this, and flip the usage.

@bpasero bpasero marked this pull request as draft April 24, 2020 06:15
@lambainsaan lambainsaan marked this pull request as ready for review June 5, 2020 20:27
@lambainsaan
Copy link
Contributor Author

Left it hanging for quite sometime, @bpasero could you please take a look at it again? :)

@bpasero bpasero modified the milestones: Backlog, June 2020 Jun 6, 2020
src/vs/workbench/browser/actions/listCommands.ts Outdated Show resolved Hide resolved
src/vs/workbench/browser/actions/listCommands.ts Outdated Show resolved Hide resolved
@bpasero bpasero requested a review from joaomoreno June 9, 2020 16:18
@bpasero
Copy link
Member

bpasero commented Jun 9, 2020

Also adding @joaomoreno to comment on the fact that we are about to introduce a new list/tree command list.focus that only differs from list.select in that it will retain focus.

I wonder if the name should actually be list.selectKeepFocus or so, because I think no-one really understands the difference between focus and select?

@joaomoreno
Copy link
Member

As you move up/down in the outline (and any tree/list) you're moving the focus. If you press Enter, you're selecting the focused element. When things get selected, editors open. Also, it just so happens that we've made a decision to always move DOM focus away from the list/tree and into the editor when this happens. So, we need to add a new keybinding which does the same but preserves the DOM focus.

Calling it list.focus is indeed a bad name. I would call it list.selectAndPreserveFocus to match list.select.


@bpasero The concept exists everywhere. Here's windows:

image

All those folders are selected, but only recipes is focused.

@bpasero
Copy link
Member

bpasero commented Jun 10, 2020

Yeah, I like list.selectAndPreserveFocus. @lambainsaan can you make these changes?

@lambainsaan
Copy link
Contributor Author

Sure thing, @bpasero , I have made the changes.

@lambainsaan lambainsaan requested a review from bpasero June 11, 2020 19:37
@bpasero bpasero merged commit 2e2bdd5 into microsoft:master Jun 12, 2020
@bpasero
Copy link
Member

bpasero commented Jun 12, 2020

Thanks!

@github-actions github-actions bot locked and limited conversation to collaborators Jul 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.

Outline view is missing the keyboard command to just move the editor to the current a symbol
5 participants