Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Serializing unassigned keyword needed by quick fix
Serializing unassigned keyword needed by quick fix [message #972552] Mon, 05 November 2012 18:19 Go to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1034
Registered: July 2009
Senior Member
Hi,

I've implemented a quick fix (using semantic modification) which needs to generate an element with an unassigned keyword, like this:
Foo:
 (('bar1' bar=[Bar1]) | ('bar2' bar=[Bar2])) more=More;

where Bar1 and Bar2 have the expected common super-type Bar.

Obviously, the serializer cannot decide whether to insert a 'bar1' or 'bar2' keyword.

After reading about "Unassigned Text" at http://www.eclipse.org/Xtext/documentation.html#serialization I figured I'd need a value serializer, but binding a custom IValueSerializer (watchout, there are 2 interfaces of this name), did not make any difference. It looks like serialization on behalf of a quick fix doesn't use this kind of value serializer?

I managed to achieve the same effect by sub-classing MyDslSyntacticSequencer. However, this approach is a pretty bumpy road: lots of "restriction" warnings and the field SyntacticalContext.semanticObject, which I need for my implementation, isn't even accessible.

What is the recommended way to handle this?
- Should the syntactic sequencer actually use a value serializer where it is not?
- Is there another hook that I could use to customize serialization?
- Is customizing the sequencer actually a good approach (and should SyntacticalContext be opened up more, to facilitate this approach?) ?

cheers,
Stephan
Re: Serializing unassigned keyword needed by quick fix [message #972716 is a reply to message #972552] Mon, 05 November 2012 21:15 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 2936
Registered: July 2009
Senior Member
Hi Stephan,

This looks like a bug to me. I filed
https://bugs.eclipse.org/bugs/show_bug.cgi?id=393606
You may want to comment on that one.

Regarding the SyntaticSequencer (you're a real code archeologist :-):
Yes, it is clearly meant to be extended. A first glance at the code
suggests that there was a misconception about the visibility rules of
protected inner classes. Please share your thoughts in
https://bugs.eclipse.org/bugs/show_bug.cgi?id=393608

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 05.11.12 19:19, schrieb Stephan Herrmann:
> Hi,
>
> I've implemented a quick fix (using semantic modification) which needs
> to generate an element with an unassigned keyword, like this:
>
> Foo:
> (('bar1' bar=[Bar1]) | ('bar2' bar=[Bar2])) more=More;
>
> where Bar1 and Bar2 have the expected common super-type Bar.
>
> Obviously, the serializer cannot decide whether to insert a 'bar1' or
> 'bar2' keyword.
>
> After reading about "Unassigned Text" at
> http://www.eclipse.org/Xtext/documentation.html#serialization I figured
> I'd need a value serializer, but binding a custom IValueSerializer
> (watchout, there are 2 interfaces of this name), did not make any
> difference. It looks like serialization on behalf of a quick fix doesn't
> use this kind of value serializer?
>
> I managed to achieve the same effect by sub-classing
> MyDslSyntacticSequencer. However, this approach is a pretty bumpy road:
> lots of "restriction" warnings and the field
> SyntacticalContext.semanticObject, which I need for my implementation,
> isn't even accessible.
>
> What is the recommended way to handle this? - Should the syntactic
> sequencer actually use a value serializer where it is not?
> - Is there another hook that I could use to customize serialization?
> - Is customizing the sequencer actually a good approach (and should
> SyntacticalContext be opened up more, to facilitate this approach?) ?
>
> cheers,
> Stephan
>
Previous Topic:Hand over properties from Maven to MWE2 Workflow Descriptor
Next Topic:Newline removed when model gets updated
Goto Forum:
  


Current Time: Thu Nov 20 23:15:55 GMT 2014

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

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