Skip to content

Commit 4516050

Browse files
committed
Merge pull request #92885 from Chaosus/fix_goto_definition_for_new
Fix goto definition for `new` method
2 parents 5bab95a + 5962646 commit 4516050

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

modules/gdscript/gdscript_editor.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3571,9 +3571,13 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
35713571
switch (base_type.kind) {
35723572
case GDScriptParser::DataType::CLASS: {
35733573
if (base_type.class_type) {
3574-
if (base_type.class_type->has_member(p_symbol)) {
3574+
String name = p_symbol;
3575+
if (name == "new") {
3576+
name = "_init";
3577+
}
3578+
if (base_type.class_type->has_member(name)) {
35753579
r_result.type = ScriptLanguage::LOOKUP_RESULT_SCRIPT_LOCATION;
3576-
r_result.location = base_type.class_type->get_member(p_symbol).get_line();
3580+
r_result.location = base_type.class_type->get_member(name).get_line();
35773581
r_result.class_path = base_type.script_path;
35783582
Error err = OK;
35793583
r_result.script = GDScriptCache::get_shallow_script(r_result.class_path, err);

0 commit comments

Comments
 (0)