godotengine / godotengine/godot

Autocompletion of a Class that inherits from an Inner Class suggests the inherited class siblings

Open
#110,313 2 comments 0 reactions 0 assignees View on GitHub
discussion topic:editor topic:gdscript
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Tested with:
- master branch (4.5)
- 4.4 branch (4.4.1)

### System information

Windows 10

### Issue description

For some reason it seems that Siblings classes of the parent class are suggested for autocompletion.
Like that:
```
# parent_container.gd
class_name ParentContainer
extends RefCounted

class Parent1:
var property1 = 0

class SiblingClass1:
var property2 = 0
```
```
# main.gd
@tool
extends EditorScript

func _run() -> void:
# when typing `ChildClass.` it adds all Siblings inner classes including itself for suggestion.
ChildClass.SiblingClass1 # this gives a parse error as intended although it was suggested
# but it is more confusing with instances.
var child_object: ChildClass = ChildClass.new()
child_object.SiblingClass1 # the error only appear during runtime interruption although it was suggested by the autocomplete feature.
```

### Steps to reproduce

Here siblings' inner classes of the parent class are suggested what happens:

Image

Even the parent itself:

Image

Also, this is something, but I believe it is better to be in a separate issue or feature proposal:

Image

As autocompletion of inner classes is not supported on inheritance `extends`!

### Minimal reproduction project (MRP)

Here where I tested this behavior with multiple elements:

[InnerClassInheritance.zip](https://github.com/user-attachments/files/22198017/InnerClassInheritance.zip)

It seems that this is working as expected with parent's siblings that are attributes, methods, and signals. But not the case with siblings' inner classes.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.