Code Reformat Unexpectedly Removes Blank Lines

I have a chunk of code:

namespace Largest {


public class LargestTest {


public void findLargestReturnsLargestIntegerFromPresortedList() {
Assert.AreEqual(9, Largest.findLargest(new int[] {3, 6, 9}));
Assert.AreEqual(5, Largest.findLargest(new int[] {2, 3, 5}));
}
}
}

When I run the reformat, I get:

namespace Largest {

public class LargestTest {

public void findLargestReturnsLargestIntegerFromPresortedList() {
Assert.AreEqual(9, Largest.findLargest(new int[] {3, 6, 9}));
Assert.AreEqual(5, Largest.findLargest(new int[] {2, 3, 5}));
}
}
}

Under ReSharper Options, Code Style, Blank Lines, Preserve Existing
Formatting, I have both the Keep max blank lines... set to 1. I also have
1 around namespace (and most other things).

In IDEA, these settings preserve the blank lines, but ReSharper seems to
behave differently. How do I keep the blank lines after the namespace and
class declarations?

Thanks,
Paul

1 comment
Comment actions Permalink

Hi Paul,

Code Formatter currently removes all blank lines at the beginning (and at
the end) of the namespace, class, method, etc. regardless of the options. I
think we will add separate option to control the blank lines in such cases,
but currently blank lines are preserved between declarations only.

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Paul Hodgetts" <phodgetts@agilelogic.com> wrote in message
news:4n61g09mmcqkmeij5h63bnjmcuf7urt5pk@4ax.com...

I have a chunk of code:

>

namespace Largest {

>


public class LargestTest {

>


public void findLargestReturnsLargestIntegerFromPresortedList() {
Assert.AreEqual(9, Largest.findLargest(new int[] {3, 6, 9}));
Assert.AreEqual(5, Largest.findLargest(new int[] {2, 3, 5}));
}
}
}

>

When I run the reformat, I get:

>

namespace Largest {

public class LargestTest {

public void findLargestReturnsLargestIntegerFromPresortedList() {
Assert.AreEqual(9, Largest.findLargest(new int[] {3, 6, 9}));
Assert.AreEqual(5, Largest.findLargest(new int[] {2, 3, 5}));
}
}
}

>

Under ReSharper Options, Code Style, Blank Lines, Preserve Existing
Formatting, I have both the Keep max blank lines... set to 1. I also have
1 around namespace (and most other things).

>

In IDEA, these settings preserve the blank lines, but ReSharper seems to
behave differently. How do I keep the blank lines after the namespace and
class declarations?

>

Thanks,
Paul

>


0

Please sign in to leave a comment.