Haoest
Haoest

Reputation: 13916

how do i turn off auto-insert of newline after code block?

I might have some degree of OCD, maybe that's why it bothers me when I close a line with ';' below a while{} for{} or other code block and resharper would automatically insert a line break above my line.

I DO NOT want an extra line.

I looked through the Editing option page under braces and new lines, but nothing seems to jump out.

sample:

if (true){
   GC.Collect();
}
string s = "Any statement here, ending the line with ';' causes newline above";

Upvotes: 1

Views: 1122

Answers (2)

Piers Myers
Piers Myers

Reputation: 10917

In ReSharper options: Code Editing->C#->Formating Style->Blank Lines - set After statements with child blocks to 0.

enter image description here

Upvotes: 2

gunr2171
gunr2171

Reputation: 17579

Visual Studio (2019) has these formatting settings. I'm assuming you're using VS and resharper isn't doing the formatting.

Tools > Options > Text Editor > C# > Code Style > Formatting > New Line

Find "Place open brace on new line for control blocks". There are a bunch others there as well.

Upvotes: 3

Related Questions