You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Fix documentation tooltip over debug tooltip
This commit is contained in:
@@ -497,19 +497,6 @@ ScriptEditor *ScriptEditor::script_editor = nullptr;
|
|||||||
|
|
||||||
/*** SCRIPT EDITOR ******/
|
/*** SCRIPT EDITOR ******/
|
||||||
|
|
||||||
String ScriptEditor::_get_debug_tooltip(const String &p_text, Node *_se) {
|
|
||||||
String val = EditorDebuggerNode::get_singleton()->get_var_value(p_text);
|
|
||||||
const int display_limit = 300;
|
|
||||||
if (!val.is_empty()) {
|
|
||||||
if (val.size() > display_limit) {
|
|
||||||
val = val.left(display_limit) + " [...] truncated!";
|
|
||||||
}
|
|
||||||
return p_text + ": " + val;
|
|
||||||
} else {
|
|
||||||
return String();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScriptEditor::_breaked(bool p_breaked, bool p_can_debug) {
|
void ScriptEditor::_breaked(bool p_breaked, bool p_can_debug) {
|
||||||
if (external_editor_active) {
|
if (external_editor_active) {
|
||||||
return;
|
return;
|
||||||
@@ -2633,7 +2620,6 @@ bool ScriptEditor::edit(const Ref<Resource> &p_resource, int p_line, int p_col,
|
|||||||
// If we delete a script within the filesystem, the original resource path
|
// If we delete a script within the filesystem, the original resource path
|
||||||
// is lost, so keep it as metadata to figure out the exact tab to delete.
|
// is lost, so keep it as metadata to figure out the exact tab to delete.
|
||||||
se->set_meta("_edit_res_path", p_resource->get_path());
|
se->set_meta("_edit_res_path", p_resource->get_path());
|
||||||
se->set_tooltip_request_func(callable_mp(this, &ScriptEditor::_get_debug_tooltip));
|
|
||||||
if (se->get_edit_menu()) {
|
if (se->get_edit_menu()) {
|
||||||
se->get_edit_menu()->hide();
|
se->get_edit_menu()->hide();
|
||||||
menu_hb->add_child(se->get_edit_menu());
|
menu_hb->add_child(se->get_edit_menu());
|
||||||
|
|||||||
@@ -378,8 +378,6 @@ class ScriptEditor : public PanelContainer {
|
|||||||
|
|
||||||
bool restoring_layout;
|
bool restoring_layout;
|
||||||
|
|
||||||
String _get_debug_tooltip(const String &p_text, Node *_se);
|
|
||||||
|
|
||||||
void _resave_scripts(const String &p_str);
|
void _resave_scripts(const String &p_str);
|
||||||
|
|
||||||
bool _test_script_times_on_disk(Ref<Resource> p_for_script = Ref<Resource>());
|
bool _test_script_times_on_disk(Ref<Resource> p_for_script = Ref<Resource>());
|
||||||
|
|||||||
@@ -1107,13 +1107,10 @@ void ScriptTextEditor::_show_symbol_tooltip(const String &p_symbol, int p_row, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
ScriptLanguage::LookupResult result;
|
ScriptLanguage::LookupResult result;
|
||||||
|
String doc_symbol;
|
||||||
const String code_text = code_editor->get_text_editor()->get_text_with_cursor_char(p_row, p_column);
|
const String code_text = code_editor->get_text_editor()->get_text_with_cursor_char(p_row, p_column);
|
||||||
const Error lc_error = script->get_language()->lookup_code(code_text, p_symbol, script->get_path(), base, result);
|
const Error lc_error = script->get_language()->lookup_code(code_text, p_symbol, script->get_path(), base, result);
|
||||||
if (lc_error != OK) {
|
if (lc_error == OK) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String doc_symbol;
|
|
||||||
switch (result.type) {
|
switch (result.type) {
|
||||||
case ScriptLanguage::LOOKUP_RESULT_CLASS: {
|
case ScriptLanguage::LOOKUP_RESULT_CLASS: {
|
||||||
doc_symbol = "class|" + result.class_name + "|";
|
doc_symbol = "class|" + result.class_name + "|";
|
||||||
@@ -1197,9 +1194,25 @@ void ScriptTextEditor::_show_symbol_tooltip(const String &p_symbol, int p_row, i
|
|||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!doc_symbol.is_empty()) {
|
String debug_value = EditorDebuggerNode::get_singleton()->get_var_value(p_symbol);
|
||||||
EditorHelpBitTooltip::show_tooltip(code_editor->get_text_editor(), doc_symbol, String(), true);
|
if (!debug_value.is_empty()) {
|
||||||
|
constexpr int DISPLAY_LIMIT = 1024;
|
||||||
|
if (debug_value.size() > DISPLAY_LIMIT) {
|
||||||
|
debug_value = debug_value.left(DISPLAY_LIMIT) + "... " + TTR("(truncated)");
|
||||||
|
}
|
||||||
|
debug_value = debug_value.replace("[", "[lb]");
|
||||||
|
|
||||||
|
if (doc_symbol.is_empty()) {
|
||||||
|
debug_value = p_symbol + ": " + debug_value;
|
||||||
|
} else {
|
||||||
|
debug_value = TTR("Current value: ") + debug_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!doc_symbol.is_empty() || !debug_value.is_empty()) {
|
||||||
|
EditorHelpBitTooltip::show_tooltip(code_editor->get_text_editor(), doc_symbol, debug_value, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user