I like c# #region...#endregion
facility a lot (some people say that's a bad habit but let's not discuss that). I miss it a lot when coding other languages. The obvious way to "add" it to other languages is to use special-formed comments the editor would understand. I've managed to set up Kate
to support //#region...//#endregion
for Java/Scala code, alike feature is not a problem to achieve with NetBeans
(here is how). Can I do this with IntelliJ Idea 11?
Asked
Active
Viewed 2,351 times
0

Ivan
- 63,011
- 101
- 250
- 382
2 Answers
4
This feature is planned for IDEA 11.1 that will be released in late Q1, 2012:
IntelliJ IDEA 11.1 will support custom folding using NetBeans and Visual Studio style comments.

CrazyCoder
- 389,263
- 172
- 990
- 904
-
Thhanks. I just hope the feature is going to be implemented the way to be usable with any language (through customization). As for me, I want it for Scala primarily. – Ivan Feb 09 '12 at 03:27
-
1Well, as Idea 11.1 is released, I've just updated to it. And this (as presented here http://goo.gl/XNDEF) just doesn't work. Maybe it works with Java but what I meant was a language-agnostic comment based (almost all the languages have comments, don't they?) feature. I am very disappointed. This is sad. I was waiting for this anxiously... – Ivan Mar 29 '12 at 03:32
-
Please file a request at http://youtrack.jetbrains.net/issues/IDEA for the language where it doesn't work. – CrazyCoder Mar 29 '12 at 03:35
-
And doesn't work in GSP (Groovy Server Page) and HTML. – AndreyT May 26 '16 at 11:53
2
Meanwhile this feature is implemented in IntelliJ IDEA and described here: http://www.jetbrains.com/idea/webhelp/folding-custom-regions-with-line-comments.html
You can define code regions using two styles:
VisualStudio style
#region Description
Your code goes here...
#endregion
NetBeans style
// <editor-fold desc="Description">
Your code goes here...
// </editor-fold>
But it is recommended to not mix up the two styles in one file. IntelliJ IDEA will recognize the first folding comment encountered, and will assume this as a style chosen for the code.

Sebastian
- 5,721
- 3
- 43
- 69