Git Product home page Git Product logo

estruyf / vscode-hide-comments Goto Github PK

View Code? Open in Web Editor NEW
33.0 3.0 3.0 544 KB

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.

Home Page: https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-hide-comments

License: MIT License

TypeScript 100.00%
comments visibility

vscode-hide-comments's Introduction

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

  • 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.regex: Specify the regular expression to use to hide additional lines. Default: null.

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:

  • 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.

vscode-hide-comments's People

Contributors

estruyf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vscode-hide-comments's Issues

Disable annoying 'Do you want to hide comments in this project' popup

Hi,

every time I launch VSCode I get annoying 'Do you want to hide comments in this project' popup. When I want to 'hide comments' I use appropriate command. Hiding comments may or may not be a common task for a project. When it is not common, this popup is annoying. How to disable it?

Does not work for C#

In C#, class (method, field, property, etc.) comments look like this:

/// <summary>
/// Foo bar baz Foo bar baz Foo bar baz Foo bar baz Foo bar baz Foo
/// bar baz Foo bar baz Foo bar baz Foo bar bazFoo bar baz Foo bar
/// baz Foo bar baz Foo bar bazFoo bar baz.
/// </summary>
/// <param name="bar">Blah blah.</param>
/// <returns>Something.</returns>
public string Foo(int bar) {

This extension hides all the text, but not the xml tags. It looks like this:

    <summary>...
public string Foo(int bar) {

And if expanded it looks like this:

    <summary>
    
    
    
    </summary>
    <param name="bar">          </param>
    <returns>          </returns>
public string Foo(int bar) {

Normal comments are hidden properly, e.g.

// blah blah blah
var foo = "123";      // blah blah blah`

I hope there can be C# support. This is a really nice extension, thanks for making it!

JSDoc not hidden

When I hide comments, the JSDoc comments are still visible. These should also be hidden.

Show comments:
image

Hide Comments:
image

Publish the extension to Open VSX Registry

Hi, I'm a Code OSS user, an open source version of VS Code. It's the same code but without Microsoft's telemetry, branding and licensing.

I would like to request, if possible, to add your extension to the open-vsx.org market as it is probably illegal to use the official Microsoft extension marketplace on VS Code forks, see here.

Additional information on how to publish an extension to Open VSX Registry can be obtained here.

Can we also hide logger commands (python)?

It would be useful to also hide logger commands. What do you think?

Example before:

logger.info("deploying AciWebservice..")
aci_config = AciWebservice.deploy_configuration(cpu_cores=1, memory_gb=1)
logger.info("AciWebservice deployed!")

logger.info("setting InferenceConfig..")
env = Environment('custom')

Example after:


aci_config = AciWebservice.deploy_configuration(cpu_cores=1, memory_gb=1)



env = Environment('custom')

Folding comment space

This is not an issue, but a feature request. Currently, when the comments are hidden, the space they occupied remains. I'd love it if that blank space was folded and then the spot was just identified with a 1 or 2 character mark, like ** or --.

Or another option could be, rather than hiding, just fold the comments. Then all multi-line comment blocks and successive single line comments could be folded and unfolded at once.

# lines

I don't know if this is a bug or if I'm doing something wrong. I tried to apply my RegEx for ShellScript, where many lines started with "#". My idea was to create my own expression, which I tested on regexr.com, so I created something like this:

"hideComments.regex": [
    {
        "regex": "/^\\s*#.*\\n/gm",
        "flags": "hashtag"
    }
]

But it didn't work. Can You lead me what I messed up?

Some explanation to the RegEx syntax below

image

Add Toggle the show/hide of all comments + lines by regex

Hi, could you add the Keyboard Shortcuts option to Toggle both the show/hide of all comments and the lines by regex in one button please?

Currently there is only the "Toggle the show/hide of all comments" Keyboard Shortcuts option.

Thanks!

Thank you

Just what I need since I am learning Zig with Ziglings (similar to rustlings) and I want to find the solution without the help of the comments

[side-question]: VSC extension to hide code with pattern

Hi! well done!

I've a simple personal question to you: from your experience on writting this extension, do you think that is feasible to write one that hide statements on typescript files that stars with @Api?

eg:

image

I'm thinking about making an extension to show/hide the above statements in files ending with some pattern

The only extension I found that is almost like I wanted was this https://github.com/L3v3L/vs-focus which makes the code looks like this:
image

Save config to user settings

When toggling comments, it updates "editor.tokenColorCustomizations" in "workspace settings" (.vscode/settings.json).

For many teams that config is included in source control, so every time one toggles the extension it creates changes.

Please consider allowing us to write to "user settings" instead?

The plug-in messed up my comment color

I have a user settings:
"editor.tokenColorCustomizations": {
"comments": "#24c347"
},

But after installing the plug-in, this life failed to work. The pale color of comments now is not ideal for my eyes. Can someone do something? 

The problem is, I have these sitting in the setting.json, after I uninstall the plug in, my settings doesn't seem to go back into effect.

Extension won't disable on reload, won't ask me if I want to see comments again

Can you help me out with how to get this gosh darned extension to go away once and for all (lol)
I was working through a course and taking lots of notes (in comment form) that was making my files look messy,
so I was looking for a way to hide or collapse them. I found this extension and installed/enabled it.
The popup came up asking if I want to hide my comments, and I clicked yes

Decided I wanted to see my comments again, so I disabled the extension and reloaded vscode. Comments still transparent.
Uninstalled the extension and rebooted vscode. Still transparent.
When I exit vscode and start it back up, I don't get a popup asking if I want to see my comments again.
I've tried uninstalling and reinstalling this thing 4 times, with various attempts and disabling and reenabling it, and attempts to restart vscode to get the elusive popup, but with no luck

I'm on a windows machine.. is there any way you can just let me know what setting it was that the extension alters so that I can keep getting work done in the meantime? It's really distracting and I'd just like to undo it

Thanks very much

Suggestion: ability to change hidden comment color.

I know it's a visual hidden trick, but when I tend to forget where that comment was and start writing code where to comment for another line of code, so I tried messing with the workspace settings json file:

 "settings": {
          "foreground": "#00000000"
        }

It would be nice if there could be a simple command or preferably and mainly the user setting where I set my own color or have an opacity range scale.

Basically, what I'm trying to say is I don't want to hide the comment entirely, but just barely visible so I don't start writing code on the wrong line.
If it wouldn't be so much trouble,
Thanks. love the extension so far.

Visible brackets

I have visible brackets when I hide comments:

image
image

I tried to reload vscode but no change, you have an idea ?

After uninstalling, comments stayed hidden

Had to reinstall, and set to "show comments" before uninstalling in order to fix.

Edit: I now see the note in the docs, but that is not intuitive. If this extension is even going to exist - rather than just doing it ourselves in settings - this really needs to happen automatically as part of the uninstall script.

Does it work with Better Comments extension?

This extension seems to work with comments like
// This is a comment

I also use an extension called Better Comments, where comments can be colours by adding extra characters
//! This will be in red
//* This will be in green

However, this extension doesnt hide comment if the first character after // is not a letter

RFC: Toggling between hiding comments and hiding everything but comments

As the title describes, it would be nice to toggle between only comments and no comments.

When I visit a complex function, my first task is to understand what it's doing at a high level. Low level code often creates noise and distraction to my ADHD brain. I'd like to hide all the code initially, read what it claims to be doing (intent) then hide the comments and read what it's actually doing.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.