DEV Community

Cover image for How to remove empty lines in Visual Studio Code?
Dhairya Shah
Dhairya Shah

Posted on • Originally published at codewithsnowbit.hashnode.dev

How to remove empty lines in Visual Studio Code?

In this article, I will teach you how to remove extra empty lines of your code in Visual Studio Code.

I had a long json file with lots of extra white spaces in it and I wanted to remove all the whitespace from the json file. So, I searched a bit on the internet and found a cool trick to remove all the whitespace from your code.

So, to remove all the whitespace you need to find \n\n+ and run replace all to replace it with \n and you removed all of the whitespaces in the file.

replace whitespace

Note: Make sure to select the Use Regular Expression option

regex_option select

Let's Connect

Oldest comments (0)