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
syncToText applies a text edit to an AST. Currently, it uses a heuristic that tries to maintain identities of nodes from the state before the edit in the state after the edit. There are some cases that occur in practice that it is impossible for such a heuristic to address, especially occurring when using the code editor (which commits changes frequently).
When typing in the code editor it is common for a series of character edits that, as a whole, result in a state that is syntactically similar to the original state, to pass through a state which is syntactically very different from the original state, and from the final state. Because of this, a syncToCode that tries to preserve identity during each incremental step can lose identities (node positions, etc) that would have been preserved by a syncToCode from the initial state directly to the final state. However, incremental commit is usually desirable (outside of some exceptional cases; see #11865).
We can reconcile incremental commit with this "big picture" view of identity preservation by broadening the inputs to the syncToCode heuristic: When seeking identities to preserve in the output, the algorithm should look not only at the current state, but at a pool of recent states--then it would be able to see past transient structural changes to maintain node identities (and metadata).
The text was updated successfully, but these errors were encountered:
syncToText
applies a text edit to an AST. Currently, it uses a heuristic that tries to maintain identities of nodes from the state before the edit in the state after the edit. There are some cases that occur in practice that it is impossible for such a heuristic to address, especially occurring when using the code editor (which commits changes frequently).When typing in the code editor it is common for a series of character edits that, as a whole, result in a state that is syntactically similar to the original state, to pass through a state which is syntactically very different from the original state, and from the final state. Because of this, a
syncToCode
that tries to preserve identity during each incremental step can lose identities (node positions, etc) that would have been preserved by asyncToCode
from the initial state directly to the final state. However, incremental commit is usually desirable (outside of some exceptional cases; see #11865).We can reconcile incremental commit with this "big picture" view of identity preservation by broadening the inputs to the
syncToCode
heuristic: When seeking identities to preserve in the output, the algorithm should look not only at the current state, but at a pool of recent states--then it would be able to see past transient structural changes to maintain node identities (and metadata).The text was updated successfully, but these errors were encountered: