rm-comments

Remove Comments for VSCode

/_next/static/media/S-1771615275010.0jv68yvh3a-1w.png

Remove Comments removes all comments from the current selection(s) or the whole document.

It is a fork of rioj7/remove-comments, rewritten in TypeScript with a class-based structure for language definitions and a unit test suite.

What it does

  • Removes single-line and multi-line comments in 60+ languages.
  • Leaves strings untouched, and removes the empty line and leading whitespace a comment leaves behind.
  • Keeps #! first lines and editor encoding lines such as # -*- coding: utf-8 -*-.
  • Can keep comments that match your own regular expressions, for example #region markers or TODO notes, through the rm-comments.keep setting.
  • Handles mixed files: CSS and JavaScript inside HTML, <?php ?> blocks in PHP, and each section of a Vue single-file component.
  • Can extract all strings in the current file to a separate file.

Usage

  • Open the command palette (Ctrl+Shift+P) and run a command such as Comments: Remove All Comments, Comments: Remove All Single Line Comments, or Comments: Remove All Multiline Comments.
  • Use Comments: Remove All Comments that have a user entered prefix to remove only comments that start with a given prefix.