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

Bug 349914

Summary: Code folding and formatting does not work properly
Product: [Modeling] TMF Reporter: Daniel Santos <daniel.santos>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: moritz.eysholdt
Version: 1.0.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Shows the folding bug none

Description Daniel Santos CLA 2011-06-21 05:32:39 EDT
Build Identifier: 

Whenever I try to collapse/expand an element within my code in the editor it will folding just part of the sub elements. The same is happend whenever I try to format the code - it will mess up the code formatting totally.

Reproducible: Always

Steps to Reproduce:
Grammar:

Vehicle:
      (Bus | Truck)
      "plate:" plate=ID
      "model:" model=STRING
      "}";
      
Bus:
      "bus:" "{"
            "seats:" seats=INT;

Truck:
      "truck:" "{"
            "maxlength:" maxlenght=INT;  

1. Generate model based on grammar
2. Start ide application
3. Create the follow model

bus: {
      seats: 3
      plate: LU133223
      model: "Audi"
}

4. Collapse model element bus

The editor will folding parts of the "bus" element. See attachments
Comment 1 Daniel Santos CLA 2011-06-21 05:38:29 EDT
Created attachment 198312 [details]
Shows the folding bug
Comment 2 Moritz Eysholdt CLA 2011-07-11 04:08:12 EDT
(In reply to comment #0)
> The same is happend whenever I try
> to format the code - it will mess up the code formatting totally.

hi Daniel,

Did you define some formatting rules? If so, could you post them along with an example document that doesn't get formatted in the way you would expect it?
Comment 3 Sven Efftinge CLA 2012-11-21 08:47:04 EST
The generic implementations don't support your style to write a grammar as folding is donw along the containment structure of your AST model. So you need to "explain" how to fold your models by subclassing org.eclipse.xtext.ui.editor.folding.DefaultFoldingRegionProvider