godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.05k stars 65 forks source link

Make signal autogenerated methods contain their type #9684

Closed Frozenfire92 closed 1 week ago

Frozenfire92 commented 1 week ago

Describe the project you are working on

A game that uses signals for event communication

Describe the problem or limitation you are having in your project

When using the editor to auto generate a method from a signal, the parameter types are not included, even though they are shown in the Node dock

image

image

image

While godot is typing optional, I believe it would be helpful as it provides an immediate understanding what the parameter is, as well as a shortcut (ctrl + click) to quickly access the docs for that type

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

Update the method auto generation to include the type for parameters

func _on_area_entered(area: Area2D):
    pass # Replace with function body.

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

This may not be desired within godot's paradigms of types being optional, but I think it could be presented as an Editor Setting allowing users to opt into this functionality

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

Unsure

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

This feels like core engine functionality

AThousandShips commented 1 week ago

They are added if you enable text_editor/completion/add_type_hints

Frozenfire92 commented 1 week ago

That's great, thanks for pointing me in the right direction

Calinou commented 1 week ago

Note that this setting is enabled by default since 4.3: https://github.com/godotengine/godot/pull/88026

Frozenfire92 commented 1 week ago

That's great 🙂