Object method autocomplete not working

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Puresilence2002

Hello,

ich have a object with some methods. The code works perfectly but in the code editor the members and methods are not autocompleted when i type dot. Any idea why this ust not working or how i can switch it on?

Thanks a lot! Stefan.

Godot’s autocomplete is a little erratic for me too sometimes. Typically, closing and reopening the script or Godot itself fixes the issue for me.

jgodfrey | 2020-03-05 04:00

:bust_in_silhouette: Reply From: jgodfrey

If this is a custom object, I’d guess it’s related to the fact that you may be using dynamic typing in your script. For autocomplete to work, you’ll have to use static typing in your code.

See this related thread:

https://www.reddit.com/r/godot/comments/bem9k7/how_to_make_code_editor_autocomplete_variables/

And the docs:

Thanks a lot jgodfrey! Dynamic typing was the “problem”.

Changing

var ppm_player = CPixelPerfectMovement.new(TICK_AMOUNT, Vector2(0,0))

to

var ppm_player:CPixelPerfectMovement = CPixelPerfectMovement.new(TICK_AMOUNT, Vector2(0,0))

did the trick. Now autocompletion works like a charm.

Perfect! Greetings Stefan

Puresilence2002 | 2020-03-05 09:57