When I have a file opened, I'd like to have a shortcut to navigate to this file inside the EXPLORER
, so that I can see where it is located.
How can I do this?
When I have a file opened, I'd like to have a shortcut to navigate to this file inside the EXPLORER
, so that I can see where it is located.
How can I do this?
In the command palette (F1), there is a Files: Reveal Active File in Side Bar
command. You can assign a shortcut to it via the keyboard shortcuts editor:
Alternatively, you could try the Reveal extension which adds this button to editors:
It might make sense to disable auto-reveal when using this shortcut as a "manual reveal":
// Set this in your settings.json file
"explorer.autoReveal": false
To show the active file in the Windows-Explorer or sidebar:
The keyboard shortcut for reveal in windows explorer is is ctrl K R
To show the file in the sidebar you can assign a custom code in the keybindings window:
Just press Cmd + Shift + E and the explorer will show the file you are viewing.
Wanted to add that the first answer still works, but that the text was slightly changed to "Reveal in Explorer View" from "Reveal file in sidebar"
and
right clicking on the tab
Tested in Visual Studio Code 1.78.0 on Linux Ubuntu 20.04.
No extensions are needed.
Several additional easy ways:
[already mentioned in this answer, where I first learned it]
Right-click the file tab of interest at the top of the window --> "Reveal in Explorer View", as shown here:
The following ways only work if you have either not set a value for "explorer.autoReveal"
(since its default value is true
), or if you have explicitly set it to true
inside your settings.json
file, like this:
// Controls whether the Explorer should automatically reveal and select
// files when opening them.
// - true: Files will be revealed and selected.
// - false: Files will not be revealed and selected.
// - focusNoScroll: Files will not be scrolled into view, but will still be
// focused.
// GS note: default is `true`
"explorer.autoReveal": true,
[not explained in any other answer yet]
Click the "Refresh Explorer" button at the top of the File Explorer view:
[not explained in any other answer yet]
Click any other file tab at the top of the Window (assuming you have multiple files open), then click back to your file of interest.
[not explained in any other answer yet]
Press Ctrl + PageDown to navigate one file tab to the right (assuming you have multiple files open), then press Ctrl + PageUp to navigate back to your original file one tab back to the left.
"explorer.autoReveal"
settings.json setting.