What is this Extension?
- The Comment Cleaner extension for Visual Studio Code helps you easily remove comments from your code.
- But it keeps comments that start with
//!
(for example, //! This is important
), so you don't lose useful notes in your code.
Key Features:
- Removes all comments: It removes single-line comments (
// ...
) and block comments (/* ... */
).
- Keeps important comments: If a comment starts with
//!
, it will not be removed. You can use this special format for comments you want to keep.
How to Install the Extension?
Follow these steps to install and start using Comment Cleaner in your Visual Studio Code:
Option 1: Install from Visual Studio Code Marketplace
- Open Visual Studio Code (VSCode).
- Go to the Extensions Marketplace:
- On the left sidebar, click on the Extensions icon (or press
Ctrl + Shift + X
).
- Search for 'Comment Cleaner'.
- Click 'Install' on the extension page.
Option 2: Install from a .vsix
file (if you have the file)
- Download the
.vsix
file for the extension.
- Open VSCode.
- Press
Ctrl + Shift + P
to open the command palette.
- Type
Install from VSIX
and select it.
- Choose the
.vsix
file you downloaded and install it.
How to Use the Extension?
Once you've installed the extension, here's how to use it:
Open Your Code:
- Open any code file in VSCode (JavaScript, TypeScript, etc.).
Open the Command Palette:
- Press
Ctrl + Shift + P
on your keyboard to open the Command Palette.
Run the Extension:
- Type 'Remove All Comments Except //!' and select it from the list.
- This will remove all comments, except those starting with
//!
.
How to Customize (Optional)
If you'd like to make it even easier to use the extension, you can set up a custom keyboard shortcut for it!
Search for the Command:
- Look for "Remove All Comments Except //!" in the list.
Assign a Shortcut:
- Click the pencil icon next to the command and set your desired keyboard shortcut (e.g.,
Ctrl + Shift + P
).
Keyboard Shortcut
- Press
Ctrl + Shift + P
to open the Command Palette in VSCode.
- Select Remove All Comments Except //! in the search box.
- Click on the command that appears at the top (it should be Remove All Comments Except //!).
- This will automatically remove all comments except those starting with //!.
Why Use This Extension?
- Save Time: Quickly clean up your code by removing unnecessary comments.
- Keep Important Comments: Don't worry about losing valuable comments that start with
//!
.
- Easy to Use: Just a few clicks or a keyboard shortcut to make your code neat and clean.
How Does It Work?
When you run this extension, it checks the comments in your code:
- It removes regular comments like
//
and /* */
.
- It keeps comments that begin with
//!
, so you can mark important ones.
Troubleshooting
Extension not showing up?
- Try restarting VSCode.
- Make sure the extension is installed properly.
- Make sure you are using
//!
for comments you want to keep.
License
This project is licensed under the MIT License.
Feedback & Support
If you have any issues, suggestions, or feedback, feel free to reach out!
connectwithsiddh@gmail.com
I'll be happy to hear from you and help with any issues.
Connect with Me
I'm always open to collaborating and discussing new ideas!