Reputation: 222591
For a long time I was looking for a way to fold comments in PyCharm. Basically I was looking for a way to achieve the same +
for comments as for the block of code.
Upvotes: 3
Views: 2735
Reputation: 14622
Comment folding has been available for a while now. Any multi-line comment, regardless of type (#
, """
), will cause clickable folding icons to show up.
The #region
feature is still useful, if you want to fold mixed content.
Upvotes: 2
Reputation: 222591
It is easy to achieve this with
#region Description
# all your comments go here
#endregion
or this:
// <editor-fold desc="Description">
// all your comments go here
// </editor-fold>
Important thing to remember is that you can not mix both kinds of folding.
Also instead of typing all these #region Desription
you can just press CRTL+ALT+T
(but not on ubuntu, where this combination is for opening terminal) or going to Code -> Surround With
and selecting your surrounding type.
Using this type of surrounding you can fold any arbitrary parts of the code. But you can also do this with CTRL + .
Upvotes: 7