codemaid
codemaid copied to clipboard
(Feature) Reorganizing: Add or preserve blank line before methods or ctor
Environment
- Visual Studio version: 2019 Community
- CodeMaid version: 11.2
- Code language: C#
Description
When reorganizing, I think it would be preferable if all methods and constructors in a class has a blank line above it.
Steps to recreate
Reorganize this code:
class Foobar
{
int b = 1;
int a = 0;
Foobar() { }
}
Current behavior
I get this:
class Foobar
{
int a = 0;
int b = 1;
Foobar() { }
}
Expected behavior
I think most developers would agree that for readability it would be better if all methods and constructors has an empty line above it. So IMO the reorganized code should look like this:
class Foobar
{
int a = 0;
int b = 1;
Foobar() { }
}
Thanks for the suggestion! An easy workaround is to run CodeMaid's cleanup after reorganization which will re-insert that desired blank line. Reorganization focuses on moving elements into the correct order but cleaning is what covers that other stage of inserting/removing preferred spacing. Hope it helps!