Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to define a customized code block in Intellij Idea 13 and collapse/expand it?

I have a large text code and want to collapse/expand some part of the code that I want. Intellij Idea 13 can do it on some predefined block with CTRL+SHIFT+ NUMPad -/+ , But I want to define my own block and collapse/expand it.

like image 634
Mohamad Kouhi Moghadam Avatar asked Nov 28 '25 12:11

Mohamad Kouhi Moghadam


1 Answers

You have several options to fold a custom block.

IntelliJ Idea 14: Select multiple lines and press Ctrl+Period.

Previous IntelliJ Idea versions: Surround multiple lines with {...} (press Ctrl+Alt+T). Then you can use the fold/expand icons.

Folding by comment:

Visual Studio style:

#region Description 
your code
#endregion

NetBeans style:

// <editor-fold desc="Description"> 
your code
// </editor-fold>
like image 117
sina72 Avatar answered Nov 30 '25 01:11

sina72



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!