Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 
like image 909
Vnuuk Avatar asked Jan 30 '17 05:01

Vnuuk


People also ask

How do I show the current file in Solution Explorer?

In Visual Studio's menu go to Tools > Options > Projects and Solutions. Then check "Track Active Item in Solution Explorer".

How do I show the open file in Solution Explorer in Visual Studio?

To verify open any file in Visual Studio and press the shortcut keys Shift + Alt + L and you'll see the file in the solution explorer. Enjoy!

How do I run a current file in Visual Studio?

In the simplest case, to build and run an open project in Visual Studio: Press F5, choose Debug > Start with debugging from the Visual Studio menu, or select the green Start arrow and project name on the Visual Studio toolbar.


1 Answers

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.

like image 168
Ted Avatar answered Sep 21 '22 13:09

Ted