This set of changes is the proposed fix for the apparent ScopeManager issue I noticed. It seemed like it was already set up to handle multiple change events in a row, by expanding the `documentChanges` range appropriately each time a new change came in. However, it didn't iterate over the set of changes within a single event.

As an aside, it's not clear to me why this code uses a separate variable (`changed`) instead of just looking at and modifying `documentChanges` directly.