[Rider] [Code Style] Make so that separate fields on one line don't split up and fields get aligned by the longest attribute
Hi everyone. Can I setup my C# Code Style so that:
1. Separate fields on one line don't split up?
Now my Rider behavior is like this:
This code
```csharp
public int abc; private float def;
```
After reformat is converted to this:
```csharp
public int abc;
private float def;
```
I want them to stay on one line. I didn't find anything mentioning fields in Line Breaks and Wrapping section at all.
2. Fields get aligned by the longest attribute?
I've set up so that Rider doesn't change attribute wrapping at all.
I prefer to keep attributes on the same line as the field.
So if I have
```csharp
[SomeAttr("Some string in that attr")] public int fieldOne;
[SomeAttr("Some other string in that attr")] private float someOtherFieldTwo;
[SomeAttr("Hello world")] protected SomeClassName fieldThree;
```
After format it converts to this:
```csharp
[SomeAttr("Some string in that attr")] public int fieldOne;
[SomeAttr("Some other string in that attr")] private float someOtherFieldTwo;
[SomeAttr("Hello world")] protected SomeClassName fieldThree;
```
So it is only aligned by the attribute and not by anything else (like visibility modifier, type or name).
Is it even possible?
Please sign in to leave a comment.
Rider support forum can be found at https://rider-support.jetbrains.com/hc/en-us .
This forum is for IntelliJ IDEA product.
Hello, there.
To solve described cases related to line breaks and alignment fields with attributes, please try the following:
Note. Rider doesn’t have a separate setting to place fields on the same line. Therefore, please be aware that if you disable “Reformat code” it will not be applied at all.
I hope this could help. If you have any questions, please let me know.
Best regards,
Maxim Isaev.