EmptyLine ExtensionVisual Studio extension for remove empty lines (more than one consecutive empty line) How to use it ?ManualOnce 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. AutomaticThere is now an option in Visual Studio for auto-reformat the code: you can fint it in Tools => Options => EmptyLine Extension ConfigurationsWith 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 fileSince version 1.3.1, an option is avaiable for delete, in all cases, all the empty line at the start of the file. RegexSince 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. PrerequisitesThe extension is only available Visual Studio 2017, 2019, 2022. |