godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Add autocompletion for connecting signals in the script editor #8714

Open DexterFstone opened 11 months ago

DexterFstone commented 11 months ago

Describe the project you are working on

any project

Describe the problem or limitation you are having in your project

I always use a script editor to connect signals, and it takes so long, but it gives me more flexible 01 or 02

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

add autocomplete to connect signals to make the process faster

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

Before: 01 Or 02

After: 03 Or 04

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

This can work with inspector signals but is hard to manage and needs to add a node in the Editor

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

This improves the Script and Script Editor and makes faster coding

Mickeon commented 11 months ago

Not sure how to feel about this. On one hand, it definitely would be faster for the described case. On the other, this autocompletion is likely not to respect the user's wishes. You do not always want to create a method right away. Sometimes you need an existing method, or you may need a lambda. You may even want to write it later.

Furthermore, the cursor jumping pretty far down onto a newly created method can be a bit disorienting at best, and a nuisance at worst.

I'd rather have some other way to swiftly connect signals, and have more control over it. Macros, right-click functionality, shortcut, etc.. Whatever is more appropriate for the editor's interface.

DexterFstone commented 11 months ago

I'd rather have some other way to swiftly connect signals, and have more control over it. Macros, right-click functionality, shortcut, etc.. Whatever is more appropriate for the editor's interface.

the shortcut is a good idea, we use Enterto complete the code, so Ctrl + Enter and Ctrl + Shift + Enter for connect signal autocomplete

DexterFstone commented 11 months ago

one more thing, if we have a class that extends from the object, it's not possible to add it in the editor so it's not possible to use Inspector autocomplete signals

Nikitf777 commented 10 months ago

I think autocompletion should activate when you already have wrote .connect(, then text editor should give you an option to autocomplete with autogenerated function title and arguments list

nubels commented 4 months ago

Not sure how to feel about this. On one hand, it definitely would be faster for the described case. On the other, this autocompletion is likely not to respect the user's wishes. You do not always want to create a method right away. Sometimes you need an existing method, or you may need a lambda. You may even want to write it later.

Furthermore, the cursor jumping pretty far down onto a newly created method can be a bit disorienting at best, and a nuisance at worst.

I'd rather have some other way to swiftly connect signals, and have more control over it. Macros, right-click functionality, shortcut, etc.. Whatever is more appropriate for the editor's interface.

How about an editor setting where you can enable or disable this autocompletion and also specify whether you want to use lambda functions or not?

I also think the cursor should not jump to the newly created function though.

HolonProduction commented 2 months ago

10571 proposes an alternative approach for the second case which avoids pitfalls with generating a function for the user.