Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Easy Code CleanerNew to Visual Studio Code? Get it now.
Easy Code Cleaner

Easy Code Cleaner

Emirhan Arslan

|
4 installs
| (1) | Free
VS Code extension that removes comments, emojis, blank lines and more from your code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Easy Code Cleaner - VS Code Extension

Clean your code instantly: Remove comments, emojis, blank lines, console logs, and try-catch blocks from your codebase

VS Code Marketplace License: MIT GitHub

Overview

Easy Code Cleaner is a powerful and versatile VS Code extension designed to clean your source code by removing unnecessary elements. It supports 15+ programming languages including JavaScript, TypeScript, Python, Java, C++, Go, Rust, PHP, and more.

Perfect for:

  • 🧹 Code cleanup before sharing or production
  • 📉 Reducing code size and file bloat
  • 🎯 Removing debug code and temporary content
  • 📊 Code analysis and statistics

Features

📊 Code Statistics & Analysis

  • Project-wide analysis: Total files, lines, and character count
  • File type distribution: Detailed statistics by language
  • Largest files: Sorted by line count
  • Code composition: Code, comment, and blank line ratios
  • Visual charts: Color-coded progress bars and composition view
  • Smart detection: Identify comments, emojis, and blank lines at a glance

🧹 Comment Removal

Supports multiple syntax styles across 15+ languages:

  • JavaScript/TypeScript: // and /* */ (including template literals)
  • Python/Ruby/Shell: #
  • HTML/XML: <!-- -->
  • CSS/SCSS/LESS: /* */
  • Java/C/C++/C#/Go/Rust/Swift/Kotlin: // and /* */
  • SQL: -- and /* */
  • Lua: -- and --[[ ]]
  • PHP: All styles combined
  • String Protection: Preserves comments within string literals and quotes

😊 Emoji Removal

  • Removes all Unicode emoji characters
  • Works with any file type
  • Preserves text content

📄 Blank Line Management

  • Remove All Blank Lines: Completely eliminate all empty lines
  • Remove Excess Blank Lines: Reduce multiple consecutive blank lines to single gaps
  • Preserve Code Readability: Optional settings to maintain formatting
  • Smart Trimming: Remove leading/trailing blank lines

🚀 Advanced Cleaning

  • Remove Console Statements: Strip console.log, print, and debug statements
  • Remove Try-Catch Blocks: Eliminate error handling wrappers (with care)
  • Batch Processing: Clean entire directories or workspaces at once

📁 Flexible File Selection

  • Entire Workspace: Clean all files in your project
  • Specific Folder: Target only selected directories
  • File Extensions: Filter by language (.js, .py, .java, etc.)
  • Manual Selection: Hand-pick specific files
  • Predefined Groups: Quick select for popular language combinations

Installation

From VS Code Marketplace

  1. Open VS Code
  2. Press Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (macOS) to open Extensions
  3. Search for "Easy Code Cleaner"
  4. Click "Install"

Manual Installation

# Clone the repository
git clone https://github.com/emirhanarslan/code-cleaner.git

# Install dependencies
npm install

# Compile TypeScript
npm run compile

# Test (press F5 or run)
npm run test

Usage

Method 1: Status Bar Button (Recommended) ⭐

  1. Click the "✨ Code Cleaner" button in VS Code's bottom status bar
  2. Select your desired cleaning operation from the menu
  3. Choose file selection method (workspace, folder, extension, or manual)
  4. Wait for the operation to complete
  5. Review the cleaning report

Method 2: Command Palette

Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS) and select:

  • Code Cleaner: Code Statistics - Show project analysis and file composition
  • Code Cleaner: Remove Comments - Delete comments only
  • Code Cleaner: Remove Emojis - Delete emoji characters only
  • Code Cleaner: Remove Blank Lines - Remove all empty lines
  • Code Cleaner: Remove Excess Blank Lines - Reduce multiple empty lines to single
  • Code Cleaner: Remove Comments and Emojis - Combined comments + emoji removal
  • Code Cleaner: Remove All - Complete cleanup (comments + emojis + blank lines)
  • Code Cleaner: Remove Console/Print Statements - Strip debug logging
  • Code Cleaner: Remove Try-Catch Blocks - Eliminate error handlers
  • Code Cleaner: Show Statistics - Display project statistics
  • Code Cleaner: Show All Projects Statistics - Compare across projects
  • Code Cleaner: Clear Project Statistics - Reset history

Supported Languages & File Types

