You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Improve output in Debugger Errors tab for scripts
This commit is contained in:
@@ -487,8 +487,11 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
|
|||||||
error->set_text_align(0, TreeItem::ALIGN_LEFT);
|
error->set_text_align(0, TreeItem::ALIGN_LEFT);
|
||||||
|
|
||||||
String error_title;
|
String error_title;
|
||||||
// Include method name, when given, in error title.
|
if (oe.callstack.size() > 0) {
|
||||||
if (!oe.source_func.empty()) {
|
// If available, use the script's stack in the error title.
|
||||||
|
error_title = oe.callstack[oe.callstack.size() - 1].func + ": ";
|
||||||
|
} else if (!oe.source_func.empty()) {
|
||||||
|
// Otherwise try to use the C++ source function.
|
||||||
error_title += oe.source_func + ": ";
|
error_title += oe.source_func + ": ";
|
||||||
}
|
}
|
||||||
// If we have a (custom) error message, use it as title, and add a C++ Error
|
// If we have a (custom) error message, use it as title, and add a C++ Error
|
||||||
@@ -529,9 +532,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
|
|||||||
cpp_source->set_metadata(0, source_meta);
|
cpp_source->set_metadata(0, source_meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
error->set_tooltip(0, tooltip);
|
|
||||||
error->set_tooltip(1, tooltip);
|
|
||||||
|
|
||||||
// Format stack trace.
|
// Format stack trace.
|
||||||
// stack_items_count is the number of elements to parse, with 3 items per frame
|
// stack_items_count is the number of elements to parse, with 3 items per frame
|
||||||
// of the stack trace (script, method, line).
|
// of the stack trace (script, method, line).
|
||||||
@@ -548,10 +548,17 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
|
|||||||
stack_trace->set_text(0, "<" + TTR("Stack Trace") + ">");
|
stack_trace->set_text(0, "<" + TTR("Stack Trace") + ">");
|
||||||
stack_trace->set_text_align(0, TreeItem::ALIGN_LEFT);
|
stack_trace->set_text_align(0, TreeItem::ALIGN_LEFT);
|
||||||
error->set_metadata(0, meta);
|
error->set_metadata(0, meta);
|
||||||
|
tooltip += TTR("Stack Trace:") + "\n";
|
||||||
}
|
}
|
||||||
stack_trace->set_text(1, infos[i].file.get_file() + ":" + itos(infos[i].line) + " @ " + infos[i].func + "()");
|
|
||||||
|
String frame_txt = infos[i].file.get_file() + ":" + itos(infos[i].line) + " @ " + infos[i].func + "()";
|
||||||
|
tooltip += frame_txt + "\n";
|
||||||
|
stack_trace->set_text(1, frame_txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error->set_tooltip(0, tooltip);
|
||||||
|
error->set_tooltip(1, tooltip);
|
||||||
|
|
||||||
if (oe.warning) {
|
if (oe.warning) {
|
||||||
warning_count++;
|
warning_count++;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user