Resharper: remove blank line before brackets

In Resharper 9.2 and Visual Studio 14 (2015), I would like to remove the empty line before the opening bracket in the cleanup code (Ctrl + E, Ctrl + C). I can not find the settings for this. Here is a sample code.

What I have:

namespace TestApp.Test { public class Program { private string _foo; private string _bar; public string Qux { get; set; } private Program() { } } } 

What I want:

 namespace TestApp.Test { public class Program { private string _foo; private string _bar; public string Qux { get; set; } private Program() { } } } 

The options "Delete empty lines after" {"and before"} "in the ad" and "Delete empty lines after" {"and before"} "in the code" do not work for this problem.

When I set the "Keep max blank lines in declarations" option to "0", the empty line is deleted, as well as all empty lines between fields and properties. Therefore, I would like to keep it at "1".

What I do not want:

 namespace TestApp.Test { public class Program { private string _foo; private string _bar; public string Qux { get; set; } private Program() { } } } 
+7
c # visual-studio-2015 resharper
source share
2 answers
  • Go to Resharper-> Options-> Code Editing-> C # → Formatting Style-> Empty Strings
  • Set 'Keep max blank lines in declarations' to '0'
  • Set "In one line field" to "1"
  • Enjoy
+1
source share

This issue also affects me, what I do to get around this is to first search for and replace a simple regular expression, and then clean up the ReSharper code.

Find

 (\r?\n)(\r?\n)*(?([^\r\n])\s)*([{]) 

Replace

 $2$3 

This is actually not an answer, I would put it in a comment, but SO does not allow me to comment. Therefore, I fully expect this to be flagged and deleted. I hope you will see this first, because I will really like your feedback when you find a real solution!

0
source share

All Articles