How to remove duplicate lines in VS Code

  1. In your desired file press cmd + f
  2. In the search bar type: ^(.*)(\n\1)+$ then press the little downwards arrow and in the replace input field type: $1

(Make sure you have the regex option selected in the find and replace popup)

3. Press the “Replace all” button

There you go! You should have all duplicates removed now!