@@ -1009,7 +1009,7 @@ void ScriptEditor::_resave_scripts(const String &p_str) {
10091009 Ref<Resource> scr = se->get_edited_resource ();
10101010
10111011 if (scr->is_built_in ()) {
1012- continue ; // internal script, who cares
1012+ continue ; // Internal script, who cares.
10131013 }
10141014
10151015 if (trim_trailing_whitespace_on_save) {
@@ -1089,10 +1089,9 @@ void ScriptEditor::_mark_built_in_scripts_as_saved(const String &p_parent_path)
10891089 Ref<Script> scr = edited_res;
10901090 if (scr.is_valid ()) {
10911091 trigger_live_script_reload (scr->get_path ());
1092-
1093- if (scr->is_tool ()) {
1094- scr->reload (true );
1095- }
1092+ clear_docs_from_script (scr);
1093+ scr->reload (true );
1094+ update_docs_from_script (scr);
10961095 }
10971096 }
10981097}
@@ -1143,7 +1142,7 @@ bool ScriptEditor::_test_script_times_on_disk(Ref<Resource> p_for_script) {
11431142 }
11441143
11451144 if (edited_res->is_built_in ()) {
1146- continue ; // internal script, who cares
1145+ continue ; // Internal script, who cares.
11471146 }
11481147
11491148 uint64_t last_date = se->edited_file_data .last_modified_time ;
@@ -2722,31 +2721,32 @@ void ScriptEditor::save_all_scripts() {
27222721 se->apply_code ();
27232722 }
27242723
2724+ Ref<Script> scr = edited_res;
2725+
2726+ if (scr.is_valid ()) {
2727+ clear_docs_from_script (scr);
2728+ }
2729+
27252730 if (!edited_res->is_built_in ()) {
27262731 Ref<TextFile> text_file = edited_res;
2727- Ref<Script> scr = edited_res;
2728-
27292732 if (text_file.is_valid ()) {
27302733 _save_text_file (text_file, text_file->get_path ());
27312734 continue ;
27322735 }
27332736
2734- if (scr.is_valid ()) {
2735- clear_docs_from_script (scr);
2736- }
2737-
2738- EditorNode::get_singleton ()->save_resource (edited_res); // external script, save it
2739-
2740- if (scr.is_valid ()) {
2741- update_docs_from_script (scr);
2742- }
2737+ // External script, save it.
2738+ EditorNode::get_singleton ()->save_resource (edited_res);
27432739 } else {
27442740 // For built-in scripts, save their scenes instead.
27452741 const String scene_path = edited_res->get_path ().get_slice (" ::" , 0 );
27462742 if (!scene_path.is_empty () && !scenes_to_save.has (scene_path)) {
27472743 scenes_to_save.insert (scene_path);
27482744 }
27492745 }
2746+
2747+ if (scr.is_valid ()) {
2748+ update_docs_from_script (scr);
2749+ }
27502750 }
27512751
27522752 if (!scenes_to_save.is_empty ()) {
0 commit comments