简体   繁体   English

有没有办法在Intellij Idea 13中定义自定义代码块并折叠/展开它?

[英]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. Intellij Idea 13可以使用CTRL + SHIFT + NUMPad - / +在某个预定义块上执行此操作,但我想定义自己的块并折叠/展开它。

You have several options to fold a custom block. 折叠自定义块有几种选择。

IntelliJ Idea 14: Select multiple lines and press Ctrl + Period . IntelliJ Idea 14:选择多行并按Ctrl + Period

Previous IntelliJ Idea versions: Surround multiple lines with {...} (press Ctrl + Alt + T ). 以前的IntelliJ Idea版本:使用{...}环绕多行(按Ctrl + Alt + T )。 Then you can use the fold/expand icons. 然后,您可以使用折叠/展开图标。

Folding by comment: 折叠评论:

Visual Studio style: Visual Studio风格:

#region Description 
your code
#endregion

NetBeans style: NetBeans样式:

// <editor-fold desc="Description"> 
your code
// </editor-fold>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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