111

Visual Studio Code (Version 0.10.11, on OSX) does not refresh the files in a folder. Is there any way to force it to refresh. Currently I have to close and reopen the whole program.

1

10 Answers 10

99

EDIT: In the meanwhile a reload button has been added to the file explorer widget.

Use the workbench.action.reloadWindow command. Go to File -> Preferences -> Keyboard Shotcuts and define a shortcut for this command. On my system it's placed on Ctrl+F5. The entry in keybindings.json looks like this:

{
  "key": "ctrl+f5",
  "command": "workbench.action.reloadWindow",
  "when": "editorTextFocus"
}
5
  • 27
    You just need to refresh the file explorer, either click on the circle arrow in the top of the file explorer (see this screenshot) or use a keyboard shortcut (see @jack-click's answer).
    – Dominik
    Mar 7, 2018 at 18:06
  • 14
    Ctrl + P then >Reload Window Jul 6, 2018 at 20:15
  • 1
    It reloads whole window, the question was about reloading only list of files in the explorer.
    – Vedmant
    Aug 14, 2018 at 9:25
  • 1
    I searched settings for "workbench.action.reloadWindow" and it returned 35 settings, none of which seem to be what I wanted. The screenshot really helped! Sep 21, 2018 at 17:03
  • 4
    This closes all the open terminals; all the build, test, test coverage tools. Not a good solution effectivly restarting the app; this should not be the correct answer; This is the correct answer stackoverflow.com/a/48547570/1551184
    – raiz media
    Nov 21, 2018 at 8:37
88

If you hover over the workspace root in the navigator, four icons appear to the right of it. The third of those icons, a circular arrow, is Refresh -- it reloads the file list.

enter image description here

1
  • The hovering behaviour in my version (1.41.1 on mac osx) is a bit odd: 1: You can bring it up by hovering over any of the nodes in the workspace panel. 2: It will also appear without hovering if you select the workspace line itself 3: Hovering won't work at all if the workspace panel is collapsed such that you only see the header Feb 3, 2020 at 16:10
54

You can use the command palette to reload the window:

  1. Open the command palette with View > Command Palette... (or Shift+Cmd+P on OS X)
  2. Type reload window and press enter
3
  • 1
    This closes all the open terminals; all the build, test, test coverage tools. Not a good solution for me
    – raiz media
    Nov 21, 2018 at 8:26
  • 2
    Ctrl+Shift+P on Windows
    – aloisdg
    Sep 11, 2019 at 9:57
  • In my case I'm using Ubuntu and this option works fine without closing the openm terminals (ctrl+shif+P) -> reload Great!
    – Maf
    Mar 8, 2021 at 12:35
33

You shouldn't need to reload the entire window, just the folder list. Reloading the window will kill terminals, lose undo history, etc. You can do this using the refresh button in the explorer (second from the right):

enter image description here

If you find you need to do this a lot you can add a keybinding for it, for example:

{
  "key": "ctrl+f5",
  "command": "workbench.files.action.refreshFilesExplorer"
}
1
  • 2
    Why is this not the accepted answer? It is just the files, not the window!
    – Timo
    Mar 7, 2020 at 21:53
9

Ran across this today with VS Code 1.13.0 and in Keyboard Shortcuts I see

workbench.files.action.refreshFilesExplorer
2

To reload a single file:

  • ⇧⌘P
  • type "Revert File"

On Windows:

  • Ctrl + Shift + P
  • type "Revert File"

Tested in VSCode v1.18.1 on Windows

0
2

If you use the SFTP extension you can do this for refreshing the SFTP:EXPLORER list (tested on Windows with VSC 1.40.2):

File => Preferences => Keyboard Shortcuts => Search for: refresh

Then you have to find "Refresh / sftp.remoteExplorer.refresh" in the result list. Click the entry, then click the plus sign before the entry, then press your desired shortcut and hit "enter". I took "Ctrl + Alt + F5" because this has not been used for other commands already.

0

Right-Click your sln (Will say 0/n solutions) In the bottom row of dialog it will say reload project solutions. If it's not present, then it was just reloaded most likely. Try to run build again.

0

When search.maintainFileSearchCache option is enabled I started to find the files with I'm using Ctrl-P shortcut

enter image description here

-4

"Ctrl + Alt + R" on v 1.27.1 as of 9/11/18

1
  • 2
    Add some description\ Sep 11, 2018 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.