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

Auto Complete/Intellisense for references in inner autoload variables can't be resolved #71296

Closed
kuhnchris opened this issue Jan 12, 2023 · 4 comments · Fixed by #87278
Closed

Comments

@kuhnchris
Copy link

kuhnchris commented Jan 12, 2023

Godot version

4.0.beta10, master-branch (v4.0.beta.custom_build.2ac2db8de)

System information

Win 11

Issue description

It seems like there is an issue with inner-class resolving in Godot 4, when you try to access the members of a instance of a auto-load object, it apparently only results in the base Node members being displayed in the auto complete.
It does work to use it even if auto-complete does not suggest it, so I assume it's just an error related to the resolving within the LSP (probably, but that's just a guess). Sadly I do not really have any idea where I could investigate this - this happens in VSCode and Godot. It also sometimes fixes itself after a couple of restarts, sometimes it doesn't, deleting the .godot folder doesn't change anything.

Here's also a video showing the entire process: https://youtu.be/Q-6sxvcQq84

Edit: Just as a note: If you "redefine" the node in the current script, simply by adding it as a variable at the top of the script, all the resolves are working.

Steps to reproduce

  • Create Project
  • Create Class to use as Auto-Load
  • Create Class with a function
  • Instance "Class with a function" in "Class to use as Auto-Load"
  • Create a script in a scene
  • Try to use autocomplete on the Auto-Load object
  • Try to use autocomplete on the "Class with a function" instance in the Auto-Load object
  • Fail to see the function name(s) / objects / variables / pretty much everything

Minimal reproduction project

WeirdExampleProjectForIssuesWithGDScriptReload.zip

@kuhnchris
Copy link
Author

Also, another weird thing I noticed:
If you declare the variable outside the function (as a "property" of the calling class), you cannot access the function auto-complete via "variable.functionName()", but you can access it with "self.variable.functionName()"???
Wasn't Godot 4 suppose to remove those pesky "self." references, or are those now required instead of optional?

Video: https://youtu.be/DwnQ7yc0Xlw

@Calinou
Copy link
Member

Calinou commented Apr 1, 2023

@Nukiloco
Copy link

Nukiloco commented Jul 21, 2023

Currently having this issue as well when I have a singleton that controls my game. This only happens if you access it by the global node.

Interesting enough assigning global to a variable in your script will bypass this issue

Doesn't work

func _ready():
	global.fruits.apple # apple and any other custom variables will not appear

Works

var global_variable = global
func _ready():
	global_variable.fruits.apple # apple and any other  custom variables will now appear

Which is almost exactly what the person said above is happening. Though oddly enough the autocomplete is working without self in the global_variable example.

@HolonProduction
Copy link
Member

#74888 is a duplicate of this (wouldn't close though since both threads may contain important information)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Status: Todo
Development

Successfully merging a pull request may close this issue.

7 participants