From 991c1a85a9f3a34b9f07238db73d017066f8f4cb Mon Sep 17 00:00:00 2001 From: HolonProduction Date: Sun, 22 Jun 2025 16:25:36 +0200 Subject: [PATCH] Autocompletion: Don't filter overrides when the existing function is the current one --- modules/gdscript/gdscript_editor.cpp | 11 +++++++++-- .../completion/common/override_function_full_name.cfg | 5 +++++ .../completion/common/override_function_full_name.gd | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 modules/gdscript/tests/scripts/completion/common/override_function_full_name.cfg create mode 100644 modules/gdscript/tests/scripts/completion/common/override_function_full_name.gd diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 1c507750f6..54dae31b03 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -3558,7 +3558,11 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c continue; } - if (options.has(member.function->identifier->name) || completion_context.current_class->has_function(member.function->identifier->name)) { + if (options.has(member.function->identifier->name)) { + continue; + } + + if (completion_context.current_class->has_function(member.get_name()) && completion_context.current_class->get_member(member.get_name()).function != function_node) { continue; } @@ -3602,7 +3606,10 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c } for (const MethodInfo &mi : virtual_methods) { - if (options.has(mi.name) || completion_context.current_class->has_function(mi.name)) { + if (options.has(mi.name)) { + continue; + } + if (completion_context.current_class->has_function(mi.name) && completion_context.current_class->get_member(mi.name).function != function_node) { continue; } String method_hint = mi.name; diff --git a/modules/gdscript/tests/scripts/completion/common/override_function_full_name.cfg b/modules/gdscript/tests/scripts/completion/common/override_function_full_name.cfg new file mode 100644 index 0000000000..ecfb9cc9a2 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/common/override_function_full_name.cfg @@ -0,0 +1,5 @@ +scene="res://completion/get_node/get_node.tscn" +[output] +include=[ + {"display": "_get(property: StringName) -> Variant:"}, +] diff --git a/modules/gdscript/tests/scripts/completion/common/override_function_full_name.gd b/modules/gdscript/tests/scripts/completion/common/override_function_full_name.gd new file mode 100644 index 0000000000..e0b3b2852d --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/common/override_function_full_name.gd @@ -0,0 +1,3 @@ +extends Object + +func _getāž”