Godot Engine – Multi-platform 2D and 3D game engine
Fix built-in scripts and shaders not saving with auto-format on save enabled
Lukas Hofmann7e64338e3591
diff --git a/editor/script/script_editor_plugin.cpp b/editor/script/script_editor_plugin.cppindex 634fced8bd1..348df2c470e 100644--- a/editor/script/script_editor_plugin.cpp+++ b/editor/script/script_editor_plugin.cpp@@ -1432,8 +1432,6 @@ void DocumentEditorContainer::_resave_scripts(const String &p_str) {continue; // Internal script, who cares.}- _auto_format_text(seb);-Ref<TextFile> text_file = scr;if (text_file.is_valid()) {seb->apply_code();@@ -2845,6 +2843,7 @@ void DocumentEditorContainer::apply_scripts() const {continue;}+ _auto_format_text(seb);if (TextEditorBase *teb = Object::cast_to<TextEditorBase>(seb)) {teb->insert_final_newline();}@@ -2936,7 +2935,7 @@ void DocumentEditorContainer::_reload_scripts(bool p_refresh_only) {disk_changed->hide();}-void DocumentEditorContainer::_auto_format_text(ScriptEditorBase *p_seb) {+void DocumentEditorContainer::_auto_format_text(ScriptEditorBase *p_seb) const {if (TextEditorBase *teb = Object::cast_to<TextEditorBase>(p_seb)) {if (trim_trailing_whitespace_on_save) {teb->trim_trailing_whitespace();diff --git a/editor/script/script_editor_plugin.h b/editor/script/script_editor_plugin.hindex 1e7f1dda3c0..a3bc1c62181 100644--- a/editor/script/script_editor_plugin.h+++ b/editor/script/script_editor_plugin.h@@ -381,7 +381,7 @@ class DocumentEditorContainer : public MarginContainer {void _autosave_scripts();void _update_autosave_timer();void _reload_scripts(bool p_refresh_only = false);- void _auto_format_text(ScriptEditorBase *p_seb);+ void _auto_format_text(ScriptEditorBase *p_seb) const;void _connect_to_scene();void _connect_to_scene_recursive(Node *p_current);