Extract a BufferStore object from Project (#14037)

This is a ~small~ pure refactor that's a step toward SSH remoting. I've
extracted the Project's buffer state management into a smaller, separate
struct called `BufferStore`, currently in the same crate. I did this as
a separate PR to reduce conflicts between main and `remoting-over-ssh`.

The idea is to make use of this struct (and other smaller structs that
make up `Project`) in a dedicated, simpler `HeadlessProject` type that
we will use in the SSH server to model the remote end of a project. With
this approach, as we develop the headless project, we can avoid adding
more conditional logic to `Project` itself (which is already very
complex), and actually make `Project` a bit smaller by extracting out
helper objects.

Release Notes:

- N/A
This commit is contained in:
Max Brunsfeld 2024-07-12 15:25:54 -07:00 committed by GitHub
parent 21c5ce2bbd
commit 489077befc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 1394 additions and 1115 deletions

View file

@ -1129,7 +1129,7 @@ impl OutlinePanel {
EntryOwned::Entry(FsEntry::File(worktree_id, _, buffer_id, _)) => {
let project = self.project.read(cx);
let entry_id = project
.buffer_for_id(buffer_id)
.buffer_for_id(buffer_id, cx)
.and_then(|buffer| buffer.read(cx).entry_id(cx));
project
.worktree_for_id(worktree_id, cx)
@ -1147,7 +1147,7 @@ impl OutlinePanel {
.remove(&CollapsedEntry::Excerpt(buffer_id, excerpt_id));
let project = self.project.read(cx);
let entry_id = project
.buffer_for_id(buffer_id)
.buffer_for_id(buffer_id, cx)
.and_then(|buffer| buffer.read(cx).entry_id(cx));
entry_id.and_then(|entry_id| {