godotengine / godot-proposals

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

Make breakpoints stop when placed on the function declaration #8032

Open Araraura opened 11 months ago

Araraura commented 11 months ago

Describe the project you are working on

A 2D sidescrolling metroidvania with some platforming elements. Though this suggestion can be applied to literally any project built using Godot.

Describe the problem or limitation you are having in your project

A breakpoint must be placed on lines of code inside functions. Placing it right on the function declaration will not work, which can be confusing to the user.

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

Allowing the user to stop the debugging when a breakpoint is placed on the declaration of a function will likely save the user some time figuring out why their code didn't stop when they expect it to stop.

On most IDEs the code does stop when a breakpoint is placed on the declaration of a function/method, so some people might be confused why it doesn't happen in Godot.

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

Placing a breakpoint on the function's declaration should be equivalent to placing a breakpoint on the first line of a function.

My proposal is when a breakpoint is placed like this: image

It should be the same as placing it like this: image

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

No, since this is an improvement suggestion for the editor itself.

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

Breakpoints are already handled by the editor, and in practice this should be a small QoL change.

Mickeon commented 11 months ago

To be a lot more broad, breakpoints also do not work in fully commented out lines, in the middle of otherwise accessible code.