Skip to content

christliebdela/Comment-Cleaner-VsCode-Ext

Repository files navigation

Comment Cleaner Pro

Comment Cleaner Pro Logo

VS Marketplace Version VS Marketplace Downloads Open VSX Version Open VSX Downloads Issues Pull Requests License

Video Demo

Coming Soon

Overview

Comment Cleaner Pro is a powerful extension for removing comments from source code files. Built for VS Code, Antigravity, VSCodium, and other compatible IDEs, it helps you streamline your code by efficiently removing all types of comments (line, block, and documentation) across 33 supported 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
  • Dry-run Confirmation Modal to review exact stats (affected files, comments, lines, bytes) before cleaning folders or batches
  • Persistent History preserves your cleaned files list across workspace sessions
  • Workspace-Local Backups safely stored in .ccp-backups/ under the workspace root
  • .ccpignore Support to skip files matching custom rules or defaults (like node_modules, .git)
  • High-Performance Python Core runs batch operations in a single invocation with parallel worker threads
  • Detailed statistics track comments, line reduction, and size impact
  • Undo/Redo support to easily revert or restore changes

Key Features

Comprehensive Language Support

  • 30+ Programming Languages - Supports all major languages including Python, JavaScript/JSX, TypeScript/TSX, Vue SFC, Svelte, HTML, CSS, SCSS, C/C++, Java, Ruby, Go, PHP, SQL, Swift, Rust, Kotlin, Dockerfile, TOML, GraphQL, HCL/Terraform, MDX, and more
  • Intelligent Comment Detection - Accurately identifies and removes all comment types specific to each language (including JSX/HTML comments in Vue, Svelte, MDX, and script/style block comments)

Flexible Processing Options

  • Single File Processing - Clean comments from the current active editor file
  • Batch Processing - Search and select multiple files visually using a checkbox Quick Pick checklist
  • Automatic Backups - Create safety backups inside the .ccp-backups/ directory before processing
  • Customizable Options - Adjust TODO, documentation, and unknown file processing preferences in a unified dialog
  • Undo/Redo Support - Fully supports standard VS Code Undo/Redo operations in the active editor

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 JavaScript TypeScript Vue Svelte HTML5 CSS3 SCSS PHP
Systems & General C C++ Rust Go Java C# Kotlin Swift Dart Haskell
DevOps & Configs Dockerfile Terraform YAML TOML
Scripting Python Ruby Perl Bash Lua PowerShell
Data & Queries SQL GraphQL R MATLAB MDX

Support for other languages is continuously expanding!

Installation

Comment Cleaner Pro is published on both the official VS Code Marketplace and the Open VSX Registry, making it fully compatible with VS Code, Antigravity, VSCodium, Gitpod, Eclipse Theia, and any other IDE supporting VS Code extensions.

  1. Open your IDE's Extensions view (Ctrl+Shift+X or Cmd+Shift+X)
  2. Search for "Comment Cleaner Pro"
  3. Click Install

Requirements:

  • VS Code compatible IDE (v1.50.0 or higher)
  • Python 3.6 or higher (available in system PATH)

Usage Guide

Method 1: Context Menus (Right-Click)

  • Clean Current File: Right-click anywhere inside an active editor file (or right-click the file in the Explorer tree) and choose CCP - Clean Current File.
  • Clean Folder: Right-click any folder inside the Explorer tree and select CCP - Clean Folder to process all matching files under that directory.
  • Clean Entire Workspace: Right-click your workspace root directory in the Explorer tree and select CCP - Clean Entire Workspace.

Method 2: Command Palette

  1. Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac)
  2. Type "Comment Cleaner Pro" or "CCP"
  3. Select any of the cleaning actions:
    • Comment Cleaner Pro: Clean Current File
    • Comment Cleaner Pro: Clean Multiple Files
    • Comment Cleaner Pro: Clean Entire Workspace
  4. Configure options in the checklist dropdown and press Enter to run.

Method 3: Activity Bar Integration

  1. Click the Comment Cleaner Pro icon in the Activity Bar to open the Side Bar
  2. Choose "Clean Current File", "Clean Multiple Files", or "Clean Workspace"
  3. View your recently cleaned files in the "Cleaned Files" history section
  4. Revert or restore changes using VS Code's standard Undo/Redo commands (Ctrl+Z / Ctrl+Y)

Batch Processing Options

When cleaning multiple files:

  1. Search and select files using the multi-select checklist dialog
  2. Check/uncheck files in the list; selected items will float to the top
  3. Press Enter to confirm file selection
  4. Configure your cleaning options in the Quick Pick checkbox dialog
  5. Review the changes in the Proceed / Cancel warning modal

Command-Line Usage

The extension includes a standalone Python script that can be used directly:

# Basic usage
python path/to/ccp.py "*.js"

# Process directory recursively (searches for all supported languages)
python path/to/ccp.py src/

# Process files recursively using a glob pattern
python path/to/ccp.py "src/**/*.py"

# 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

Performance Considerations

  • 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

Does Comment Cleaner Pro modify my original files?

Yes, but you can enable backups which create .bak files before processing.

Can I undo the comment removal?

Yes. You can use standard editor undo/redo operations (Ctrl+Z / Ctrl+Y or Cmd+Z / Cmd+Y) directly in your active editor tabs, or restore files from the .ccp-backups/ backup directory if you enabled backups during execution.

Does it work with all programming languages?

It supports 33 major languages. For unlisted languages, you can try the "process unknown files" configuration option, but results may vary.

Does it work with embedded code like JavaScript in HTML files?

Yes, for Single File Components (SFC) like Vue (.vue) and Svelte (.svelte). The engine uses a block-aware parser to clean HTML comments in <template>, JavaScript/TypeScript comments in <script>, and CSS/SCSS comments in <style>.

For standard HTML files (.html, .htm), only HTML comments (<!-- -->) are stripped in this version, and embedded <script> or <style> blocks are not parsed. Full support for raw HTML embedded tags is planned for 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

Project Information

This project is licensed under the GNU General Public License v3.0 - a copyleft license that ensures derivative works remain open source.

Key points:

  • You are free to use, modify, and distribute this software
  • If you distribute modified versions, you must:
    • Make your changes open source under GPL v3
    • Clearly mark what changes you've made
    • Keep all copyright notices intact
    • Include the original license

This ensures that Comment Cleaner Pro and all derivatives remain open source, benefiting the entire community. See the LICENSE file for full details.

Author

Created by Christlieb Dela

Thank you for using Comment Cleaner Pro!

About

Streamline your code by effortlessly removing comments across 20+ programming languages. Improve readability, reduce file size, and prepare code for production with powerful cleaning options and detailed statistics.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors