Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 315742

Summary: [projection] Comment sections support for collapse/expand and outline view.
Product: [Eclipse Project] JDT Reporter: Raphael Jolivet <raphael.jolivet>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, remy.suen
Version: 3.4   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Raphael Jolivet CLA 2010-06-04 05:23:06 EDT
Build Identifier: I20080617-2000

Hi,

I'm used to organizing my code (Java code here, but this applies to any language) in a hierarchy of "sections" delimited by nice comments.

Something like 

// ---------------------------------------------------- 
// Private utils                 
// ---------------------------------------------------- 

[... some code ...]

// ---------------------------------------------------- 
// Implementation of the interface Foo
// ---------------------------------------------------- 

[... some code ...]

// ---------------------------------------------------- 
// Getters / Setters
// ----------------------------------------------------

[... some code ...]

I also include such comment blocks within large methods, to organize them.
This really increases the readability of the code, and we all know that this is important, right ? :-)

So my wish would be that eclipse could recognize these special "section" comments.

It could then show the expand/collapse button in the editor, or even show this hierarchy in the outline view.

The syntax of these comments could be configurable : A syntax for opening and closing section of codes.
Something like :

//{ Section 1
 
  [ ... code ... ]

//} 

//{ Section 2

   [... code ...]

   //{ Sub Section

   [... code ...]

   //}

//} 

Alternatively, we could directly use blocks of code as delimited per the language. I do it sometime for large methods, but this is not really suitable for top level section (not within methods) :

//! Section
{
   [... Code ...]
}

Thanks for your attention.

Regards,

Raphael

Reproducible: Always
Comment 1 Remy Suen CLA 2010-06-04 05:51:55 EDT
Bugs and enhancement requests about Eclipse's Java tooling goes to JDT.
Comment 2 Dani Megert CLA 2010-06-04 06:06:14 EDT

*** This bug has been marked as a duplicate of bug 63808 ***