From 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 13:23:58 +0200 Subject: Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027. --- editor/plugins/script_text_editor.cpp | 119 ---------------------------------- 1 file changed, 119 deletions(-) (limited to 'editor/plugins/script_text_editor.cpp') diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 109d83d838..1f916fb3ba 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -109,7 +109,6 @@ ConnectionInfoDialog::ConnectionInfoDialog() { //////////////////////////////////////////////////////////////////////////////// Vector ScriptTextEditor::get_functions() { - String errortxt; int line = -1, col; TextEdit *te = code_editor->get_text_edit(); @@ -117,11 +116,9 @@ Vector ScriptTextEditor::get_functions() { List fnc; if (script->get_language()->validate(text, line, col, errortxt, script->get_path(), &fnc)) { - //if valid rewrite functions to latest functions.clear(); for (List::Element *E = fnc.front(); E; E = E->next()) { - functions.push_back(E->get()); } } @@ -130,7 +127,6 @@ Vector ScriptTextEditor::get_functions() { } void ScriptTextEditor::apply_code() { - if (script.is_null()) return; script->set_source_code(code_editor->get_text_edit()->get_text()); @@ -184,13 +180,11 @@ void ScriptTextEditor::_update_member_keywords() { ClassDB::get_integer_constant_list(instance_base, &clist); for (List::Element *E = clist.front(); E; E = E->next()) { - code_editor->get_text_edit()->add_member_keyword(E->get(), member_variable_color); } } void ScriptTextEditor::_load_theme_settings() { - TextEdit *text_edit = code_editor->get_text_edit(); text_edit->clear_colors(); @@ -275,7 +269,6 @@ void ScriptTextEditor::_load_theme_settings() { } void ScriptTextEditor::_set_theme_for_script() { - if (!theme_loaded) return; @@ -285,7 +278,6 @@ void ScriptTextEditor::_set_theme_for_script() { script->get_language()->get_reserved_words(&keywords); for (List::Element *E = keywords.front(); E; E = E->next()) { - text_edit->add_keyword_color(E->get(), colors_cache.keyword_color); } @@ -327,7 +319,6 @@ void ScriptTextEditor::_set_theme_for_script() { ClassDB::get_class_list(&types); for (List::Element *E = types.front(); E; E = E->next()) { - String n = E->get(); if (n.begins_with("_")) n = n.substr(1, n.length()); @@ -341,7 +332,6 @@ void ScriptTextEditor::_set_theme_for_script() { ScriptServer::get_global_class_list(&global_classes); for (List::Element *E = global_classes.front(); E; E = E->next()) { - text_edit->add_keyword_color(E->get(), colors_cache.usertype_color); } @@ -364,7 +354,6 @@ void ScriptTextEditor::_set_theme_for_script() { script->get_language()->get_comment_delimiters(&comments); for (List::Element *E = comments.front(); E; E = E->next()) { - String comment = E->get(); String beg = comment.get_slice(" ", 0); String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String(); @@ -376,7 +365,6 @@ void ScriptTextEditor::_set_theme_for_script() { List strings; script->get_language()->get_string_delimiters(&strings); for (List::Element *E = strings.front(); E; E = E->next()) { - String string = E->get(); String beg = string.get_slice(" ", 0); String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String(); @@ -403,7 +391,6 @@ void ScriptTextEditor::_warning_clicked(Variant p_line) { } void ScriptTextEditor::reload_text() { - ERR_FAIL_COND(script.is_null()); TextEdit *te = code_editor->get_text_edit(); @@ -424,7 +411,6 @@ void ScriptTextEditor::reload_text() { } void ScriptTextEditor::_notification(int p_what) { - switch (p_what) { case NOTIFICATION_READY: _load_theme_settings(); @@ -433,7 +419,6 @@ void ScriptTextEditor::_notification(int p_what) { } void ScriptTextEditor::add_callback(const String &p_function, PackedStringArray p_args) { - String code = code_editor->get_text_edit()->get_text(); int pos = script->get_language()->find_function(p_function, code); if (pos == -1) { @@ -455,22 +440,18 @@ bool ScriptTextEditor::show_members_overview() { } void ScriptTextEditor::update_settings() { - code_editor->update_editor_settings(); } bool ScriptTextEditor::is_unsaved() { - return code_editor->get_text_edit()->get_version() != code_editor->get_text_edit()->get_saved_version(); } Variant ScriptTextEditor::get_edit_state() { - return code_editor->get_edit_state(); } void ScriptTextEditor::set_edit_state(const Variant &p_state) { - code_editor->set_edit_state(p_state); Dictionary state = p_state; @@ -483,47 +464,38 @@ void ScriptTextEditor::set_edit_state(const Variant &p_state) { } void ScriptTextEditor::_convert_case(CodeTextEditor::CaseStyle p_case) { - code_editor->convert_case(p_case); } void ScriptTextEditor::trim_trailing_whitespace() { - code_editor->trim_trailing_whitespace(); } void ScriptTextEditor::insert_final_newline() { - code_editor->insert_final_newline(); } void ScriptTextEditor::convert_indent_to_spaces() { - code_editor->convert_indent_to_spaces(); } void ScriptTextEditor::convert_indent_to_tabs() { - code_editor->convert_indent_to_tabs(); } void ScriptTextEditor::tag_saved_version() { - code_editor->get_text_edit()->tag_saved_version(); } void ScriptTextEditor::goto_line(int p_line, bool p_with_error) { - code_editor->goto_line(p_line); } void ScriptTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) { - code_editor->goto_line_selection(p_line, p_begin, p_end); } void ScriptTextEditor::goto_line_centered(int p_line) { - code_editor->goto_line_centered(p_line); } @@ -536,7 +508,6 @@ void ScriptTextEditor::clear_executing_line() { } void ScriptTextEditor::ensure_focus() { - code_editor->get_text_edit()->grab_focus(); } @@ -557,7 +528,6 @@ String ScriptTextEditor::get_name() { } Ref ScriptTextEditor::get_theme_icon() { - if (get_parent_control() && get_parent_control()->has_theme_icon(script->get_class(), "EditorIcons")) { return get_parent_control()->get_theme_icon(script->get_class(), "EditorIcons"); } @@ -566,7 +536,6 @@ Ref ScriptTextEditor::get_theme_icon() { } void ScriptTextEditor::_validate_script() { - String errortxt; int line = -1, col; TextEdit *te = code_editor->get_text_edit(); @@ -592,7 +561,6 @@ void ScriptTextEditor::_validate_script() { functions.clear(); for (List::Element *E = fnc.front(); E; E = E->next()) { - functions.push_back(E->get()); } script_is_valid = true; @@ -682,7 +650,6 @@ void ScriptTextEditor::_validate_script() { } void ScriptTextEditor::_update_bookmark_list() { - bookmarks_menu->clear(); bookmarks_menu->set_size(Size2(1, 1)); @@ -714,7 +681,6 @@ void ScriptTextEditor::_update_bookmark_list() { } void ScriptTextEditor::_bookmark_item_pressed(int p_idx) { - if (p_idx < 4) { // Any item before the separator. _edit_option(bookmarks_menu->get_item_id(p_idx)); } else { @@ -724,7 +690,6 @@ void ScriptTextEditor::_bookmark_item_pressed(int p_idx) { } static Vector _find_all_node_for_script(Node *p_base, Node *p_current, const Ref