estruyf / vscode-hide-comments

This extension started as a joke for people who do not like to see comments in the code. The extension will basically set all comments to transparent, they will not be removed.
https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-hide-comments
MIT License
36 stars 3 forks source link
comments visibility

Hide Comments

Hide Comments - VSCode Extension

Visual Studio Marketplace Number of installs Ratings Buy me a coffee

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:

Do you want to hide the comments of this project?

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.

Menu editor title actions

On the editor title, a toggle action is available to show/hide the comments quickly.

Title bar action toggle

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

Commands

The extension currently has the following commands:

  1. Hide Comments: Toggle the show/hide of all comments
  2. Hide Comments: Hide all comments
  3. Hide Comments: Show all comments
  4. Hide Comments: Show lines by regex: this command is only available when the hideComments.regex setting is set.
  5. 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:

  1. Open the command palette: Ctrl+Shift+P or Cmd+Shift+P;
  2. Type the command you want to add a keybinding. Example: Hide Comments: Toggle the show/hide of all comments;
  3. Click on the gear icon next to the command in the command palette. This opens the keyboard shortcuts editor;
  4. 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:

"editor.tokenColorCustomizations": {
  ...
}

Feedback / issues / ideas

Please submit them via creating an issue in the project repository: issue list.