mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 21:13:02 +00:00
Log extension counts when worktree is updated
This commit is contained in:
parent
63fdf1398a
commit
3b8388dcdd
2 changed files with 25 additions and 13 deletions
|
@ -831,16 +831,28 @@ impl Server {
|
|||
request: TypedEnvelope<proto::UpdateWorktree>,
|
||||
response: Response<proto::UpdateWorktree>,
|
||||
) -> Result<()> {
|
||||
let (connection_ids, metadata_changed) = self.store_mut().await.update_worktree(
|
||||
request.sender_id,
|
||||
request.payload.project_id,
|
||||
request.payload.worktree_id,
|
||||
&request.payload.root_name,
|
||||
&request.payload.removed_entries,
|
||||
&request.payload.updated_entries,
|
||||
request.payload.scan_id,
|
||||
)?;
|
||||
// TODO: log `extension_counts` from `Worktree`.
|
||||
let (connection_ids, metadata_changed) = {
|
||||
let mut store = self.store_mut().await;
|
||||
let (connection_ids, metadata_changed, extension_counts) = store.update_worktree(
|
||||
request.sender_id,
|
||||
request.payload.project_id,
|
||||
request.payload.worktree_id,
|
||||
&request.payload.root_name,
|
||||
&request.payload.removed_entries,
|
||||
&request.payload.updated_entries,
|
||||
request.payload.scan_id,
|
||||
)?;
|
||||
for (extension, count) in extension_counts {
|
||||
tracing::info!(
|
||||
project_id = request.payload.project_id,
|
||||
worktree_id = request.payload.worktree_id,
|
||||
?extension,
|
||||
%count,
|
||||
"worktree updated"
|
||||
);
|
||||
}
|
||||
(connection_ids, metadata_changed)
|
||||
};
|
||||
|
||||
broadcast(request.sender_id, connection_ids, |connection_id| {
|
||||
self.peer
|
||||
|
|
|
@ -577,8 +577,9 @@ impl Store {
|
|||
removed_entries: &[u64],
|
||||
updated_entries: &[proto::Entry],
|
||||
scan_id: u64,
|
||||
) -> Result<(Vec<ConnectionId>, bool)> {
|
||||
) -> Result<(Vec<ConnectionId>, bool, &HashMap<OsString, usize>)> {
|
||||
let project = self.write_project(project_id, connection_id)?;
|
||||
let connection_ids = project.connection_ids();
|
||||
let mut worktree = project.worktrees.entry(worktree_id).or_default();
|
||||
let metadata_changed = worktree_root_name != worktree.root_name;
|
||||
worktree.root_name = worktree_root_name.to_string();
|
||||
|
@ -602,8 +603,7 @@ impl Store {
|
|||
worktree.entries.insert(entry.id, entry.clone());
|
||||
}
|
||||
worktree.scan_id = scan_id;
|
||||
let connection_ids = project.connection_ids();
|
||||
Ok((connection_ids, metadata_changed))
|
||||
Ok((connection_ids, metadata_changed, &worktree.extension_counts))
|
||||
}
|
||||
|
||||
pub fn project_connection_ids(
|
||||
|
|
Loading…
Reference in a new issue