Closed loewenheim closed 1 year ago
You're right that the use case is very narrow. I'll try to think of more descriptive names!
This PR now includes test cases for debug id injection (the intended use case) as well as a property-based test showing the following:
If we edit a string s
into t
(with sourcemap m₁: t -> s
) and then edit t
into u
(with sourcemap m₂: u -> t
), then SourceMap::adjust_mappings(m₁, m₂)
is the same sourcemap that we would get if we did the edits from s
to u
in one go, with the following restriction: The first edits (from s
to t
) must only happen within lines, and the second edits (from t
to u
) must only happen to whole lines.
I know. Thank you for your comments :)
I'll do my best to understand at least
remapping
and compare them. So far I haven't found it easy to understand the code.