diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-03-26 13:45:18 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-03-26 13:45:18 +0100 |
commit | 4dec783017d1db7dddb6d7f3feb741dfb9ddb0d5 (patch) | |
tree | 29b4c9f229b8e9b681c1cfbbd8636f996bb64e7f /editor/plugins/script_text_editor.cpp | |
parent | 4352503bc59871afaf535a37cdca3bbab3678b97 (diff) | |
parent | 1d93a1fbb8aaf49696dd5508c0d77091ccce5f1f (diff) | |
download | redot-engine-4dec783017d1db7dddb6d7f3feb741dfb9ddb0d5.tar.gz |
Merge pull request #89545 from brno32/override-gutter-icon-inner-class-method
Fix missing gutter icon for inner class method overrides
Diffstat (limited to 'editor/plugins/script_text_editor.cpp')
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index c093f556ea..640c755ccf 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1164,11 +1164,22 @@ void ScriptTextEditor::_update_connected_methods() { // Add override icons to methods. methods_found.clear(); for (int i = 0; i < functions.size(); i++) { - StringName name = StringName(functions[i].get_slice(":", 0)); + String raw_name = functions[i].get_slice(":", 0); + StringName name = StringName(raw_name); if (methods_found.has(name)) { continue; } + // Account for inner classes + if (raw_name.contains(".")) { + // Strip inner class name from the method, and start from the right since + // our inner class might be inside another inner class + int pos = raw_name.rfind("."); + if (pos != -1) { + name = raw_name.substr(pos + 1); + } + } + String found_base_class; StringName base_class = script->get_instance_base_type(); Ref<Script> inherited_script = script->get_base_script(); @@ -1217,7 +1228,7 @@ void ScriptTextEditor::_update_connected_methods() { text_edit->set_line_gutter_icon(line, connection_gutter, get_parent_control()->get_editor_theme_icon(SNAME("MethodOverrideAndSlot"))); } - methods_found.insert(name); + methods_found.insert(StringName(raw_name)); } } } |