'Collapse python comment in vs code

Not long ago, I started commenting a lot of code in python, the problem is that vs code does not offer me to reduce the comment.

I have tried single line comments and group comments but same issue..

python single line comment python multiline program

In other languages for example C.. it offers me in the bar a button to collapse

example in C

How can comment collapsing be enabled in VS?



Solution 1:[1]

I tried it. I think vscode itself provides this function, but I don't know why it doesn't work for you.

As can be seen from the figure, multiline annotations can be folded.

enter image description here

enter image description here

Of course, there is no solution for your situation. We can add #region before the content, add #endregion after it.

enter image description here

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MingJie-MSFT