Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top