Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » semantic quick fixes and commens
semantic quick fixes and commens [message #914691] Sat, 15 September 2012 21:15 Go to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2498
Registered: July 2009
Senior Member
Hi,
I am trying to use semantic modifications in quick fixes, and I have a
hard time figuring out where comments are reconciled.

I am performing an EMF 'move' operation on a list, and as a result all
comments disappear except one, but this comment is in the wrong place.

e.g

x => 1, // a
y => 2, // b
z => 3 // c

If I move the y => 2 to position 1 the end result is something like

y => 2,
x => 1, // b
z => 3

Where is the logic that reconciles the comments?

Regards
- henrik
Re: semantic quick fixes and commens [message #914692 is a reply to message #914691] Sat, 15 September 2012 22:53 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2498
Registered: July 2009
Senior Member
On 2012-16-09 3:15, Henrik Lindberg wrote:
> Hi,
> I am trying to use semantic modifications in quick fixes, and I have a
> hard time figuring out where comments are reconciled.
>
> I am performing an EMF 'move' operation on a list, and as a result all
> comments disappear except one, but this comment is in the wrong place.
>
> e.g
>
> x => 1, // a
> y => 2, // b
> z => 3 // c
>
> If I move the y => 2 to position 1 the end result is something like
>
> y => 2,
> x => 1, // b
> z => 3
>
> Where is the logic that reconciles the comments?
>

I think I can answer this myself... there is no special place, simply
serializing a model with an existing INode model.

First, my example had a typo. It should have been:
y => 2,
x => 1, // b
z => 3 // c

i.e. that the first comment disappears, and the remaining comments stay
grammatically where they were (i.e. between index 1 and 2, and between 3
and what follows.

The first comment disappears because at the point where it "should have
been found" the serializer is looking for comments between index 0 and
1, the the old comment is simply not there it was between the old 2 and 3.

(Bloody hell...)

Seems incredibly complex to figure out how to get the comments to move
with the moved object and to make sure the dangling comment appears
where a human expects it to appear.

Any tips? Has someone written something similar?


- henrik
Previous Topic:semantic quick fixes and commens
Next Topic:semantic quick fixes and commens
Goto Forum:
  


Current Time: Tue Jul 22 03:23:17 EDT 2014

Powered by FUDForum. Page generated in 0.04847 seconds