This extension provides a powerful, single-command utility to aggressively remove single-line and multi-line comments from your active file, followed by blank line cleanup. The idea is to reduce the time we spend saying, "Hey AI get rid of these comments", because this is way more efficient. I wrote an article about it here.
- Fast and Local: Comment Annihilator 3000 uses fast regex logic to find and remove comments across the entire document.
- Aggressive Removal: Comments are replaced with an empty string.
- Blank Line Cleanup: After comment removal, all occurrences of two or more consecutive blank lines are condensed down to one, and any blank lines at the start of the file are removed.
| Language | Single-Line Supported | Multi-Line Supported | Notes |
|---|---|---|---|
| JavaScript | ✅ | ✅ | Expects multiline comments to be terminated. Might break URL strings. |
| TypeScript | ✅ | ✅ | Expects multiline comments to be terminated. Might break URL strings. |
| C# | ✅ | ✅ | Expects multiline comments to be terminated. Might break URL strings. |
| Python | ✅ | ✅ | Expects multiline comments to be terminated. |
| HTML | ❌ | ❌ | Not supported, Coming soon |
| React | ✅ / ❌ | ✅ / ❌ | Untested, coming soon |
| Vue | ✅ / ❌ | ✅ / ❌ | Untested, coming soon |
- Open the file you wish to clean.
- Open the Command Palette (
Ctrl+Shift+PorCmd+Shift+P). - Search for:
Annihilate Comments - Execute the command. Your file is instantly cleaned!
- Pro tip: if you use the command a lot, it's as fast as
Ctrl+Shift+P+Enteras your most-used commands are automaticall suggested by VS Code.
- Multiline Comment Formatting: Expects your multiline comments to be formatted properly. If you have an unterminated
/*(or""") in a file, you might get wonky results when running this. - String wierdness: There's bound to be edge cases with URL strings, etc. Feel free to open a PR or email me if you find a bug!
- https://regexr.com/ was super helpful for working on the logic for this thing
- Docs here
- Install these:
npm install --global yo generator-code - Run
yo code(this is not a salutation to the editor, it's a scaffold command) - Go through the startup wizard to init a project
- Inside the editor, open
src/extension.tsand press F5 or run the command Debug: Start Debugging from the Command Palette
- Get an Azure DevOps organization set up if not already done. Get a personal access token. Info here
$ npm install -g vsce$ vsce login <Publisher Name>--> enter token (publisher name is in the package.json, note that there is a human-readable version, and a machine version).- To publish again change version number in package.json and let 'er rip with
$ vsce publish
