16

I have a codebase with many comments, how can I hide these, without deleting them since I will need them later.

I want to hide all the comments with one click or keystroke, not a simple collapse of one comment at a time.

2

5 Answers 5

7

I was looking for a way to do that too as I put way too many comments making it hard to debug... and I came across this https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-hide-comments it makes all the comments invisible, but it leaves special characters in place. There are also commands to toggle show/hide.

Sign up to request clarification or add additional context in comments.

2 Comments

Seems interesting, but did not work for me. I tried it for Python code.
Didn't work for me with C code either.
6

Hide Comments - Visual Studio Marketplace

We now have an extension for that. On the editor title, a toggle action is available to show/hide the comments quickly.

enter image description here

2 Comments

not seeing it, is it from some plugin ?
@MartianMartian yes, the extension is linked in the answer, you might have missed it
5

Can't find such feature as well. Read this issue from GitHub - https://github.com/Microsoft/vscode/issues/46505

Seems like that VSCode can't do it (from the box) and all people waiting for that feature.

Comments

1

According to this reference page you can use Ctrl+K Ctrl+/ to fold all block comments.

1 Comment

Doesn't seem to work for Python docstrings.
-1

You can download from inside Visual Studio 2022 called unobtrusive code and it will hide all comments and put "+" symbols on the collapsed line to the left of your code that you can open or close them with. It works great.

*** TO GET THE EXTENSION: ***

I went to the Extensions menu at the top of VS 2022 and chose manage extensions. Then in the manage extensions window that opens up, choose online then Visual Studio Marketplace. In the search at the top right of the manage extensions window type in unobtrusive code. download it and then exit Visual Studio. You should see a window pop up to install it.

When you start VS 2022 again and open a C# script, it should have all the comments minimized to the "plus symbols" to the left of the code!

Hope it works for anyone wanting to hide their comments.

1 Comment

I'm guessing you were referring to this marketplace.visualstudio.com/…? Unfortunately, the question was about Visual Studio Code, and Visual Studio != Visual Studio Code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.