Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to refresh content of opened files in VS Code?

I'm looking for a way to refresh the content of a file opened in editor after it was changed by other tool.

For instance I'm using angular command line which makes changes to files but VS Code doesn't refresh the content after that and I can't see any of that. What's worse when I try to save the file, VS Code by default tries to save the old content upon the newer (asks before of course, but still its not what I'm looking for).

I didn't find any keybindings for refresh the editor's content. Maybe there are any extensions?

Thank you.

like image 410
Jacek Dziurdzikowski Avatar asked Jan 18 '26 17:01

Jacek Dziurdzikowski


2 Answers

It should reload itself automatically, but I had a machine that stopped auto-refreshing. I'd change the file externally (with vim or whatever), and the file I had in the editor wouldn't pop and refresh itself, which it used to do. It turned out to be a git-related extension. I disabled it, and autorefresh returned. If you haven't already, try it with extensions off.

like image 70
Glen Avatar answered Jan 20 '26 06:01

Glen


keybindings.json

  {
    "key": "ctrl+f5",
    "command": "workbench.action.files.revert",
  },

This will reload the focused file from disk.
(Warning: Any unsaved changes on the focused file will be lost.)

like image 37
Lindsay-Needs-Sleep Avatar answered Jan 20 '26 05:01

Lindsay-Needs-Sleep



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!