Skip to main content

Command Palette

Search for a command to run...

How to remove empty lines in Visual Studio Code?

Published
•1 min read
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

More from this blog

D

Dhairya Shah

119 posts