godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Autofill documentation comment block when returning to a new line #8244

Open Cronos87 opened 11 months ago

Cronos87 commented 11 months ago

Describe the project you are working on

This feature can be helpful in any project.

Describe the problem or limitation you are having in your project

When writing documentation for my functions or variables, I often go to a new line, which requires adding ## again every time I go to a new line.

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

It would be lovely to detect if the user is on a documentation line and prefill with "##" when returning to a new line like VSCode.

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

Here is an example on how it is working on VSCode:

https://github.com/godotengine/godot-proposals/assets/1923206/7f0ec95c-3da2-42fb-9a76-c5f25693b578

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

I don't know enough addons to judge if it can be achieved using an addon.

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

Performances issues. Because I can't determine if an addon can do it or be as fast as the native Godot language.

It seems more "logical" that the editor includes it by default than an addon; more users would be positively impacted.

Calinou commented 11 months ago

Note that this should only occur on ## documentation comments, not standard # comments.

Cronos87 commented 1 month ago

I would like to try to implement it as my first Godot contribution. My search brought me to these two functions:

https://github.com/godotengine/godot/blob/master/editor/code_editor.cpp#L908

https://github.com/godotengine/godot/blob/master/editor/code_editor.cpp#L940

If someone knowing Godot well can give me a clue if I'm in the right direction?

I will try to do it in any case, but a clue would help me a little as I don't know at all the codebase 😁

Many thanks in advance 🙏