-
-
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
Autocompletion from get_node()
still does not work for some cases
#86172
Comments
get_node()
still does not work for some casesget_node()
still does not work for some cases
Read this before adding a comment:Autocompletion is a complex topic where a lot of internal things can go wrong. Just because the title of this issue is related to the same topic, does not mean that this is the same issue that you encountered. Even if the title sounds like it, this is not a multipurpose thread. The original poster of this issue provided a specific problem (or problems), which are being discussed here. Read the original issue carefully. If it aligns with your problem there is no need to add a comment just leave a emoji reaction to let us know the issue is a common problem. If your problem requires adding code that is not related to the OP, it is most likely worth a new issue. If you are sure that you provide additional info related to the issue: Great, go ahead and help us figure it out! Let's keep the Github issues well organized together. 😃 So i looked to the cases and splited them up into some categories:
|
Thank you for the detailed response!
Godot 3.5.3 had this working, but I am unaware of whether its implementation produced bugs considering how difficult it is. This may be a hack, but would it be possible to hardcode these cases? For example, if the code explicitly parses |
I updated #85224 to fix case 5. |
Was about to open a new issue, but maybe adding a comment here with my experience is enough. I'm also experiencing autocomplete issues with Godot 4.2.1 (v4.2.1.stable.official [b09f793]). Screenshots follow. @HolonProduction please let me know if you need a separate issue for this or a minimal project reproducing it to help troubleshooting (and if this is an issue at all, maybe it's working like this by design?) Edit: it looks like the initial variable assignment in the code reported in the screenshots has some effect on the autocompletion feature. If I remove the assignment and refer to the node directly with the $ notation, the autocomplete does not work - no matter what the selected scene is:
|
There goes my "No Godot on holidays plan". But to net let this get out of hand here is my quick response: The problem you described in your edit was pointed out in this issue already. Recap: it is fixed, the fix is merged but it is not yet part of an official release. Your original issue is from what I know a design decision. The problem is the following: While you have a specific scene in mind for your scrip, Godot has not. In theory you could attach the script to every node or scene, so Godot can't know which you are referring to. So the decision was made, to assume you are referring to the currently open scene (in many cases this holds true, when you open the script via the scene tree dock, but it becomes a problem if you tend to switch your scripts in the script editor). In theory Godot could check all scenes or all open scenes, but this won't scale well and lead to performance issues down the road. There are some proposals to provide a tight coupling between a script and a certain scene/node. But I don't know what the status is on that front. Wouldn't expect it to be solved soon, but if it gets in it would provide a way to provide autocompletion beyond the currently open scene. Let's end this with a quick disclaimer (not specifically targeting you, but more as a copy and pastable thing for all autocompletion issues, since there tends to be a lack of organization on them). Edit: Moved the disclaimer to the beginning of my first comment so that we can focus on the issue here. |
The problem is still present in version 4.3 beta1 |
Please reread my first comment and be specific about your issue. |
|
This is not fixed yet and I wouldn't bet on it getting fixed any time soon. I updated my first comment to reflect which points are still open. Use dollar literals in the meantime. |
Tested versions
v4.2.1.stable.official [b09f793]
v4.2.1.stable.official [b09f793] + #85224
v3.5.3.stable.official [6c81413]
System information
Ubuntu 20.04 LTS
Issue description
Since #79386, autocompletion improved, but it still does not work for other
get_node()
cases.This is a regression (since GDScript 2.0 as far as I can tell) from Godot 3.5 since all cases (except 4, see
NOTES
inSteps to reproduce
) autocomplete.These related bugs differ slightly and are not using
get_node()
directly.#74888 (custom function returns)
#71296 (autoload)
#78860 (superseded by this new bug, I also thought it's a little unclear)
#78820 (return from Dictionary)
I also thought it would be nice to have one MRP to exhaust all combinations for
get_node()
autocompletion since it's a common usecase.Steps to reproduce
A
. Try typing outdo_something()
and observe similar behavior as noted in the comments. I've pasted scriptA.gd
below for reference.NOTES
get_node()
that does not include custom functions, inlined classes, or returns from other data types (like Dictionaries). It is likely I missed some cases though.EDIT: updated with 4.2.1-stable + Prefer identifiers annotated type if assigned type is incompatible to it #85224 + Fix regression when autocompleting subscript on get node #86111
EDIT (12/25/2023): updated again with latest Prefer identifiers annotated type if assigned type is incompatible to it #85224. Also made some of the comments consistent.
Minimal reproduction project (MRP)
getnodebug.zip
The text was updated successfully, but these errors were encountered: