A simple Visual Studio Code extension to remove all comments from the current file while preserving blank lines where they originally existed.
Supports:
- C-style comments:
// single-line and /* multi-line */
- Python-style comments:
# single-line , ''' multi-line ''' , and """ multi-line """
Keyboard Shortcut
Default: Ctrl + Alt + W (Windows/Linux)
To change it:
- Open File → Preferences → Keyboard Shortcuts (or press
Ctrl+K Ctrl+S ).
- Search for
remove-comments.run .
- Click the pencil icon and set your preferred keybinding.
Features
- Removes inline and block comments.
- Preserves original blank lines for readability.
- Works with multiple languages (C, C++, Java, JavaScript, Python, etc.).
- Can be triggered from:
- Command Palette
- Custom keyboard shortcut
Supported Languages
Currently works with languages that use:
// ...
/* ... */
# ...
''' ... '''
""" ... """
Example:
Python:
# This is a comment
x = 5 # Inline comment
"""
This is
a multi-line comment
"""
| |