visual-studio-code

Visual Studio Code: Auto-refresh file changes


Working with Visual Studio Code I have noticed if a file you are working on changes, whenever that file gets focused in a code panel - it will be reloaded from the disk (if you don't have changes in the file through VSCode).

However, if you are on that file, there is no alert or warning about these, external file changes.

I've been reviewing the settings and I cannot find any option like:

Detect when file is changed outside the VSCode

So my question: Is there any hidden setting or some hack to make that warning happen.

Update

Solved in version 0.3.0 of Visual Studio Code.

  1. The editor with the file will be updated from disk if there are no changes through the editor. (very useful to read log files during a process execution)
  2. If there are changes made on both sides (from disk and through the editor) whenever you try to save the file using VSCode, the editor will warn you about that situation (i.e. "dirty writes") and a file comparison will allow you to decide what to do.

Solution

  • VSCode will never refresh the file if you have changes in that file that are not saved to disk. However, if the file is open and does not have changes, it will replace with the changes on disk, that is true.

    There is currently no way to disable this behaviour.