|
|
Re: createReferenceUpdate failed in rename/refactor [message #1004166 is a reply to message #1003727] |
Tue, 22 January 2013 18:01 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
Thank you for replying, Sebastian.
Actually the problem I have is the following: I have my language WRESL, which for example have the following code:
goal test1{abc>1.0}
goal test2{abc<2.0}
goal test3{abc>1.5}
goal test4{abc<1.8}
goal test5{abc<1.6}
I would like to modify "abc" in the second line and the "abc" in all other lines automatically changes concurrently with my modification. After reviewing online posts, I found out maybe I missed the definition of cross reference in my xtext grammar to link those lines. I probablly need name and "[]" to define the cross references so that the createReferenceUpdate method would not return null.
Actually the concurent modification of "abc" is not my highest priority for now in my case, since it also has some scope issue in my case. Because in my language, the "define" statement for "abc" can be from another file, which makes it very hard for creating cross reference. That is why I plan to hold on this implementation.
My highest priority problem is that after I modified the "abc" in the second line to "ab", my code changed to:
goal test1{ab>1.0}
goal test2{aab2.0}
goal test3{abab5}
goal test4{abc<ab}
goal test5{abc<1ab
I used DefaultRenameStratege. It seems that after the first modification, my code shift for one character but the originalTextRegion in DefaultRenameStratege sticks to the text region before the modification without update. Then from the second modifications onwards, the modifications shift from my expectation.
I am going to create another thread since it has become a different issue. But I would like to hear your suggestions. Thanks again.
|
|
|
Re: createReferenceUpdate failed in rename/refactor [message #1004204 is a reply to message #1004166] |
Tue, 22 January 2013 19:46 |
Jan Koehnlein Messages: 760 Registered: July 2009 Location: Hamburg |
Senior Member |
|
|
If your language defines the element named 'abc' somewhere else, even in
another file, and the listing you provided shows cross-references to
this element only, rename refactoring should work out of the box. It
shouldn't even matter whether you trigger it on a cross-ref or on the
definition itself.
I don't know of what type your 'abc' is, but lets assume it is 'Foo'. So
your grammar should read similar to
Foo:
name=ID ...
....
Goal:
'goal' name=ID '{' ref=[Foo] ... '}'
If that's what you're already using, make sure the cross-references are
properly linked, e.g. by navigating them with F3 in the editor. You say
you have scoping problems, so it'd be a good idea to solve them first.
If this doesn't help, please post the relevant sections of your grammar.
Am 22.01.13 19:01, schrieb Hao Xie:
> Thank you for replying, Sebastian.
>
> Actually the problem I have is the following: I have my language WRESL,
> which for example have the following code:
>
> goal test1{abc>1.0}
> goal test2{abc<2.0}
> goal test3{abc>1.5}
> goal test4{abc<1.8}
> goal test5{abc<1.6}
>
> I would like to modify "abc" in the second line and the "abc" in all
> other lines automatically changes concurrently with my modification.
> After reviewing online posts, I found out maybe I missed the definition
> of cross reference in my xtext grammar to link those lines. I probablly
> need name and "[]" to define the cross references so that the
> createReferenceUpdate method would not return null.
>
> Actually the concurent modification of "abc" is not my highest priority
> for now in my case, since it also has some scope issue in my case.
> Because in my language, the "define" statement for "abc" can be from
> another file, which makes it very hard for creating cross reference.
> That is why I plan to hold on this implementation.
>
> My highest priority problem is that after I modified the "abc" in the
> second line to "ab", my code changed to:
>
> goal test1{ab>1.0}
> goal test2{aab2.0}
> goal test3{abab5}
> goal test4{abc<ab}
> goal test5{abc<1ab
>
> I used DefaultRenameStratege. It seems that after the first
> modification, my code shift for one character but the originalTextRegion
> in DefaultRenameStratege sticks to the text region before the
> modification without update. Then from the second modifications onwards,
> the modifications shift from my expectation.
>
> I am going to create another thread since it has become a different
> issue. But I would like to hear your suggestions. Thanks again.
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
---
Get professional support from the Xtext committers at www.typefox.io
|
|
|
|
Re: createReferenceUpdate failed in rename/refactor [message #1004321 is a reply to message #1004241] |
Wed, 23 January 2013 01:14 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I got the following errors after implementing cross reference. It seems xtext doesn't allow me have multiple cross references. I attached my grammar with this reply.
warning(200): ../gov.ca.dwr.wresl.xtext.editor.ui/src-gen/gov/ca/dwr/wresl/xtext/editor/ui/contentassist/antlr/internal/InternalWreslEditor.g:4704:1: Decision can match input such as "RULE_ID" using multiple alternatives: 1, 2, 3, 4, 5
As a result, alternative(s) 2,3,4,5 were disabled for that input
error(201): ../gov.ca.dwr.wresl.xtext.editor.ui/src-gen/gov/ca/dwr/wresl/xtext/editor/ui/contentassist/antlr/internal/InternalWreslEditor.g:4704:1: The following alternatives can never be matched: 2,3,4,5
|
|
|
|
Powered by
FUDForum. Page generated in 0.02042 seconds