Hide Comments - VSCode Extension
This extension started as a joke for people who do not like to see comments in the code. The extension will set all comments to transparent. The extension will never remove the comments from the file.
Important: Although it might have been started as a joke. There might be people out there that would actually like to hide the comments in their projects. That is why I will keep this project alive.
Usage
When the extension is installed. You can use the Hide Comments
commands to show or hide the comments.
If you want, you can also let the extension ask you each time when you start a new instance if you want to hide the comments. You can do this by enabling the hideComments.defaultEnabled
setting. When this is set to true
, you will get the following notification when you start a new instance:
When you choose Yes it will at the settings to your user settings for this project. If you decide No, nothing will happen at all.
On the editor title, a toggle action is available to show/hide the comments quickly.
Note: In case you are using the hideComments.regex
setting to hide additional lines with custom regex, you will have a second toggle action available.
Settings
hideComments.backup
: Used to backup the previous comments value (if set). Default: null
.
hideComments.color
: Defines the color for hiding the comments. Default: #00000000
.
hideComments.defaultEnabled
: Define if you want to enable or disable the extension on startup of Visual Studio Code. Default: false
.
hideComments.cleanStart
: Define if you want to start each instance by showing the comments in your files. Default: true
.
hideComments.foldOnHide
: Define if you want to fold the comment blocks when hiding comments. Default: true
.
hideComments.regex
: Specify the regular expression to use to hide additional lines. Default: null
.
Commands
The extension currently has the following commands:
Hide Comments: Toggle the show/hide of all comments
Hide Comments: Hide all comments
Hide Comments: Show all comments
Hide Comments: Show lines by regex
: this command is only available when the hideComments.regex
setting is set.
Hide Comments: hide lines by regex
: this command is only available when the hideComments.regex
setting is set.
Keybindings
The extension does not have any default keybindings. You can add your own keybindings to the commands from within Visual Studio Code it UI. Steps to do this:
- Open the command palette:
Ctrl+Shift+P
or Cmd+Shift+P
;
- Type the command you want to add a keybinding. Example:
Hide Comments: Toggle the show/hide of all comments
;
- Click on the gear icon next to the command in the command palette. This opens the keyboard shortcuts editor;
- Add your keybinding and you are all set.
Hide additional lines by regex
In case you want to hide additional lines with a custom regex, you can use the hideComments.regex
setting. Here is an example:
{
"hideComments.regex": [
{
"regex": "console\\.log\\(([^)]+)\\).*",
"flags": "igm"
}
]
}
Removing the extension
When you want to remove the extension, but still have the comments hidden. It is best to first run the Hide Comments: Show all comments
command. This will make sure that all settings will be reset.
If you did already uninstall the extension, but still your comments are hidden. Here is what you can do:
- Open your workspace settings via:
Preferences: Open Workspace Settings (JSON)
- Remove the following code from the JSON file:
"editor.tokenColorCustomizations": {
...
}
Feedback / issues / ideas
Please submit them via creating an issue in the project repository: issue list.