Code formatting question

Hello,

 

we were just trying to wrap our head around the code alignment settings.

We found settings to align assignments and names etc, so it looks like this:

bool test   = false;
int  number = 1;
number += 2;
test   =  true;

The types are aligned, the names are aligned and the assignments are aligned. But it differentiates between variable declaration and simple assignment.

 

We would really love it if it would look like this:

bool test   = false;
int number  = 1;
number      = 2;
test       += true;

Or even this would be fine:

bool test   = false;
int number  = 1;
number      = 2;
test        += true;

 

Basically it should just align the assignment operators in directly following lines and not care about the rest. Is there any way to achieve this formatting?

Thanks!

1
3 comments

Hi,

Rider has no option to align declarations and assignments into a single group. 

In Settings | Editor | Code Style | C# | Tabs, Indents, Alignment | Align similar code in columns, two separate options control them: Variables and local constants and Other assignments and initializers. Each option aligns only its own kind of statement, so a declaration and the assignment on the next line do not share a column. I checked this against the Rider 2026.2 documentation, which lists no option that merges the two groups.
I have registered a feature request for this RSRP-504945 Align similar code in columns: align adjacent declarations and assignments as one group. 

You are welcome to subscribe and receive all updates concerning this request.

1

Oh wow, thank you for the quick response and the feature request!

0

Please sign in to leave a comment.