Open current editing file in explorer tree

I'm wondering if there is a shortcut for VS Code that highlights in solution explorer tree current opened file. Like we have in Visual Studio:

Alt + Shift + L

Couldn't live with no complete answer, so figured out the following:

Without a direct keyboard shortcut:

  1. Open the command palette via Cmd-Shift-P (or Cmd+P then >) and type Files: Reveal Active File in Side Bar.
  2. This reveals the active file in the side bar similar to Visual Studio's Alt+Shift+L

Then, take the above and map a keyboard shortcut to it:

  1. Open keyboard shortcut preferences file via Cmd-Shift-P followed by Preferences: Open Keyboard Preferences File.
  2. Add in the following (taking Visual Studio's lead, I've personally mapped it to Alt+Shift+L, but map to what you want).
// Place your key bindings in this file to overwrite the defaults      
[
  {
    "key": "shift+alt+l",
    "command": "workbench.files.action.showActiveFileInExplorer",
  },
]

Note that it's not as good as Visual Studio, Atom, etc. in that you can't then navigate with arrow keys in the tree (arrow keys navigate the active file contents), but I guess I'll eventually figure out how to do that.


I don't think there's a command for that, but there is a shortcut to enable/disable revealing the current file as you open it:

"explorer.autoReveal": true


Try this:

Together with @Rob's correct answer:

"explorer.autoReveal": true

then Ctrl-Shift-E (Show explorer) focuses that file in the explorer and the arrow keys will navigate up/down/left/right like any list. This works even if the explorer is closed prior to the Ctrl-Shift-E.

Ctrl-Shift-E has the added bonus in that it will toggle focus between the highlighted file and its editor as well.

For mac, use Cmd-Shift-E