Reputation: 1686
I've recently started using VS2015 and Resharper 9. I encounter a weird formatting with the default configuration (it was ot present in VS2013/Resharper8) :
If I try to auto format this piece of code:
public int Id { get; set; }
public string Login { get; set; }
public string Password { get; set; }
It goes to:
public int Id
{
get; set;
}
public string Login
{
get; set;
}
public string Password
{
get; set;
}
But I want it to stay as it where (like in the previous version). I've tried to tick the "Place property/indexer/event declaration on single line" but it changed nothing.
Upvotes: 2
Views: 367
Reputation: 2517
So I agree with Karel Kral, in that it seems to be a Visual Studio setting, however the setting I believe is "Leave block on single line" which needs to be checked to stop this annoying behavior.
Tools > Options > Text Editor > C# > Formatting > Wrapping > "Leave block on single line"
Upvotes: 1
Reputation: 5486
It is VS 2015 itself, which does this reformat. After long investigating, I have found option that affects this beavior. "Leave statements and member declarations on the same line" must be checked
Upvotes: 0
Reputation: 13533
Try ticking "ReSharper | Options | Code Editing | C# | Formatting Style | Line Breaks and Wrapping | Place abstract/auto property/indexer/event declaration on single line" instead of "Place property/indexer/event declaration on single line"
Upvotes: 0