A Visual Studio Code extension that removes comments from your source code.
Supports line comments, block comments, and JSDoc comments across multiple languages.
Includes customization options for preserving important comments and advanced regex filtering.
✨ Features
Remove all comments at once
Remove only line comments
Remove only block comments
Remove JSDoc comments (/** ... */)
Remove comments matching regex patterns
Run automatically on save
Preserve shebang lines (e.g. #!/usr/bin/env node)
Preserve first block headers (e.g. license text)
Supports C-like, hash-based, and HTML-style comments
⌨️ Keyboard Shortcuts
Command
Default Shortcut
Remove all comments
Ctrl+Alt+A
Remove line comments only
Ctrl+Alt+L
Remove block comments only
Ctrl+Alt+B
Remove by regex pattern
Ctrl+Alt+P
👉 Shortcuts can be customized in: File → Preferences → Keyboard Shortcuts → search for commentRemover.
⚙️ Extension Settings
This extension contributes the following settings in your settings.json:
{
// Run automatically on save
"commentRemover.onSave": false,
// Remove JSDoc /** ... */ comments
"commentRemover.removeDocComments": false,
// Preserve first block comment in file (e.g. license headers)
"commentRemover.preserveFirstBlock": true,
// Preserve shebangs like #!/usr/bin/env node
"commentRemover.preserveShebang": true,
// Define patterns to KEEP (regex per language or global)
"commentRemover.keepPatterns": {
"global": ["TODO", "FIXME", "KEEP"],
"javascript": ["DEBUG", "IMPORTANT"]
},
// Limit removal to only selected text (instead of full file)
"commentRemover.workspaceScope": "selection"
}