A VSCode extension that helps you clean up your code by removing all comments, including docstrings, while preserving the functionality of your code. Perfect for preparing production code or cleaning up development files.
- 🔥 Remove comments with a keyboard shortcut (
Ctrl+Shift+/
orCmd+Shift+/
) - ⚡ Optional automatic comment removal on file save
- 🌍 Multi-language support with language-specific handling
- 💪 Preserves string literals and code structure
- 🎯 Removes all types of comments including docstrings
- ⚙️ Configurable settings
Each language has specialized support for its comment syntax:
- Single-line comments (#)
- Docstrings (''' and """)
- Multi-line string comments
- Single-line comments (//)
- Multi-line comments (/* */)
- JSDoc comments
- Single-line comments (--)
- Multi-line comments (--[[ ]])
- C/C++
- HTML
- Shell scripts
- Ruby
- Matlab/Octave
- And more! (Falls back to language-specific comment detection)
- Open VSCode
- Go to Extensions (Ctrl+Shift+X)
- Search for "Remove All Comments"
- Click Install
Or install from Open VSX Registry
- Open any supported file
- Press
Ctrl+Shift+/
(Windows/Linux) orCmd+Shift+/
(Mac) - All comments will be removed while preserving your code
- Open Settings (Ctrl+,)
- Search for "Remove All Comments"
- Enable "Remove On Save" option
- Comments will be automatically removed each time you save the file
This extension contributes the following settings:
removeAllComments.removeOnSave
: Enable/disable automatic comment removal when saving files (default:false
)
# Single line comment
class Example:
'''
This docstring will be removed
'''
def method(self):
"""This docstring will also be removed"""
return "Hello" # This comment goes away
After:
class Example:
def method(self):
return "Hello"
// Single line comment
function hello() {
/* Multi-line
comment */
console.log("Hello"); // Inline comment
}
After:
function hello() {
console.log("Hello");
}
-- Single line comment
function hello()
--[[
Multi-line comment
in Lua
]]
print("Hello") -- Inline comment
end
After:
function hello()
print("Hello")
end
- String literals (comments inside strings are preserved)
- Code structure and formatting
- Multi-line strings (when not used as comments)
- Template literals
- Regular expressions
- Added support for removing Python docstrings
- Improved language-specific comment detection
- Enhanced string literal preservation
- Better handling of multi-line comments
- Fixed issues with nested comments
- Added more language support
Found a bug or want to contribute? Visit our GitHub repository!
This extension is licensed under the MIT License.