Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Toggle comment cursor placement #18471
Requirements for Adding, Changing, or Removing a Feature
Issue or RFC Endorsed by Atom's Maintainers
#17519 (made this new one because I'd deleted the old PR branch)
Description of the Change
As in the above PR, this changes selection and cursor behaviour when toggling block comments.
An option to do this at the same place that changes the range in the first place would be better, but I don't know how to go about that.
It makes the behaviour more complicated, and could have a performance decrease. The behaviour is toggleable though, at the TextEditor level (I did not pass the options received by the Selection method though).
Manual testing, with all the scenarios laid out in the linked PR.
Also tested with indentation.
This does change functionality for pressing
There is one undesired behaviour now (that I know of), for three selections where the first goes right to left on the leftmost character (line 13 in first GIF).
It currently will select the start delim, but only when there are three or more of them. It's weird. (I do suggest we beat VSCode here though, because it will just insert three nested sets of delims).
Edit: I don't think it's possible to support 3+ cursors cleanly. My understanding is, as changes are applied in order from left to right, the first selection is handled properly (as seen with only one cursor), the second reverts the comment, and the third makes the first do it's default expand-when-text-is-inserted behaviour. This was fixed by
@lee-dohm (I moved to a different PR)
I'm pretty happy with the behaviour now. There are technically still more cases that can be tested, but at the same time I don't think we can exhaustively cover them all. The behaviour, except for as note about line 13, is as in the GIFs above.
Alright. Your earlier comments about using