2014-10-29 10:09 GMT+01:00 Mark Rizun <mrizun@gmail.com>:
P.S. I have a solution, but don't know if it's appropriate: I remove updating of source interval from replaceWith: method, but my tool will do all the calculations of interval on it's own.

This is a possibility: have a transform; when you get selection intervals, look if they are inside "replaced areas" or outside of it; increase or decrease the indexes to compensate for added code / removed code. But this is more complex than it looks.

But I would try the equality over an AST first. A lot more robust for me.

Thierry

2014-10-29 10:59 GMT+02:00 Mark Rizun <mrizun@gmail.com>:
That is way I'd like to have automatically updated source interval.

I'm still not entirely sure why. Source intervals are only there to help relating the ast to the source, not much else, really.

I use source intervals to detect which node is selected and than in the right-click menu user can see only options that are relevanto to selected node, as it is also made in SmartSuggestions.