You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If the parent is not unchanged, we have to make it unchanged so that it can be our
@@ -917,7 +920,29 @@ public void makeUnchanged() {
917
920
}
918
921
919
922
// Now make p our parent at all times, not just at a single time.
920
-
Time.forAll(t -> at(t).parent = p);
923
+
// To this end, we essentially have to "patch" this node into our parent scope at timeOfNewEdge.
924
+
// Technically, this means that we have to add this node to the children list of p at a specific index.
925
+
// We run into the alignment problem here if there is an insertion (or multiple insertions) right next to a deleted node we make unchanged or vice versa.
926
+
// Hence, the index at which to patch our node is not unique.
927
+
// There are multiple heuristics or strategies we could use to determine the index:
928
+
// - constant index: always use index 0 for example
929
+
// - line numbers: use the index right before the node with a higher line number at timeOfNewEdge
930
+
// This solution requires knowledge on line numbers which are not always present (e.g., in diffs generated in code).
931
+
// - context-based patching: Try to locate the node where its neighbors at timeOfNewEdge are most similar to the neighbors at timeOfExistingEdge
932
+
// This requires some knowledge on the labels to match contexts.
933
+
// We lightweight context-based patching here by trying to insert the node directly right of its closest unchanged left neighbor.
934
+
intpatchIndex = 0; // the index at which to insert this node at timeOfNewEdge
0 commit comments