mirror of
https://github.com/godotengine/godot.git
synced 2025-10-29 20:51:14 +00:00
Script Editor: Add option to disable documentation tooltips
This commit is contained in:
parent
36d90c73a8
commit
ead16435bf
5 changed files with 35 additions and 8 deletions
|
|
@ -1103,6 +1103,10 @@ void ScriptTextEditor::_validate_symbol(const String &p_symbol) {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::_show_symbol_tooltip(const String &p_symbol, int p_row, int p_column) {
|
||||
if (!EDITOR_GET("text_editor/behavior/documentation/enable_tooltips").booleanize()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_symbol.begins_with("res://") || p_symbol.begins_with("uid://")) {
|
||||
EditorHelpBitTooltip::show_tooltip(code_editor->get_text_editor(), "resource||" + p_symbol);
|
||||
return;
|
||||
|
|
@ -1203,19 +1207,14 @@ void ScriptTextEditor::_show_symbol_tooltip(const String &p_symbol, int p_row, i
|
|||
}
|
||||
}
|
||||
|
||||
// NOTE: See also `ScriptEditor::_get_debug_tooltip()` for documentation tooltips disabled.
|
||||
String debug_value = EditorDebuggerNode::get_singleton()->get_var_value(p_symbol);
|
||||
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;
|
||||
}
|
||||
debug_value = TTR("Current value: ") + debug_value.replace("[", "[lb]");
|
||||
}
|
||||
|
||||
if (!doc_symbol.is_empty() || !debug_value.is_empty()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue