-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Calling a singleton function doesn't show autocompletion in the editor #48624
Comments
In 3.x, the script editor completion doesn't work if you have an error in your script. Fix the error first and autocompletion should appear again. (This is no longer a restriction in You can increase Idle Parse Delay in the Editor Settings to make the editor wait longer before checking for errors. |
yeah, I've increased, but still the hint doesnt appear. Also this is sure not a regression because I remember this happening on earlier versions of the engine! |
@Calinou There's another problem to, maybe I should open a proposal for that? the case is that, what if the user wants to have a scene-only singleton? I mean at scene start he add_autoload_singleton() and at scene finish he calls remove_autoload_singleton(). The problem lies in, when the user call this "temporary" autoload from the scripts inside this scene, isnt possible! |
I can't see too many use cases for a scene-only singleton. You can load a |
Just a bit of cleanup (maybe?), related issues: |
On Godot 4.0.2 I now can autocomplete methods called on singletons autoloaded directly via their gd script. EDIT while writing this comment: after switching to .gd and back to autoload scene, autocompletion now works! I don't know if this is a hack or if Godot just took one minute to properly parse the singleton scene > script. Will need more testing and see if we can close the issue in both cases, or if there is really a permanent bug sometimes. I considered strong-typing the node, but to do this you need to name your script with
which makes sense because you know have a redundant declaration (singleton class and singleton instance are not the same thing). So you now need two names:
and in autoload definition, you associate the Singleton.tscn to some name |
Still valid in 4.x (completing the method does work, but the property hint is missing) |
This is so bizarre. I wish it were consistent, but it's not. If anyone could debug this it would be much appreciated, it's very frustrating and sounds like there are a multitude of issues regarding this problem. To be clear, like @hsandt mentioned, it seems truly random as before my reboot, one of two worked, yet they were identically configured. After, neither did, despite nothing changing whatsoever in the configuration of Omni. However, as @HolonProduction mentions, the autocomplete for the method works, and as you can see in the first two examples below, the parameter count info isn't lost. For reference, I'm on this commit of the editor in Windows: and experience the same intermittency in the newest "refresh" flatpak on Ubutu/Wayland. Qu'est-ce que t'en penses, @Calinou ? |
As you might have seen, I submitted I fix, that I believe fixes the issue. Although I did not get inconsistent random behavior, but I could imagine that there are some situations, in which the type of the autoload might be resolved as class because of some caching mechanics 🤷 If you have the capabilities, to compile the engine yourself, could you try applying my fix and tell us how it went? If not, please try a recent dev built, as #87278 might have an influence as well |
Also, the code that you showed, is it inside of either |
As long as you stick with GDScript, #87278 should have fixed it for 4.3. Feel free to try it in the recent beta. |
Godot version:
3.3 stable
OS/device including version:
Windows 10 x64
Issue description:
When the user have a script and wants calls a function from this same script it shows the func description like this:
But when you call a func from a Singleton, this hint doesnt show:
Steps to reproduce:
Minimal reproduction project:
N/A
The text was updated successfully, but these errors were encountered: