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 #913732] 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 #914035 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914060 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914085 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914110 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914135 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914160 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914185 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914210 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914235 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914260 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914285 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914310 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914335 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914360 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914385 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914410 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914435 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914460 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914485 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #914510 is a reply to message #913732] Sat, 15 September 2012 22:53 Go to previous messageGo to next 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
Re: semantic quick fixes and commens [message #915085 is a reply to message #914035] Sun, 16 September 2012 07:52 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian Zarnekow
Messages: 2809
Registered: July 2009
Senior Member
Hi Henrik,

I would have assumed that
org.eclipse.xtext.serializer.sequencer.HiddenTokenSequencer.getCommentsForEObject(EObject,
INode) can help to get that right, but unfortunately that one is never
called. Neither is the old ICommentAssociator used by the serializer. I
think Moritz or I will come back to that question.

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

Am 16.09.12 04:53, schrieb Henrik Lindberg:
> 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
>
Re: semantic quick fixes and commens [message #915109 is a reply to message #915085] Sun, 16 September 2012 09:33 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2498
Registered: July 2009
Senior Member
On 2012-16-09 13:52, Sebastian Zarnekow wrote:
> Hi Henrik,
>
> I would have assumed that
> org.eclipse.xtext.serializer.sequencer.HiddenTokenSequencer.getCommentsForEObject(EObject,
> INode) can help to get that right, but unfortunately that one is never
> called. Neither is the old ICommentAssociator used by the serializer. I
> think Moritz or I will come back to that question.
>

Thanks, I am (naturally ;-)) using the DOM based serializer and CSS
driven formatter that I developed for Geppetto so not too hard to change
the way it works (it already has a number of tweaks compared to the
default).

Meanwhile, if you or Moritz would like to write a line or two about how
it is supposed to work that would help me (i.e. a high level
description). Meanwhile, will take a look at
HiddenTokenSequencer.getCommentsForEObject(...) and see if I can figure
out what it is supposed to do.

Other than the comments, semantic fixes seems to work well with my DOM
based serializer once I figured out an approach to serializing and
formatting the semantic replacements (it is kind of tricky in a language
where the semantic change may alter the formatting, and just inserting
it in raw, one-space-separated form makes it look like a train-wreck...

Wonder why I always get into the difficult stuff two weeks before
planned release...

Regards
- henrik
Re: semantic quick fixes and commens [message #915116 is a reply to message #915109] Sun, 16 September 2012 10:03 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2498
Registered: July 2009
Senior Member
On 2012-16-09 15:33, Henrik Lindberg wrote:
> On 2012-16-09 13:52, Sebastian Zarnekow wrote:
>> Hi Henrik,
>>
>> I would have assumed that
>> org.eclipse.xtext.serializer.sequencer.HiddenTokenSequencer.getCommentsForEObject(EObject,
>>
>> INode) can help to get that right, but unfortunately that one is never
>> called. Neither is the old ICommentAssociator used by the serializer. I
>> think Moritz or I will come back to that question.
>>
>

> Meanwhile, if you or Moritz would like to write a line or two about how
> it is supposed to work that would help me (i.e. a high level
> description). Meanwhile, will take a look at
> HiddenTokenSequencer.getCommentsForEObject(...) and see if I can figure
> out what it is supposed to do.
>
I looked at getCommensForEObject(EObject, INode), and that was very
straight forward, given an EObject and a node, it just produces a Set of
comments in the tree associated with the semantic object in/under the
given node.

The more interesting issue is - where and how can that be used? If the
semantic model and node model are in sync, the logic that finds
"comments between" is enough.

To solve this a look ahead is required - will all comments match a
"between" slot? If not they need to be associated with EObject. Can't
really wait until that comment is found as it should maybe already have
been emitted.

I was thinking that this could potentially be expensive to perform in
the serializer when doing more agressive semantic modifications, and
maybe this is something that should be done as part of applying a
semantic change (there it is known what changed, the comment nodes can
be found). This is still quite difficult and I wonder if it would be a
good idea to move the responsibility to the user (implementor of
semantic change, or grammar driven) so it can be configured if comments
are left or right associative - or do you think there is a general rule
that always works?

Regards
- henrik
Previous Topic:semantic quick fixes and commens
Next Topic:xtext + tycho + xtext-utils unit testing fails
Goto Forum:
  


Current Time: Thu Jul 24 19:17:51 EDT 2014

Powered by FUDForum. Page generated in 0.04594 seconds