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-Completion of statically typed object-properties on autoload doesn't work #87219

Closed
Jowan-Spooner opened this issue Jan 15, 2024 · 0 comments · Fixed by #87278
Closed

Auto-Completion of statically typed object-properties on autoload doesn't work #87219

Jowan-Spooner opened this issue Jan 15, 2024 · 0 comments · Fixed by #87278

Comments

@Jowan-Spooner
Copy link

Jowan-Spooner commented Jan 15, 2024

Tested versions

  • reproducable in Godot 4.2.1 stable and Godot 4.3.dev2

System information

Windows 10

Issue description

Similar to what has been described in #77643 and #74888, but more specific I think.

Project: Dialogic Plugin

We have a bunch of scripts (all statically typed) that we want to give access to through an Autoload. So we have properties on our autoload script for each of these scripts. However, even if we statically type these properties, auto-completion will NOT suggest any members of these scripts when accessed through the autoload.

So this doesn't work:

Dialogic.Text. # gives only Node and Object suggestions

But strangely enough this does:

(Dialogic as DialogicGameHandler).Text. # gives suggestions of text script members.

I've tried the following ways of defining the properties (on the Dialogic autoload script which has the DialogicGameHandler class name):

var Text := preload("res://text_script.gd").new()

const TextScript := preload("res://text_script.gd").new()
var Text  := TextScript.new()

var Text : TextClass = preload("res://text_script.gd").new() # requires the class name on the script oc

Steps to reproduce

In the MRP below you can find the scripts:
some_object.gd

  • Defines some object with a signal and method

autoload.gd

  • Is setup as an Autoload Singleton in the Project settings
  • has a class name MyAutoload
  • has an object property of type some_object.gd
    • feel free to do static typing with a class name, it doesn't help.

game_script.gd

  • Try to get auto-completions for the Autoload.object property here
  • Notice how you do NOT get suggestions for the signal and method defined in the some_object.gd script
    • gdscript somehow CAN get them when the class is specified (Autoload as MyAutoload).object
    • and also tells us that Autoload.object is a safe line

Minimal reproduction project (MRP)

AutoCompletionMRP.zip

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

Successfully merging a pull request may close this issue.

2 participants