Inconsistent Behavior on Blank Lines
I'm a new Rider user, and while trying out the IDE today I noticed some really odd behaviors on blank lines that don't seem like they're intentional. On all default formatting settings in Rider 2020.1.3, if I simply open a new console app with the default code text and add a couple blank lines, then run the auto-formatter, it eliminates the indentations on the blank lines. This is fine, but there doesn't seem to be a straightforward way to get the proper indenting back.
There are a number of problems with this:
- Reading around a bit, it seems like you're supposed to be able to hit "End" to jump to the end of the proper indentation of one of these lines. There's even an option for this in the settings menu under Editor > General > Typing Assistance > Miscellaneous. This does not seem to work.
- Clicking with the mouse past the end of a line does not restore the proper indentation. Even if it's just a virtual cursor and it doesn't actually insert the tabs/spaces, I ought to be able to click off to the right and it should jump to the proper indenting, not all the way to the left, which is the incorrect indentation almost 100% of the time.
- Going to a line with the proper indentation and pressing the down-arrow or up-arrow returns all the way to the left. Again, this is wrong nearly 100% of the time. I'm not going to put code there, and there's no reason I should have to type tab 3-8+ times to get back to the right place, particularly when the IDE clearly knows where the right indentation is.
- The most key-efficient way to solve this actually appears to be to press backspace/enter on the blank line. Which completely deletes the line and restores it with the proper indentation, because pressing enter restores the proper indentation. This is absolutely bizarre. I don't want to delete the line, I want to put back the proper indentation.
- Moving to the second blank line then pressing backspace actually restores the proper indentation on the first blank line. I guess this is nice, in that it at least puts back the right location? But it seems to indicate to me that something is broken here rather than working as intended, because this is actually the opposite of what I would expect.
All of these methods work in VS, so I'm a little confused as to their absence here. They also do seem to work when you just hit enter, so there's not a clear delineation between whether the IDE is trying to handle the indentation or the user is supposed to, like you would see in a conventional text editor. There also seems to have been an implementation of a "preserve indentations on blank lines in the auto-formatter" feature in the other Jetbrains IDE's as a workaround to this. That would also be acceptable, but that too seems to have been deprioritized in Rider (or at least, I can't find the option).
Basically, I can't actually figure out how you're actually supposed to deal with blank lines in Rider? Maybe there are some options I can't find? I also can't find any relevant Rider issues beyond the workaround I mentioned above, which makes me feel like I must be missing something?
Please sign in to leave a comment.
Hi Morcam!
Sorry for the delay. You're right, there is no way, for now, to keep indents on empty lines. We have a feature request for this in our tracker: RSRP-466519. Please, feel free to follow it and upvote.
After code cleanup, all indents are removed for blank lines, so this is expected behaviour that cursor places to the beginning of the line. Please check that auto-format and smart indent options are enabled in `File | Settings | Editor | General | Typing Assistance`. This allows you to indent code in most of the cases.
Also, please check that `File | Settings | Editor | General => Virtual Space | Allow caret placement After the end of line` is enabled. This allows you to avoid the case with caret movement (point 3).
I hope this help! Please, let me know if I miss something.
help, 2023.3 still exist issue
Hi Qcbf!
Unfortunately, the feature has not been implemented yet. Feel free to upvote it to show your interest.
Issue still exists
Do I understand correctly, you are missing this feature for C++?
Have a nice day!