Skip to content

Commit

Permalink
Enable Auto Reload Scripts on External Change by default in the edito…
Browse files Browse the repository at this point in the history
…r settings

This follows the behavior of most code editors such as VS Code nowadays.

While this behavior can also be obtained when the setting is disabled
(by choosing Discard local changes and reload), it's tedious to have
to go through this dialog every time.

When the setting is enabled, external changes can still be discarded
by using the Undo function after they've been loaded.
  • Loading branch information
Calinou committed Sep 18, 2024
1 parent 84dcdde commit c9a6fa0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion doc/classes/EditorSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,9 @@
If [code]true[/code], tool scripts will be automatically soft-reloaded after they are saved.
</member>
<member name="text_editor/behavior/files/auto_reload_scripts_on_external_change" type="bool" setter="" getter="">
If [code]true[/code], automatically reloads scripts in the editor when they have been modified and saved by external editors.
If [code]true[/code], automatically reloads scripts and text-based shaders in the editor when they have been modified and saved by external editors or tools and the editor regains focus. External changes can be discarded by using the Undo function after they've been loaded in the editor.
If [code]false[/code], a file conflict dialog will always be displayed when the editor regains focus. This dialog allows you to choose whether to keep local changes or discard them.
[b]Note:[/b] Even when this setting is [code]true[/code], a file conflict dialog is still displayed in certain situations. For instance, it will display when the script editor has unsaved changes that the external editor did not account for.
</member>
<member name="text_editor/behavior/files/autosave_interval_secs" type="int" setter="" getter="">
If set to a value greater than [code]0[/code], automatically saves the current script following the specified interval (in seconds). This can be used to prevent data loss if the editor crashes.
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/behavior/files/autosave_interval_secs", 0);
_initial_set("text_editor/behavior/files/restore_scripts_on_load", true);
_initial_set("text_editor/behavior/files/convert_indent_on_save", true);
_initial_set("text_editor/behavior/files/auto_reload_scripts_on_external_change", false);
_initial_set("text_editor/behavior/files/auto_reload_scripts_on_external_change", true);
_initial_set("text_editor/behavior/files/auto_reload_and_parse_scripts_on_save", true);
_initial_set("text_editor/behavior/files/open_dominant_script_on_scene_change", false, true);

Expand Down

0 comments on commit c9a6fa0

Please sign in to comment.