diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index f979fd2a140..bde2e786b10 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1501,7 +1501,15 @@ Variant CodeTextEditor::get_navigation_state() { } void CodeTextEditor::set_error(const String &p_error) { - error->set_text(p_error); + // Trim the error message if it is more than 2 lines long. + if (p_error.count("\n") >= 2) { + Vector splits = p_error.split("\n"); + String trimmed_error = String("\n").join(splits.slice(0, 2)); + error->set_text(trimmed_error + "..."); + } else { + error->set_text(p_error); + } + if (!p_error.is_empty()) { error->set_default_cursor_shape(CURSOR_POINTING_HAND); } else {