Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349914 - Code folding and formatting does not work properly
Summary: Code folding and formatting does not work properly
Status: CLOSED WONTFIX
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 1.0.1   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-21 05:32 EDT by Daniel Santos CLA
Modified: 2012-11-21 08:47 EST (History)
1 user (show)

See Also:


Attachments
Shows the folding bug (14.58 KB, image/jpeg)
2011-06-21 05:38 EDT, Daniel Santos CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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