Remove space before "else"
Hey!
I have been trying to get rid of the space before “else” code for the longest time without any luck, i have been going through every option in the code style configuration on this particular line but none of them get rid of adding a space after the closing bracket.
Any help is much appreciated!
Thanks!
Please sign in to leave a comment.
Hi, I double-checked all the code style rules. Currently, we don't have rules for controlling spaces around “else” keywords in C#.
I created a new feature request on our bug tracker for this matter.
RSRP-497315 Missing code style configurations for spaces around the "else" statement in C#
Would appreciate it if you upvote the request to demonstrate additional interest for this feature.
I think that could be the problem-there is no configuration for controlling the spaces around “else”, but the formatter will always add spaces, not ignoring the current formatting. I modify the ticket as a new bug ticket.
The only way to disable code reformatting is using the comments in Settings | Editor | Code Style | Formatter. But if you don't want to add additional comments in your files, Rider can only follow the default formatting—add spaces around the “else” keyword.
How do you achieve the formatting in your solution previously? Rider supports
.editorconfig
so you can try to export the code format settings from other editors, save the settings as an EditorConfig file and use them in Rider.