Adding blank line before the 'return' statement while using 'Extract method'
Hi,
I'm wondering to know if it exist an option to add a blank line before the 'return' statement while using the 'Extract method' refactoring feature.
For example, I have this method:
private int ExtractMethodWithNiceFormatting()
{
int a = 1;
int b = 1;
int c = 1;
int d = 2;
int total1 = a + b;
int total2 = c + d;
int grandTotal = total1 + total2;
return grandTotal;
}
And when I try to extract the total computing part, here is what I get:
private int ExtractMethodWithNiceFormatting()
{
int a = 1;
int b = 1;
int c = 1;
int d = 2;
var grandTotal = GetTotal(a, b, c, d);
return grandTotal;
}
private static int GetTotal(int a, int b, int c, int d)
{
int total1 = a + b;
int total2 = c + d;
int grandTotal = total1 + total2;
return grandTotal;
}
As you can see, there is no blank line before the statement 'return grandTotal'.
What I want is:
private static int GetTotal(int a, int b, int c, int d)
{
int total1 = a + b;
int total2 = c + d;
int grandTotal = total1 + total2;
return grandTotal;
}
Also, in some cases, resharper must add some new variables while extracting method and if it possible, it would be nice to have a blank line after these variables declaration.
Thank you very much.
Please sign in to leave a comment.
Hi Samuel,
There's no such formatting option in Resharper for now, so I've logged it as a feature request here in YouTrack: http://youtrack.jetbrains.com/issue/RSRP-337283.
Thank you.
Wow, Thank you Alex to defined the feature priority to 'Major' to the next release. Greatly appreciated!
You are welcome, Samuel!