Replicate diagnostic summaries
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
b2f0c78924
commit
d8b888c9cb
7 changed files with 231 additions and 50 deletions
|
@ -70,7 +70,7 @@ pub struct ProjectPath {
|
|||
pub path: Arc<Path>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
pub struct DiagnosticSummary {
|
||||
pub error_count: usize,
|
||||
pub warning_count: usize,
|
||||
|
@ -243,6 +243,12 @@ impl Project {
|
|||
client.subscribe_to_entity(remote_id, cx, Self::handle_share_worktree),
|
||||
client.subscribe_to_entity(remote_id, cx, Self::handle_unregister_worktree),
|
||||
client.subscribe_to_entity(remote_id, cx, Self::handle_update_worktree),
|
||||
client.subscribe_to_entity(remote_id, cx, Self::handle_update_diagnostic_summary),
|
||||
client.subscribe_to_entity(
|
||||
remote_id,
|
||||
cx,
|
||||
Self::handle_disk_based_diagnostics_updated,
|
||||
),
|
||||
client.subscribe_to_entity(remote_id, cx, Self::handle_update_buffer),
|
||||
client.subscribe_to_entity(remote_id, cx, Self::handle_buffer_saved),
|
||||
],
|
||||
|
@ -661,6 +667,42 @@ impl Project {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_update_diagnostic_summary(
|
||||
&mut self,
|
||||
envelope: TypedEnvelope<proto::UpdateDiagnosticSummary>,
|
||||
_: Arc<Client>,
|
||||
cx: &mut ModelContext<Self>,
|
||||
) -> Result<()> {
|
||||
let worktree_id = WorktreeId::from_proto(envelope.payload.worktree_id);
|
||||
if let Some(worktree) = self.worktree_for_id(worktree_id, cx) {
|
||||
worktree.update(cx, |worktree, cx| {
|
||||
worktree
|
||||
.as_remote_mut()
|
||||
.unwrap()
|
||||
.update_diagnostic_summary(envelope, cx);
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_disk_based_diagnostics_updated(
|
||||
&mut self,
|
||||
envelope: TypedEnvelope<proto::DiskBasedDiagnosticsUpdated>,
|
||||
_: Arc<Client>,
|
||||
cx: &mut ModelContext<Self>,
|
||||
) -> Result<()> {
|
||||
let worktree_id = WorktreeId::from_proto(envelope.payload.worktree_id);
|
||||
if let Some(worktree) = self.worktree_for_id(worktree_id, cx) {
|
||||
worktree.update(cx, |worktree, cx| {
|
||||
worktree
|
||||
.as_remote()
|
||||
.unwrap()
|
||||
.disk_based_diagnostics_updated(cx);
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn handle_update_buffer(
|
||||
&mut self,
|
||||
envelope: TypedEnvelope<proto::UpdateBuffer>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue