zl程序教程

您现在的位置是:首页 >  工具

当前栏目

intelliJ idea #region 代码折叠

IDEA代码 Intellij 折叠 region
2023-09-27 14:22:36 时间

在intelliJ idea中不仅可以对类、方法等结构的代码进行折叠(ctrl+-)还可以自定义折叠代码。intelliJ支持两种风格的自定义代码折叠,如下:

visual studio style

//region Description    
Your code goes here...    
//endregion  

netbeans style

// <editor-fold desc="Description">    
Your code goes here...    
// </editor-fold>  

你可以直接手写,也可以使用快捷键实现对一段代码的自定义折叠,快捷键为:ctrl+alt+t

如图: