CommentRemover is a VS Code extension that helps you clean up your code by removing comments from your files. It works with multiple languages and gives you control over how comments are processed, making your code cleaner and potentially reducing file size.
[ALPHA] Please note that this extension is currently in alpha stage.
While it provides useful functionality, there may be occasional bugs or issues.
We appreciate your feedback to help improve this extension!
Features
Remove comments from:
Single files
Entire workspaces
Selected folders
Selected text
Smart detection of comment patterns in various languages
Built-in presets for popular languages
Automatic detection of custom comment patterns
Context menu integration
Right-click on files and folders
Process selected text or entire files
Preview comments removal before applying changes
See a side-by-side comparison of before/after
Make informed decisions before removing comments
Undo functionality
Restore comments immediately after removal
Undo operations on single files or batches
How to Use
Basic Usage
Open a file in VS Code
Run the command "CommentRemover: Remove Comments from Active File"
Choose to preview changes or remove comments directly
If comments are removed, an "Undo" option will appear in the notification
Preview Changes
Open a file in VS Code
Right-click and select "CommentRemover: Preview Comment Removal"
A diff view will show the file with and without comments
Choose "Apply Changes" to proceed or close the diff view to cancel
Batch Operations
For workspace-wide operations, use "CommentRemover: Remove Comments from Workspace"
For folder operations, right-click on a folder and select "Comment Remover: Remove Comments from Folder"
After processing, you can:
View a list of all changed files
Undo all changes with a single click
Selection-Based Features
If selecting a whole line, you'll get additional options:
Add comment pattern to presets
Remove comments from selection
Remove comments from this line only
If selecting part of a line, the extension will try to detect comment patterns to add to presets
Language Support
The extension comes with presets for these languages:
JavaScript
Python
HTML
And more...
For languages without built-in support, you can either:
Add comment patterns using the right-click context menu
Enter custom patterns manually when prompted
Extension Settings
This extension contributes the following settings:
commentRemover.languagePresets: Language presets for comment symbols
commentRemover.customSettings: Custom comment settings for languages not covered by presets
Known Issues
The extension may not correctly handle comments in complex string literals
Some specialized comment formats may not be supported