Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Intellij / Android Studio fold comments?

I have this commented out piece of code in intellij:

enter image description here

As you can see, there is no possibility to fold comments here. However, the same commented block in Webstorm can be collapse:

enter image description here

Is there any way to configure comments collapsing in intellij/Android Studio?

like image 917
Max Koretskyi Avatar asked May 04 '15 08:05

Max Koretskyi


People also ask

How do you fold in IntelliJ?

To fold or unfold a code fragment, press Ctrl+NumPad - / Ctrl+NumPad + . IntelliJ IDEA folds or unfolds the current code fragment, for example, a single method. To collapse or expand all code fragments, press Ctrl+Shift+NumPad - / Ctrl+Shift+NumPad + .

What is folded text?

Code or text folding, or less commonly holophrasting, is a feature of some graphical user interfaces that allows the user to selectively hide ("fold") or display ("unfold") parts of a document. This allows the user to manage large amounts of text while viewing only those subsections that are currently of interest.

How do I hide comments in Pycharm?

Simply click the arrow to hide the comments.


2 Answers

To fold an arbitrary selected block

  1. Select contiguous fragment of code in the editor.
  2. On the main menu, choose Code|Folding|Fold Selection/Remove Region, or press Ctrl+Period

Source: https://www.jetbrains.com/idea/help/folding-and-expanding-custom-blocks.html

like image 75
Vitaly Zinchenko Avatar answered Oct 25 '22 14:10

Vitaly Zinchenko


EDIT: It is a know bug, which can be found in JetBrains Bug Tracking System - IDEA-106702. It only affects block comments (/* comment */), all other comments are treated correctly.

General Editor folding settings

You can configure code folding in Settings (CTRL+ALT+S) - Editor → General → Code Folding

Here you can toggle folding outline and also configure default folding behavior for various file sections such as comments, imports, xml tags and more.

enter image description here

like image 33
Vojtech Ruzicka Avatar answered Oct 25 '22 16:10

Vojtech Ruzicka