I spent some time trying to figure out how to delete all blank lines in Visual Studio Code and I can\'t get it working. Anybody knows how to do it please?
If I search fo
Visual Studio Code 1.13.0 Linux Lite:
Empty lines gone!
What also works is this regex pattern:
^\s*$\n
Then CTRL+Enter to replace all lines.
Explanation of the above pattern:
-----------------------------------------------
| ^ | beginning of string anchor |
-----------------------------------------------
| \s | any whitespace character |
-----------------------------------------------
| '*'| zero or more repetitions |
-----------------------------------------------
| $ | end of string anchor |
-----------------------------------------------
| \n | new line |
-----------------------------------------------
Try using ^\s*\n in the Replace dialog of VS Code -
Code Maid Extension is all you need. You can use shortcut Ctrl M + Space bar to Cleanup your file, It will remove empty lines and format your code. You also can configure about format and cleanup rule. Hope this useful.
I found the following works best for me in Visual Studio:
Replace:
^\n$
With:
<no value here>
This will find all empty lines and clear them out.
Replace: ^\n$ With: "blank space"