Overview
Comment Cleaner Pro is a powerful VS Code extension for removing comments from source code files. It helps you streamline your code by efficiently removing all types of comments (line, block, and documentation) across 25+ programming languages while preserving the core functionality of your code.
Features
- ✅ Removes all comment types (line, block, documentation, TODO/FIXME, and AI-generated) while preserving code functionality
- ✅ Preserves meaningful comments for better readability
- ✅ One-click cleanup with an easy-to-use command
- ✅ Supports multiple programming languages
- ✅ Automatic backups create safety files before removing comments
- ✅ Detailed statistics track the number of comments and lines removed
- ✅ Undo/Redo support to easily revert or restore changes
- ✅ Configuration consistency across all entry points
Key Features
Comprehensive Language Support
- 20+ Programming Languages - Supports all major languages including Python, JavaScript (including JSX), TypeScript (including TSX), HTML, CSS, C/C++, Java, Ruby, Go, PHP, SQL, Swift, Rust, Kotlin, and more
- Intelligent Comment Detection - Accurately identifies and removes all comment types specific to each language
- Preservation of Code Structure - Maintains code indentation and formatting while removing comments
Flexible Processing Options
- Single File Processing - Clean comments from the current file with a single click
- Batch Processing - Process multiple files simultaneously using glob patterns
- Automatic Backups - Create safety backups before removing comments
- Customizable Rules - Configure how unknown file types and special comments are handled
- Configuration Persistence - Settings in the UI panel now properly apply to all operations
- Clear Configuration Dialogs - Intuitive options when using context menu commands
- Undo/Redo Support - Easily revert or reapply changes with dedicated undo/redo buttons
Enhanced User Experience
- Modern UI Controls - Circular checkboxes with green indicators for selected options
- Unlimited History - Track all cleaned files without arbitrary limits
- Individual File Management - Remove specific files from history as needed
- Responsive Design - UI elements maintain their shape and clarity at all window sizes
Detailed Statistics
- Comment Count - Track the number of comments removed per file
- Line Reduction - See exactly how many lines were removed
- File Size Impact - Measure the size reduction achieved
- Accurate Tracking - Now with improved accuracy in statistics tracking
Currently Supports
Category |
Languages |
Web Development |
 |
Systems Programming |
 |
Enterprise |
 |
Scripting |
 |
Data & Analysis |
 |
Mobile Development |
 |
Functional |
 |
Support for other languages is coming soon. Stay tuned!
Installation
- Open VS Code
- Go to Extensions view (Ctrl+Shift+X)
- Search for "Comment Cleaner Pro"
- Click Install
Requirements:
- Visual Studio Code 1.50.0 or higher
- Python 3.6 or higher
Usage Guide
Method 1: Clean Current File
- Open a source code file in the editor
- Right-click anywhere in the editor
- Select "Comment Cleaner Pro: Clean Current File"
- Configure your cleaning options:
- Choose whether to create a backup
- Select if TODO & FIXME comments should be preserved
- Decide whether to keep documentation comments
- Determine if unknown file types should be processed
- The editor will refresh automatically with comments removed according to your settings
Method 2: Command Palette
- Press
Ctrl+Shift+P
(Windows/Linux) or Cmd+Shift+P
(Mac)
- Type "Comment Cleaner Pro"
- Select "Comment Cleaner Pro: Clean Current File" or "Comment Cleaner Pro: Clean Multiple Files"
- Follow the prompts to configure options
Method 3: Activity Bar Integration
- Click the Comment Cleaner Pro icon in the Activity Bar
- Choose "Clean Current File" or "Clean Multiple Files"
- View your recently cleaned files in the "Cleaned Files" section
- Use Undo/Redo buttons to revert or restore changes as needed
Batch Processing Options
When cleaning multiple files:
- Enter a glob pattern to match files (e.g.,
*.js
, src/**/*.py
)
- Choose whether to create backups
- Decide if unknown file types should be processed
- Monitor progress in the notification area
Command-Line Usage
The extension includes a standalone Python script that can be used directly:
# Basic usage
python path/to/ccp.py "*.js"
# Process files recursively
python path/to/ccp.py "src/**/*.py" --recursive
# Preserve documentation comments
python path/to/ccp.py "*.java" --keep-doc-comments
# Preserve TODO comments
python path/to/ccp.py "*.cpp" --preserve-todo
# Don't create backups
python path/to/ccp.py "*.html" --no-backup
# Force processing of unknown file types
python path/to/ccp.py "*.custom" --force
Technical Details
Comment Cleaner Pro uses a sophisticated object-oriented architecture with dedicated language handlers to identify and remove comments while preserving code structure. The extension:
- Handles nested comment structures
- Preserves important comments like license headers when configured
- Detects and properly processes character escapes in strings
- Maintains code indentation and whitespace
- Provides accurate line count reduction statistics
- For very large files (10MB+), expect processing to take a few seconds
- Batch processing uses multi-threading for better performance
- Uses memory-efficient processing techniques for large files
FAQ
Yes, but you can enable backups which create .bak files before processing.
Yes, you can use the dedicated Undo button in the sidebar, use standard VS Code undo operations, or restore from the .bak backup files if you enabled backups.
Does it work with all programming languages?
It supports 20+ major languages. For unlisted languages, you can try the "force" option, but results may vary.
Does it work with embedded code like JavaScript in HTML files?
No, the current version only processes comments based on the file extension. JavaScript or CSS comments within HTML files will not be removed. We're actively working on adding support for embedded languages in a future release.
Privacy & Security
Comment Cleaner Pro:
- Processes all files locally on your machine
- Does not send any code or data externally
- Requires no authentication or online services
- Has minimal extension permissions
Author
Thank you for using Comment Cleaner Pro!