godot: Godot 4: Autocompletion for relative nodes ($ selector) doesn't work

Godot version

4.0.alpha11

System information

MBP M1, MacOS Monterey

Issue description

Autocomplete doesn’t work for relative nodes. When using the dollar sign selector ($MyNode), the resolved type of any node is always Node, which makes type-specific variables and methods not show up in autocomplete.

Example: Take this Sprite2D node (called Sprite): image

The variable flip_h is not shown in the autocomplete dropdown (but does work in runtime).

If we explicitly create a Sprite2D variable, it works: image

But if we assign a node to this variable, it goes back to not working: image

Therefore, my conclusion is:

  1. Relative nodes are not assigned the correct type
  2. In general, the types themselves do work (if used explicitly)
  3. But for some reason, selecting a relative node overrides the explicit type and reverts the variable type to Node

Steps to reproduce

  1. Create any scene with two nodes (parent and child)
  2. Create a script for the parent
  3. Try to access the child via dollar sign selector
  4. Try to access a well known variable \ method of the child from the parent’s script
  5. Autocomplete will not show the desired variable \ method (but they will work in runtime)

Minimal reproduction project

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 11
  • Comments: 20 (12 by maintainers)

Most upvoted comments

Resurfaced for me in 4.1.1, while I was doing the “Creeps” tutorial. $AnimatedSprite2D does not autocomplete the “play” method, see attached screenshot. Using MBA M1 2020, Mac OS X Ventura 13.5

image

It’s not fully fixed. Autocompletion does not work on $nodepaths directly.

This bug still occurs in v.4.2.1. Autocompletion works works only when using as keyword. GodotAutocompetionNoAs GodotAutocompetionWithAs

Ah, I simply missed the email notification about this issue, I can take a look to fix it now.

@Chaosus is it helpful anyhow ? 😅

Of course 😸 thank you

Screenshot from 2022-11-08 23-55-04 also enums are not working