godotengine / godot-proposals

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

Make the script editor's current line highlight take soft wrap into account #10547

Open mcdz opened 3 weeks ago

mcdz commented 3 weeks ago

Describe the project you are working on

I am working on a 3d mobile game, but the proposal is related to script editor.

Describe the problem or limitation you are having in your project

Its just not the best representation and sometimes causes confusion and forces dev to look at line number or indentation. image

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

In script editor, current line highlight should highlight multiple lines if wrap is on and code is taking multiple lines, this will allow us to be aware of the current line segment, instead of confusion it with single line, and depending on indentation or line number.

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

it's as simple as highlighting multiple lines instead of just 1 when wrapped line takes multiple line area on screen

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

I don't know if it can be done with an editor plugin, possibly can, but that's like adding an additional plugin just for something that could be engine default.

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

Yes, it's a UI/UX Choice for better experience, having an add-on for this is just extra hassle for something that should be a part of engine.

Godot is ♥ (Wish I could Contribute to engine, but I'm not quite there yet!)

Calinou commented 3 weeks ago

Note that this does not appear to be the behavior used in VS Code when soft wrap is enabled. Only the line the caret is on is highlighted.

image

This is likely done so you can see multiple highlights if you have multiple carets on the same softwrapped line:

image

Mickeon commented 3 weeks ago

This is done in Notepad++, however, which is more general-purpose than an IDE. image It may be a subjective implementation detail.