Skip Navigation

Extension to highlight console.log lines then allow delete?

There are a number VS Code extensions that can be used to delete all console lines in an open file. But is there an extension that will highlight all console.log lines as a check before deleting?

Yes I know that one can select "console.log" then use the Command-F2 key combination to select all occurences in the file. Assuming I want to delete them all, I could then use one of the above-mentioned extensions. 'Am hoping to find an extension that will do both.

1
1 comments
  • VSCode supports regex in find and replace (select the star icon when you open find)

    Then using this regex pattern will find all occurrences of

     console.log(anything);
    

    Pattern

     console\.log\(.+\);
    

    You can then just do a replace with nothing, and it’ll remove them all. Not exactly what you wanted (an extension) but this works with a clean vscode install out of the box