summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2022-04-05 10:18:45 +0300
committerYuri Roubinsky <chaosus89@gmail.com>2022-04-05 10:18:45 +0300
commit5db47c55216fef249da722cd78a94e8006f6c1f0 (patch)
tree2cbf0f49e2765a5ea4a3b0d4bef0cc7f737843e9 /editor
parent3ffe7004ddb56697dbf661786b996dafa98bc89e (diff)
Fix lookup symbol in scripts which doesn't open a tab at first attempt
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/script_editor_plugin.cpp28
-rw-r--r--editor/plugins/script_editor_plugin.h1
2 files changed, 20 insertions, 9 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 677b55bb88..c56d4de6ad 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -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);
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 5eeca7a334..43f7f26a99 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -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);