How to remove the duplicate words in vs code

Issue

How can I remove all this code at once?

Solution

One of many ways would be to search and replace.
Highlight the parts you want to replace and press ctrl + H. A dialog will open in the top right corner of the editor looking like this replace dialog.

You can now replace all found occurrences with whatever you put in the Replace field by pressing this button or by hitting ctrl + alt + enter.


Another fast way would be to select all occurrences of the text in question by selecting it and hitting ctrl + Shift + L. This selects all occurences and puts a cursor at the end of all of them.
After that you just hit your favorite delete-button and all the occurrences are gone. You get rid of all the cursors by pressing the Esc key or clicking anywhere.

rioV8 first suggested this in a comment

Answered By – Dugnom

Answer Checked By – Katrina (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.