<type>documentation</type>
<domain>edit</domain>
<id>auto-reload</id>
<title>Auto-Reloading Changed Files</title>
<date>$Date$</date>
<version>$Revision$</version>
<product>per+</product>

Wing's editor detects when files have been changed outside of the IDE and can reload files
into its editor. This is useful when working with an external editor, or when using code
generation tools that rewrite files.

The default behavior is to automatically reload externally changed files that have not yet
been changed within Wing's source editor, and to prompt to reload files that have also
been changed in the IDE.

You can change these behaviors with the the `Files > Reloading > Reload
when Unchanged <script:show_preferences_gui#prefname="cache.unchanged-reload-policy">`__
and `Files > Reloading > Reload when Changed
<script:show_preferences_gui#prefname="cache.changed-reload-policy">`__ preferences

By default, reloading will close files that disappeared on disk. This is the recommended
behavior when a revision control system is in use, because updates or branch switches that
occur while Wing is running may remove open files. However, this behavior can be
overridden with the `Files > Reloading > Reloading Deleted Disk Files
<script:show_preferences_gui#prefname="guimgr.deleted-disk-file-policy">`__ preference.
Using ``Prompt for Action`` instead reduces the chances of entirely losing a file if the
file is accidentally deleted on disk.

On Windows, Wing uses a signal from the OS to detect changes so notification or reload is
usually instant. On Linux and Unix, Wing polls the disk by default every 5 seconds. This
frequency can be changed with the `Files > Reloading > External Check Freq
<script:show_preferences_gui#prefname="cache.external-check-freq">`__ preference.

Before reloading a file with changed modification time, Wing checks the contents of the
file and avoids reloading it into the editor when its contents remains unchanged. This
check is skipped for files larger than 5MB and it may be disabled entirely with the `Files
> Reloading > Check Hash Before Reloading
<script:show_preferences_gui#prefname="cache.check-hash-before-reload">`__ preference.
This may be needed when working with a slow network disk, where the process of checking
the contents of files slows down Wing more than reloading unchanged files.
