Skip to content
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

Autocomplete/code complete functions not suggested #45414

Closed
frankhuurman opened this issue Jan 24, 2021 · 8 comments
Closed

Autocomplete/code complete functions not suggested #45414

frankhuurman opened this issue Jan 24, 2021 · 8 comments

Comments

@frankhuurman
Copy link

Godot version:
3.2.3.stable

OS/device including version:
Ubuntu 20.04

Issue description:
The code editor didn't autocomplete or suggest a few built-in functions that I needed for my game and I assume are often used in other projects as well.
I expected the queue_free() function to show up in the autocomplete menu when pressing ctrl+space after typing the name of a node and a dot symbol.
I also expected the instance() function to show up in the autocomplete menu after typing the variable name + dot symbol of a loaded scene resource.
These both didn't show up or weren't suggested even while typing half of the name of the functions.

Steps to reproduce:
queue_free function
for child in scrollcontainer.get_children():
child.queue_free() # after typing child. and pressing ctrl+space, no queue_free function was suggested.

instance function
var json_node = load("Scenes/jsonparser.tscn")
var temp_inst = json_node.instance() # after typing json_node. and pressing ctrl+space, no instance() function was suggested.

Minimal reproduction project:
autocomplete-missing.zip

@Calinou
Copy link
Member

Calinou commented Jan 24, 2021

Does it work if you use preload() instead of load()?

@frankhuurman
Copy link
Author

preload() does add the instance() autocomplete suggestion, but it also defaults the search path string to res://Scripts/Scenes/jsonparser.tscn(which doesn't exist) instead of Scenes/jsonparser.tscn.
Not a big deal though, thanks! 😄

Do you also have a suggestion for the queue_free() function? Might it also have something to do with the editor needing to "preload" the reference to the child node before being able to use it in the editor? or is that something else entirely? :)

Thanks for the quick reply btw!

@Calinou
Copy link
Member

Calinou commented Jan 24, 2021

Do you also have a suggestion for the queue_free() function? Might it also have something to do with the editor needing to "preload" the reference to the child node before being able to use it in the editor? or is that something else entirely? :)

For nodes, autocompletion should work more reliably if you use static typing.

@Calinou
Copy link
Member

Calinou commented Aug 20, 2022

@frankhuurman Can you (or anyone else) still reproduce this bug in Godot 3.5 or any later release?

@Calinou
Copy link
Member

Calinou commented Sep 20, 2022

Closing due to lack of response. Please comment if you can still reproduce this bug.

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2022
@rarysson
Copy link
Contributor

Hi @Calinou, I've encountered this bug too, using v4.0.stable.official [92bee43ad] as you can see (tried on vs code and Godot editor):

bug

And here it's the minimal reproduction project: autocomplete.zip

@Nanaschi
Copy link

image
image
Same by me it does not offer the autocompletion despite the method is valid... I would find this method if I did not know it existed..
v4.2.2.stable.official [15073af]

@HolonProduction
Copy link
Member

Not a bug and has nothing to do with #86172, as mentioned before you will have to use static typing in order to get autocompletion for node methods. In your case, godot does not know the type of body and therefore doesn't know that its method get_node will return a Node. Try with func _on_body_entered(body: Node2D) -> void:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants