Visual Studio extension for remove empty lines (more than one consecutive empty line)
How to use it ?
Once the extension is installed, a "Remove empty lines" option is available when right clicking in a file.
If there is some selected text, the selection will be the only part of the document that will be processed.
There is now an option in Visual Studio for auto-reformat the code:
you can fint it in Tools => Options => EmptyLine Extension
With the version 1.1.0, you can edit the number of allowed lines, for that go on "Tools => Options => EmptyLine Extension", and edit the option "Allowed lines", by default there is no values, in this case, 1 line is kept, if you didn't want any line, then set value to 0. All numbers are allowed for this option.
Delete at start file
Since version 1.3.1, an option is avaiable for delete, in all cases, all the empty line at the start of the file.
Since version 1.3.0, you can now add some specific rules in regex. The regex will be apply to the file full path (path and file name).
See below an exemple who will manage all the json file, and set the number of tolerated line to 0:
you can add multiples rules, and manage them as you want.
The extension is only available Visual Studio 2017, 2019, 2022.