CodeSweep is a lightweight, open-source VS Code extension that helps you clean your code by removing all comments and debug logs in one click.
Perfect for preparing production-ready code or cleaning up before sharing with teammates.
- ποΈ Remove all single-line comments (
//,#,--,;, etc.) - π§Ό Remove all multi-line comments (
/* ... */,<!-- ... -->, etc.) - π Clean up debug statements like
console.log,print(),System.out.println, etc. - π Supports 30+ popular languages (JavaScript, HTML, Python, PHP, C++, etc.)
- β‘ Simple, fast, and effective
- Open the VS Code Marketplace
- Click Install
Or install via the VS Code command palette:
- Open any code file
- Press
Ctrl+Shift+PorCmd+Shift+Pon Mac - Type and run:
CodeSweep: Clean Code - π₯ Done! Comments and debug logs are gone
You can also run CodeSweep commands directly from the right-click menu inside your code editor.
- Open a supported code file (e.g.,
.js,.py,.java,.html, etc.) - Right-click anywhere in the editor
- Select one of the CodeSweep commands, like:
- CodeSweep: Clean Code
- CodeSweep: Remove All Comments
- CodeSweep: Remove Single Line Comments
- CodeSweep: Remove Multiline Comments
- CodeSweep: Remove Debug Logs
This offers a quick and convenient way to clean your code without using the Command Palette.
CodeSweep offers 4 useful commands. You can access them all via the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac).
codesweep.cleanCodeβ Recommended Command β Runs a full cleanup of your code.
This command executes:
- Remove Multiline Comments
- Remove Debug Logs
Ideal before pushing to production or sharing your code.
codesweep.removeAllCommentsβ Removes all single-line and multi-line comments from the entire file.
Examples removed:
// This comment is gone
/* This too */
/*
Multi-line
block removed
*/
<!-- This in HTML is also removed -->codesweep.removeSingleLineCommentsβ Only removes single-line comments, preserving multiline ones.
Examples removed:
# A Python comment
// A JS comment
-- A SQL commentcodesweep.removeMultilineCommentsβ Removes only multi-line comments, useful when you want to preserve inline hints.
Examples removed:
/*
This block is gone
*/
// This one stays<!-- HTML-style comments are removed -->codesweep.removeDebugLogsβ Detects and removes debug logs like:
console.log("Hello")
print("Debug")
System.out.println("Trace")
debugger;And many more, depending on language.
Helps prevent accidental debug logs in production code.
Includes but not limited to:
- JavaScript, TypeScript, HTML, CSS
- Python, PHP, Ruby, Go, Rust, C/C++, Java
- Bash, PowerShell, Shell, YAML, JSONC, XML, etc.
Because no one wants to ship console.log("hello") or outdated comments to production π
CodeSweep helps keep your codebase clean, professional, and production-ready.
Contributions are now open!
- π Please read our Contribution Guide
- π Found a bug or have a suggestion? Open an issue Thank you for helping make CodeSweep better! π
MIT License β free to use, modify, and distribute.
Open an issue here π GitHub Issues
