TextBuffers now maintain a reference to their containing project to
make it easier to test replication of buffers between environments
without worrying about the value of the `project` global.
We're also starting the process of moving the `git` global into Project
as the `Project.repository` property.
The project contains the only reference to the buffer that belongs to
the edit session in the serialized pane. If we tear down the pane then
the edit session is destroyed and the buffer is removed. So we have to
serialize and restore the project to its previous state once we finish
tearing down the view.
Everything from RootView to Pane needs to return a serialized clone of
its state, so we don't accidentally further mutate the serialized state
in tests.
Previously, we kept display buffer attributes in the edit session's
serialized state, then recreated a fresh display buffer each time when
deserializing edit sessions. Now that DisplayBuffer and TokenizedBuffer
are serializable, we can just include them directly when serializing
the edit session.
We want to be able to use the copy independently, which means we
should not use EditSession@deserialize to create it because that will
tie us to the same selection markers.
This prevents selection markers created by different edit sessions
from being shared. Otherwise every edit session for a buffer would be
forced to have the same selection/cursor state.
This removes the noise from the setup and compare lines that occur in
jasmine.js and only displays the lines that are generated from within
the failing spec.
Since there can be multiple edit sessions per buffer, it doesn't make
sense to serialize the buffer multiple times. Previously, we were
de-duplicating buffers in the deserialize method itself, but this won't
work now that we want to replicate buffers.
Previously viewForItem() would create a new view each time it was called
with an item whose view did not implement setModel() even if a view for that
item already existed in the pane.
Now a WeakMap is used to map items to their view so they can be reused
and cleaned up even when the view does not implement setModel().