Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Folding woes
Folding woes [message #761628] Tue, 06 December 2011 19:13 Go to next message
John Howard is currently offline John HowardFriend
Messages: 83
Registered: July 2009
Member
I don't know if this is me or a defect in folding (I suspect it's me)

I've generated the editor for my grammar, and everything seems to work OK, except for folding.

The editor seems to be aware of the sections that can be folded and I get the usual icon and lines to indicate the region. However, the folding doesn't fully work. The icon changes from - to +, but the region does not get folded. Hovering over the + icon shows the content of the regions as it would normally do if it was folded.

The following snippet re-creates the problem I am seeing

Imports:
imports+=Import+;

Import:
'import' importedNamespace=QualifiedNameWithWildCard;

Is there anything I am missing?

Re: Folding woes [message #761642 is a reply to message #761628] Tue, 06 December 2011 19:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13409
Registered: July 2009
Senior Member
Hi,

i cannot reproduce it with this grammar and Xtext 2.1.0
however you can debug into DefaultFoldingRegionProvider

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Folding woes [message #761655 is a reply to message #761642] Tue, 06 December 2011 20:25 Go to previous messageGo to next message
John Howard is currently offline John HowardFriend
Messages: 83
Registered: July 2009
Member
Hi Christian,

Thanks for the quick response

Looks like I have Xtext SDK 2.1.1.v201111141332

I'm not 100% sure what I should be looking for but DefaultFoldingRegionProvider finds a region.

If I debug into DefaultFoldedPosition after clicking folding icon

The FoldedPosition has a contentStart of 0 and a contentLength of 42

This translates into firstLine 0, captionLine 0, captionEndLine 2 and lastLine 2 when computeProjectionRegion is called - This results in a null Region

Test Grammar is:
grammar org.example.domainmodel.DomainModel with
org.eclipse.xtext.xbase.Xbase

generate domainmodel "http://www.example.org/domainmodel/Domainmodel"

DomainModel:
elements=Imports;

Imports:
imports+=Import+;

Import:
'import' importedNamespace=QualifiedNameWithWildCard;

QualifiedNameWithWildCard :
QualifiedName ('.' '*')?;

Input is
import a.b.c
import a.b.c
import a.b.c.e

Thanks for your help,

John

Re: Folding woes [message #761665 is a reply to message #761655] Tue, 06 December 2011 20:50 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13409
Registered: July 2009
Senior Member
Hi,

dont know if this is a bug or a feature. but it seems that in your case
org.eclipse.xtext.ui.editor.folding.DefaultFoldedPosition.computeProjectionRegions(IDocument)
leads to a non working folding since region = significant region so there is nothing to fold

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Additional proposal info for content assist
Next Topic:[Xtend] How to access class object?
Goto Forum:
  


Current Time: Mon Mar 30 11:29:40 GMT 2020

Powered by FUDForum. Page generated in 0.01993 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top