-
-
Notifications
You must be signed in to change notification settings - Fork 21k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ScriptEditor, GDScript - Typed @onready variables do not provide complete autocomplete dropdown #85035
Comments
Discovered by a user on this thread: https://godotforums.org/d/37587-at-onready-variable-doesnt-give-script-hints |
After testing for a bit, I found out that this is likely related to the scene-based autocomplete. While editing a script connected to the root of the currently selected scene, you can get autocomplete hints for There are two problems with this second system.
This can happen any time you use
|
I've just found out that this was actually already reported (#73638). |
Thanks for the detective work @GreentheNinja I hadn't found 73638 when searching. Sorry about that. We'll close this one. |
Godot version
Godot v4.2.beta (9df6491), also in earlier 4.X
System information
Godot v4.2.beta (9df6491) - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1080 Ti (NVIDIA; 31.0.15.3623) - AMD Ryzen Threadripper 1950X 16-Core Processor (32 Threads)
Issue description
In the script editor, when explicitly applying a typehint to an
@onready
variable, if the type is of a custom class, that custom class' member variables and functions will not be exposed to autocomplete. The autocomplete dropdown will display members of any built-in classes inherited from, but just not the custom class itself's members.This might potentially point to a bug with the typehints in general, or just a bug related to autocomplete.
Steps to reproduce
Create a custom class and save it to resources like this example:
To any node in the scene, attach a child Sprite2D and attach MyCustomClass to it.
To that parent node, attach and manually write out a script like this example:
Observe that after the
.
aftersprite
, the member variables of MyCustomClass will not display in the autocomplete dropdown. In contrast, after the.
aftersprite2
, the member variables of MyCustomClass will display in the autocomplete dropdown. Going further, apply a cast to the onready variable rhs:Observe now that the member variables of MyCustomClass all properly display in the autocomplete.
Minimal reproduction project
None should be necessary. Will upload one on request.
The text was updated successfully, but these errors were encountered: