Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Newline removed when model gets updated
Newline removed when model gets updated [message #965544] Wed, 31 October 2012 10:13 Go to next message
Jeff MAURY is currently offline Jeff MAURYFriend
Messages: 44
Registered: July 2009
Member
I am facing the following problem.
I want to implement a quick fix that does the following:
Imaging the following grammar:

Grammar: Item*;

Item: (label=STRING)? 'Token';

Now, under certain circonstances, my quickfix will add a label to Item that does not have a label. So it does it by updating the Item model and adding the label.
Now, imagine I have the following file content:

LABEL1 Token \n
Token\n

So when the second item gets updated with a new label, then it seems it gets inserted at the end of the previous Item, replacing whitespace characters, so I get:

LABEL1 TOKENLabel2 Token

Is there a way to change this behaviour ?
Thanks
Re: Newline removed when model gets updated [message #972289 is a reply to message #965544] Mon, 05 November 2012 14:05 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
The quickfix relies on the serializer to transform the changes on the
semantic model back to the text.

Which serializer fragment are u using in the workflow of your language?
Please make sure to use
fragment = serializer.SerializerFragment
and not the old
fragment = parseTreeConstructor.ParseTreeConstructorFragment

If you do already use the new one, it's a bug.


Am 31.10.12 11:13, schrieb Jeff MAURY:
> I am facing the following problem.
> I want to implement a quick fix that does the following:
> Imaging the following grammar:
>
> Grammar: Item*;
>
> Item: (label=STRING)? 'Token';
>
> Now, under certain circonstances, my quickfix will add a label to Item
> that does not have a label. So it does it by updating the Item model and
> adding the label.
> Now, imagine I have the following file content:
>
> LABEL1 Token \n
> Token\n
>
> So when the second item gets updated with a new label, then it seems it
> gets inserted at the end of the previous Item, replacing whitespace
> characters, so I get:
>
> LABEL1 TOKENLabel2 Token
>
> Is there a way to change this behaviour ?
> Thanks


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Re: Newline removed when model gets updated [message #973383 is a reply to message #972289] Tue, 06 November 2012 09:38 Go to previous message
Jeff MAURY is currently offline Jeff MAURYFriend
Messages: 44
Registered: July 2009
Member
I checked my .mwe2 file and I'm using the new serializer fragment:

// Serializer 2.0
fragment = serializer.SerializerFragment {
generateStub = false
}

I will try to setup a sample project to demonstrate the problem and then open a bug
Previous Topic:Serializing unassigned keyword needed by quick fix
Next Topic:How to speed up serialization
Goto Forum:
  


Current Time: Thu Apr 25 08:38:24 GMT 2024

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

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

Back to the top