VSCode prevent file Explorer from jumping

Visual Studio-Code

Visual Studio-Code Problem Overview


Is there a way to prevent VSCode from jumping all over the place when closing a tab? It jumps to the location of the selected tab, but this is very disorienting when opening various files to inspect within a lib.

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

This behaviour is controlled by the following setting:

"explorer.autoReveal": false

There is currently no setting for keeping the selected file in the explorer, but this one at least keeps the scroll position fixed and prevents the "jumping".

Update

In current versions, the same setting now keeps the selected file.

Solution 2 - Visual Studio-Code

After you apply "explorer.autoReveal": false, as mentioned above, you can also set up

a shortcut to force show the current file in Explorer:

{ "key": "cmd+e", "command": "workbench.files.action.showActiveFileInExplorer" }

Solution 3 - Visual Studio-Code

As commented in issue 23902 (Option to keep file selected in sidebar without forcing a scroll)

  • 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

But with VSCode 1.46 (May 2020) you now have:

> ## Explorer auto reveal focus without forcing a scroll > > There is a new option focusNoScroll for the explorer.autoReveal setting. > > When using this option, the Explorer will automatically select files when opening them but will not scroll to reveal them in the Explorer view.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJacob ThomasonView Question on Stackoverflow
Solution 1 - Visual Studio-CodekwoodView Answer on Stackoverflow
Solution 2 - Visual Studio-CodeVojtech VitekView Answer on Stackoverflow
Solution 3 - Visual Studio-CodeVonCView Answer on Stackoverflow