Language Extensions Status
JavaScript .js, .jsx ✅ Full Support
TypeScript .ts, .tsx ✅ Full Support
Python .py ✅ Full Support
Java .java ✅ Full Support
C/C++ .c, .cpp, .h, .hpp ✅ Full Support
C# .cs ✅ Full Support
Go .go ✅ Full Support
Rust .rs ✅ Full Support
PHP .php ✅ Full Support
Ruby .rb ✅ Full Support
Swift .swift ✅ Full Support
Kotlin .kt ✅ Full Support
Dart .dart ✅ Full Support
HTML .html ✅ Full Support
CSS/SCSS/SASS/LESS .css, .scss, .sass, .less ✅ Full Support
SQL .sql ✅ Full Support
Lua .lua ✅ Full Support

Examples

Before & After

Before (247 lines, 5.2 KB)

// This is a comment
function calculateSum(arr) {
  // TODO: Add error handling
  console.log('Starting calculation'); // Debug log

  // Loop through array
  let sum = 0;
  for (let i = 0; i < arr.length; i++) {
    sum += arr[i]; // Add current value
  }

  return sum; // Return the result
}

After (239 lines, 3.8 KB)

function calculateSum(arr) {
  let sum = 0;
  for (let i = 0; i < arr.length; i++) {
    sum += arr[i];
  }
  return sum;
}

Statistics:

  • Lines removed: 8 (3.2% reduction)
  • Size reduction: 1.4 KB (26.9% smaller)
  • Comments removed: 5
  • Console logs removed: 1

Settings & Configuration

Keyboard Shortcuts

You can bind keyboard shortcuts to any command in VS Code settings:

{
  "key": "ctrl+k ctrl+c",
  "command": "code-cleaner.removeComments"
},
{
  "key": "ctrl+k ctrl+a",
  "command": "code-cleaner.removeAll"
}

Development

Project Structure

src/
├── extension.ts              # Main entry point
├── commentRemover.ts         # Comment removal logic
├── emojiRemover.ts           # Emoji removal logic
├── blankLineRemover.ts       # Blank line management
├── consoleRemover.ts         # Console statement removal
├── tryCatchRemover.ts        # Try-catch block removal
├── fileSelector.ts           # File selection UI
├── statisticsManager.ts      # Statistics tracking
└── statisticsViewer.ts       # Statistics display

Build & Test

# Install dependencies
npm install

# Compile TypeScript
npm run compile

# Watch mode (auto-compile on changes)
npm run watch

# Run linter
npm run lint

# Run tests
npm run test

# Prepare for publishing
npm run vscode:prepublish

Packaging & Publishing

# Install vsce globally
npm install -g @vscode/vsce

# Create package
vsce package

# Publish to marketplace (requires Personal Access Token)
vsce publish

# Or use commands
npm run vscode:prepublish
npx vsce publish patch

Important Notes & Warnings

⚠️ This operation is IRREVERSIBLE!

  • Backup your files before using this extension
  • Use Git - Commit your changes before cleaning so you can review the diff
  • Test on a branch - Test the extension on a feature branch first
  • Review changes - Always check the cleaning report
  • Edge cases - Some complex string patterns might be affected

Known Limitations

  • Template literals with comment-like patterns may be affected
  • Regex patterns containing comment syntax could be misinterpreted
  • Multi-line string handling in some edge cases
  • Very large files (>10MB) may cause memory issues
  • VS Code undo stack might be limited with batch processing

Performance Tips

  1. Use specific extensions instead of cleaning all files
  2. Process folders instead of entire workspaces for large projects
  3. Check project size before running on very large codebases
  4. Use Git to track changes and enable quick rollback

Contributing

We welcome contributions! Please feel free to submit pull requests or open issues on GitHub.

How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Changelog

v0.0.5

  • Added console/print statement removal
  • Added try-catch block removal
  • Improved emoji detection
  • Enhanced statistics reporting
  • Better error handling

v0.0.1

  • Initial release
  • Comment removal for 15+ languages
  • Emoji removal
  • Blank line management
  • Flexible file selection
  • Code statistics

License

MIT License - see LICENSE file for details

Support & Contact

  • Report Issues: GitHub Issues
  • Feature Requests: GitHub Discussions
  • Author: Emirhan Arslan

Related Resources

  • VS Code Extension API Documentation
  • VS Code Marketplace
  • TypeScript Documentation

Happy Coding! 🚀

Made with ❤️ for the developer community

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft