| 2771 | } |
| 2772 | |
| 2773 | void ScriptEditor::save_current_script() { |
| 2774 | ScriptEditorBase *current = _get_current_editor(); |
| 2775 | if (!current || _test_script_times_on_disk()) { |
| 2776 | return; |
| 2777 | } |
| 2778 | |
| 2779 | if (trim_trailing_whitespace_on_save) { |
| 2780 | current->trim_trailing_whitespace(); |
| 2781 | } |
| 2782 | |
| 2783 | if (trim_final_newlines_on_save) { |
| 2784 | current->trim_final_newlines(); |
| 2785 | } |
| 2786 | |
| 2787 | if (convert_indent_on_save) { |
| 2788 | current->convert_indent(); |
| 2789 | } |
| 2790 | |
| 2791 | Ref<Resource> resource = current->get_edited_resource(); |
| 2792 | Ref<TextFile> text_file = resource; |
| 2793 | Ref<Script> scr = resource; |
| 2794 | |
| 2795 | if (text_file.is_valid()) { |
| 2796 | current->apply_code(); |
| 2797 | _save_text_file(text_file, text_file->get_path()); |
| 2798 | return; |
| 2799 | } |
| 2800 | |
| 2801 | if (scr.is_valid()) { |
| 2802 | clear_docs_from_script(scr); |
| 2803 | } |
| 2804 | |
| 2805 | EditorNode::get_singleton()->save_resource(resource); |
| 2806 | |
| 2807 | if (scr.is_valid()) { |
| 2808 | update_docs_from_script(scr); |
| 2809 | } |
| 2810 | } |
| 2811 | |
| 2812 | void ScriptEditor::save_all_scripts() { |
| 2813 | HashSet<String> scenes_to_save; |
no test coverage detected