WIP - Start work on updating project diagnostics view

This commit is contained in:
Max Brunsfeld 2021-12-21 16:39:23 -08:00
parent a888620e5f
commit 2c3efdea8c
5 changed files with 213 additions and 54 deletions

View file

@ -56,9 +56,11 @@ pub struct Collaborator {
pub replica_id: ReplicaId,
}
#[derive(Debug)]
pub enum Event {
ActiveEntryChanged(Option<ProjectEntry>),
WorktreeRemoved(usize),
DiagnosticsUpdated(ProjectPath),
}
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
@ -473,6 +475,15 @@ impl Project {
fn add_worktree(&mut self, worktree: ModelHandle<Worktree>, cx: &mut ModelContext<Self>) {
cx.observe(&worktree, |_, _, cx| cx.notify()).detach();
cx.subscribe(&worktree, |_, worktree, event, cx| match event {
worktree::Event::DiagnosticsUpdated(path) => {
cx.emit(Event::DiagnosticsUpdated(ProjectPath {
worktree_id: worktree.id(),
path: path.clone(),
}));
}
})
.detach();
self.worktrees.push(worktree);
cx.notify();
}