YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
26 stars 8 forks source link

[Code Editor 2] Don't favour `/* */` comments on selection of multiple lines! #5305

Open thennothinghappened opened 8 months ago

thennothinghappened commented 8 months ago

Is your feature request related to a problem?

In the original code editor (and most other IDEs), using the keybind to comment out a block does one of two things:

  1. For each line selected, prepends //.
  2. At the beginning of the first line, prepend /*, and at the end of the last line append */.

The original code editor does option 1. CE2 on the other hand does option 3, and places a block comment opening and closing exactly where the selection is.

Most times you intend to comment out a section of code, its as a quick measure to either debug or rewrite something. Having to exactly position your selection correctly whilst trying to do something quickly isn't very efficient or fun!

Extra clarification (Edit, 18/07/2024):

Every IDE I've used before goes the route of either:

a) If your selection covers multiple lines, always use //, if your selection is partial for one line, use /* */ covering your selection, if you have no selection use // for the line with the caret.

b) Use // on all lines your selection covers. if you have no selection, use // for the line the caret is on. the /* */ case is a rare inclusion and every time i have encountered it, its intentionally only applicable where your selection is on a single line.

The cases where you'd want /* */ to apply at the bounds of the selection over multiple lines are incredibly rare. i can't really think of any off the top of my head - they're massively outnumbered by cases you do not want this to happen.

Describe the solution you'd like

I'd like CE2 to return to the original behaviour and prepend selected lines with //. Either option 1 or 2 is mostly acceptable, but I'd argue in favour of the former, as it shines better in a situation in which you then selectively uncomment part of the block but not all. Option 2 does not work well in this case - and this is all about making it as simple as possible for the developer.

In fact, CE2 actually already knows how to do this if you manage to select correctly, but seems to have the partial selection case intentionally setup to do a less helpful action.

Keeping the current behaviour only for single lines does also make sense.

Finally, I think these behaviours are up for debate as to how they help for different peoples' workflows. Given that, there really should be preferences to pick and choose how you want it to act. Then everyone can be happy :D

Describe alternatives you've considered

...

Additional context

No response

backYard321 commented 4 months ago

I agree with pretty much everything here, however i'd ALSO like to keep the /* */ behaviour in the specific case when segments of multiple lines are selected by alt+drag. EG:

image would become: image