-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Editor auto-completion/error-checking for preloaded classes is partially non-functional #104494
Comments
Everything seems to work fine, if you actually give the variable a type, by using If you use an untyped variable, Godot will be quite lenient with error checking, if you don't want this, you can enable additional checks in the project settings. With "Unsafe method access" set to error the non-existing method is marked as error. "Unsafe property access" doesn't seem to work in this scenario this is probably actually a bug. (Or it is just an inconsistency, I'm not sure in how far those warnings actually should work with untyped code, because in theory you could reasign the variable at any point which would make everything an invalid call). |
@HolonProduction Thx for your answer. Regarding your first solution: Using static var class_b := preload("res://class_b.gd") instead of static var class_b = preload("res://class_b.gd") actually solves all of the issues with error checking and auto completion that I described in this issue. typeof/type_string shows, that := gives the static var the type Object. Maybe := does something different then : Object = However I don't know if the behaviour of the remaining scenarios is as intended/expected or actually something that would count as a bug. As the behaviour is still very inconsistent (meaning with := non-existing vars are not recognized by the errorchecking but non-existing function are recognized), I think this could very well still be unexpected/unintended behaviour by the editor. Regarding your second solution: Using const all of the issues with errorchecking/autocompletion that I described, are solved, even without := Your solutions are at least a very good workaround for the problem, I can easily work with that, so thank you very much! |
Godot's type system is a bit complicated. Typeof only gives you the
Agree, this seems inconsistent but I don't know what the intended behavior is. |
Tested versions
System information
Godot v4.3.stable - Ubuntu 24.04.2 LTS 24.04 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3050 Ti Laptop GPU - AMD Ryzen 5 5600H with Radeon Graphics (12 Threads)
Issue description
Functions in a subclass calling other static functions/variables in differents scripts/classes won't error check correctly.
The fact, that the Editor is able to spot wrongly called existing functions but not non-existing functions, made me think this is a bug in the Editor and not expected behaviour, please correct me if I'm wrong.
The provided screenshot highlights only one of the problematic scenarios. I described more of them in the comments in class_a.gd
Steps to reproduce
You can just download and open the testscenario that I created for this issue.
In class_a.gd the class_b.gd is loaded via preload and I made multiple test functions in class_a with respective comments that describe everything that does or does not work regarding the Editors auto-correction/error checking issues I described.
Minimal reproduction project (MRP)
https://github.com/SilverLPs/godot-editorbug or the zip file below
godot-editorbug-master.zip
The text was updated successfully, but these errors were encountered: