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

Option to keep file selected in sidebar without forcing a scroll #23902

Closed
clounie opened this issue Apr 4, 2017 · 20 comments · Fixed by #96890
Closed

Option to keep file selected in sidebar without forcing a scroll #23902

clounie opened this issue Apr 4, 2017 · 20 comments · Fixed by #96890
Assignees
Labels
feature-request Request for new features or functionality file-explorer Explorer widget issues on-release-notes Issue/pull request mentioned in release notes verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@clounie
Copy link

clounie commented Apr 4, 2017

  • VSCode Version: 1.10.2
  • OS Version: macOS Sierra 10.12.3

This is closely related to #14745.

Summary:

I want the selected file in the sidebar to always be my active tab - but do not want the sidebar to scroll just because the file is currently not visible in the sidebar.

That scrolling is the entire reason I turned off autoReveal in the first place.

Options Not Used + Why:

  1. autoReveal - (see Stop changing selection in explorer when autoReveal = false #14745) automatically scrolling / causing the user to lose their place in the file tree is extremely annoying.
  2. Open Editors Panel - When there are two files close together in the hierarchy, with the same name, it's too easy to accidentally misread the file paths (especially when they're very long) for that to be a satisfactory replacement for the traditional hierarchy.
  3. Keyboard Shortcut - keyboard shortcuts are great, but this should be one of those "don't make me think" things - not a key combo that has to be pressed hundreds of times/day.
@bpasero bpasero added file-explorer Explorer widget issues feature-request Request for new features or functionality workbench labels Apr 5, 2017
@bpasero bpasero removed their assignment Apr 5, 2017
@bpasero
Copy link
Member

bpasero commented Apr 29, 2017

@clounie so what is missing when you set explorer.autoReveal to false?

@clounie
Copy link
Author

clounie commented May 2, 2017

You can't tell what file in the tree is currently focused in the editor, or where it is in the tree.

This is because the file highlighted in the sidebar doesn't change unless you manually click to make it so, when autoReveal is false.

@bpasero
Copy link
Member

bpasero commented May 2, 2017

@clounie ok I understand your request now, you want to select the file but without scrolling (unless needed).

@clounie
Copy link
Author

clounie commented May 8, 2017

Yes - if any scrolling is needed, the user should do it.

@chimit
Copy link

chimit commented Oct 25, 2017

Agree with @clounie. If explorer.autoReveal is set to false, active files are not highlighted in the explorer anymore. Why not?

Auto-revealing is unwanted because of file tree jumping, not because of highlighting active files.

@bpasero bpasero removed the workbench label Nov 16, 2017
@isidorn isidorn added this to the Backlog milestone Nov 17, 2017
@relloyd
Copy link

relloyd commented Feb 22, 2018

+1 one from me on this please.

@vadym-huza
Copy link

+1

@zenoven
Copy link

zenoven commented Jul 17, 2018

+1, I want the file highlighted in explorer but the scroll position not changed

@catc
Copy link

catc commented Aug 2, 2018

+1, it's sometimes hard to figure out which file you have open when they're all named index.tsx

@amannn
Copy link

amannn commented May 21, 2019

I recently switched to VSCode from Atom and I really find this behaviour confusing. autoReveal: false is hardly usable for me if the tree highlights the wrong file, however I'd really like to not have that auto scrolling.

Would be really cool to see this land 👍

@Hao-Wu
Copy link

Hao-Wu commented Aug 14, 2019

+1, really need to improve this behavior. I switched from sublime to vscode, this makes me crazy.
If set autoReveal to true, the jumping inside file explorer is confusing;
If set autoReveal to false, I have to use showActiveFileInExplorer keybinding or right click menu every time when switch between tabs

@andgate
Copy link

andgate commented Sep 12, 2019

+1 The editor should not force a scroll by default. It's very distracting.

@geekox86
Copy link

+1 This is really a needed usability feature.

@martinjankov
Copy link

+1 This is very frustrating. If I have scrolled down in sidebar and then close the tab, it scrolls me back up to the position of the next active tab. Please fix this.

@phuein
Copy link
Contributor

phuein commented May 3, 2020

+1 Been a couple of years for a simple option to prevent a part of an existing feature; should be simple enough to implement?

EDIT: Looks like the operation is happening here:

One option is to add another settings option, such as autoRevealNoScroll, and add it to the existing check:

const autoRevealNoScroll= this.configurationService.getValue<IFilesConfiguration>().explorer.autoRevealNoScroll;

if (!autoRevealNoScroll || this.tree.getRelativeTop(item) === null) {

The relevant tree function seem to be in:

setFocus(indexes: number[], browserEvent?: UIEvent, fromAPI = false): void {

@amachanic
Copy link

amachanic commented May 12, 2020

I see that there's some debate in the PR so I just wanted to add a +1 in support of this fix.

I actually keep unneeded files open sometimes, if I know I'm going to be touching an adjacent file next, just so that I can make sure I don't have to scroll back in the project to where I was.

Thank you @phuein for putting the fix together! A nice potential additional feature would be the ability to do something like right-click a file's tab, and have an option in the context menu to update the left scrollbar's position to that file. Then, on the rare occasion that I do care if the two are in sync, it would be just a couple of clicks away.

Actually the feature above is already there! "Reveal in Side Bar." So never mind. I'll leave the above text here in case it helps anyone else once this PR goes live.

@isidorn isidorn added the verification-needed Verification of issue is requested label May 13, 2020
@isidorn isidorn modified the milestones: Backlog, May 2020 May 13, 2020
@isidorn
Copy link
Contributor

isidorn commented May 13, 2020

Thanks to @phuein this is now supported in VS Code.

To verify:

  1. Make sure that explorer.autoReveal: true | false behave as before
  2. Make sure that explorer.autoReveal: focusNoScroll focuses the active editor but does not scroll the explorer

@amannn
Copy link

amannn commented May 13, 2020

Awesome to see this merged! The new option is called highlightNoScroll though, right?

@isidorn
Copy link
Contributor

isidorn commented May 13, 2020

I renamed it to focusNoScroll via a06c753

@amannn
Copy link

amannn commented May 13, 2020

Ah, got it – thanks! 🙂

@connor4312 connor4312 added the verified Verification succeeded label Jun 2, 2020
@isidorn isidorn added the on-release-notes Issue/pull request mentioned in release notes label Jun 4, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jun 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality file-explorer Explorer widget issues on-release-notes Issue/pull request mentioned in release notes verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.