Overview Version History Q & A Rating & Review
A simple Visual Studio Code extension to remove all comments from the current file or only from the selected portion of code .
Blank lines where comments existed are preserved for readability.
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.
Works on:
Whole file (if no selection).
Selected portion only (if code is highlighted).
Multiple selections are also supported.
Preserves original blank lines for readability.
Supports multiple languages (C, C++, Java, JavaScript, Python, etc.).
Can be triggered from:
Keyboard shortcut
Command Palette (Ctrl+Shift+P
→ “Remove Comments”)
Supported Languages
Currently works with languages that use:
// ...
/* ... */
# ...
''' ... '''
""" ... """
Examples
Python
# This is a comment
x = 5 # Inline comment
"""
This is
a multi-line comment
"""
print(x)