简体   繁体   中英

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.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM