Fix lookup symbol in scripts which doesn't open a tab at first attempt

This commit is contained in:
Yuri Roubinsky 2022-04-05 10:18:45 +03:00
parent 3ffe7004dd
commit 5db47c5521
2 changed files with 20 additions and 9 deletions

View File

@ -3291,15 +3291,8 @@ void ScriptEditor::_help_class_open(const String &p_class) {
void ScriptEditor::_help_class_goto(const String &p_desc) {
String cname = p_desc.get_slice(":", 1);
for (int i = 0; i < tab_container->get_tab_count(); i++) {
EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_tab_control(i));
if (eh && eh->get_class() == cname) {
_go_to_tab(i);
eh->go_to_help(p_desc);
_update_script_names();
return;
}
if (_help_tab_goto(cname, p_desc)) {
return;
}
EditorHelp *eh = memnew(EditorHelp);
@ -3313,6 +3306,22 @@ void ScriptEditor::_help_class_goto(const String &p_desc) {
_sort_list_on_update = true;
_update_script_names();
_save_layout();
call_deferred("_help_tab_goto", cname, p_desc);
}
bool ScriptEditor::_help_tab_goto(const String &p_name, const String &p_desc) {
for (int i = 0; i < tab_container->get_tab_count(); i++) {
EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_tab_control(i));
if (eh && eh->get_class() == p_name) {
_go_to_tab(i);
eh->go_to_help(p_desc);
_update_script_names();
return true;
}
}
return false;
}
void ScriptEditor::update_doc(const String &p_name) {
@ -3601,6 +3610,7 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_update_script_connections", &ScriptEditor::_update_script_connections);
ClassDB::bind_method("_help_class_open", &ScriptEditor::_help_class_open);
ClassDB::bind_method("_help_tab_goto", &ScriptEditor::_help_tab_goto);
ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts);
ClassDB::bind_method("_update_members_overview", &ScriptEditor::_update_members_overview);
ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts);

View File

@ -440,6 +440,7 @@ class ScriptEditor : public PanelContainer {
void _help_class_open(const String &p_class);
void _help_class_goto(const String &p_desc);
bool _help_tab_goto(const String &p_name, const String &p_desc);
void _update_history_arrows();
void _save_history();
void _go_to_tab(int p_idx);