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

Suggest type constants as types #11430

Open
KoBeWi opened this issue Dec 27, 2024 · 1 comment · May be fixed by godotengine/godot#94996
Open

Suggest type constants as types #11430

KoBeWi opened this issue Dec 27, 2024 · 1 comment · May be fixed by godotengine/godot#94996

Comments

@KoBeWi
Copy link
Member

KoBeWi commented Dec 27, 2024

Describe the project you are working on

Complex GDScript-based project.

Describe the problem or limitation you are having in your project

GDScript supports using constants as types, e.g. const MyType = preload("res://script/path.gd") and afterwards var my_object: MyType etc. It's a nice feature if you don't want to pollute global namespace. However these "types" are not suggested in autocompletion, so e.g. if you write var my_object: MyT, the type won't be suggested.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

It would be useful if type constants were available for autocompletion. Both local constants (MyType) and external ones (ClassName.MyType).

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

The editor is able to determine when to complete for type hint. "Constant types" are just constants of type Script, so they could be added to the type autocompletion list.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No.

Is there a reason why this should be core and not an add-on in the asset library?

Built-in autocompletion can't be extended.

@HolonProduction
Copy link
Member

HolonProduction commented Dec 28, 2024

godotengine/godot#94996 includes this IIRC

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