godotengine / godot-proposals

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

Place cursor at end of collapsed block #10490

Open MM4096 opened 2 months ago

MM4096 commented 2 months ago

Describe the project you are working on

Any project using the Godot editor

Describe the problem or limitation you are having in your project

When collapsing a function (or region) with the arrows on the left panel, pressing Enter to create a new line at the end of the collapsed line (see image below for location), a line break is created inside the function (see below, again), and the function is expanded.

This is inconsistent with other IDE's, particularly the JetBrains suite, and changing this will make the Godot editor feel more consistent.

image (Pressing Enter here creates the following result) image (Line break at 52, instead of at the end)

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

To either place the cursor at the end of the code block when pressing Enter (to create a newline after the block, without expanding it). Alternatively, if the "Expand" image (image) were to be a character, so that the cursor can go behind it to create a newline, maintaining the current system.

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

Solution 1: Create line at end of block, without expanding the block image

Solution 2: Two seperate options for cursor positions, current still behaves like it currently does, but cursor at the end (green) creates a line at the end of the block. image

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

I don't know, as I have not found a method to change the behavior of the editor itself.

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

Other IDE's offer this function as a built-in thing, so why shouldn't Godot do the same?

kitbdev commented 2 months ago

Godot matches the behavior of VSCode, where pressing enter will make a new line inside the folded block. Other IDEs are not consistent. Visual Studio does what your second solution does, where the caret can be put after the icon.