10

I have a code with many comments, how can I hide these ones, but no delete, I need them after.

I need to hide all the comments in one click, not a simple collapse one

Gama11
  • 31,714
  • 9
  • 78
  • 100
Olek
  • 439
  • 1
  • 4
  • 7
  • Possible duplicate of [How do I collapse sections of code in Visual Studio Code for Windows?](https://stackoverflow.com/questions/30067767/how-do-i-collapse-sections-of-code-in-visual-studio-code-for-windows) – RamblinRose May 16 '19 at 17:26

4 Answers4

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.

IFier
  • 98
  • 2
  • 9
5

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.

Anthony Kung
  • 1,025
  • 3
  • 12
  • 22
4

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

tinker
  • 483
  • 4
  • 16
0

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.