mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Make sure not to signal the main thread on fs events in ignored directories (#12436)
Release Notes: - N/A
This commit is contained in:
parent
66affa969a
commit
2772f87198
@ -3524,6 +3524,15 @@ impl BackgroundScanner {
|
|||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
{
|
||||||
|
let mut state = self.state.lock();
|
||||||
|
let is_idle = state.snapshot.completed_scan_id == state.snapshot.scan_id;
|
||||||
|
state.snapshot.scan_id += 1;
|
||||||
|
if is_idle {
|
||||||
|
state.snapshot.completed_scan_id = state.snapshot.scan_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.reload_entries_for_paths(
|
self.reload_entries_for_paths(
|
||||||
root_path,
|
root_path,
|
||||||
root_canonical_path,
|
root_canonical_path,
|
||||||
@ -3532,6 +3541,7 @@ impl BackgroundScanner {
|
|||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
self.send_status_update(scanning, Some(request.done))
|
self.send_status_update(scanning, Some(request.done))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3605,19 +3615,23 @@ impl BackgroundScanner {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let (scan_job_tx, scan_job_rx) = channel::unbounded();
|
if relative_paths.is_empty() && dot_git_paths.is_empty() {
|
||||||
if !relative_paths.is_empty() || !dot_git_paths.is_empty() {
|
return;
|
||||||
log::debug!("received fs events {:?}", relative_paths);
|
|
||||||
self.reload_entries_for_paths(
|
|
||||||
root_path,
|
|
||||||
root_canonical_path,
|
|
||||||
&relative_paths,
|
|
||||||
abs_paths,
|
|
||||||
Some(scan_job_tx.clone()),
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.state.lock().snapshot.scan_id += 1;
|
||||||
|
|
||||||
|
let (scan_job_tx, scan_job_rx) = channel::unbounded();
|
||||||
|
log::debug!("received fs events {:?}", relative_paths);
|
||||||
|
self.reload_entries_for_paths(
|
||||||
|
root_path,
|
||||||
|
root_canonical_path,
|
||||||
|
&relative_paths,
|
||||||
|
abs_paths,
|
||||||
|
Some(scan_job_tx.clone()),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
self.update_ignore_statuses(scan_job_tx).await;
|
self.update_ignore_statuses(scan_job_tx).await;
|
||||||
self.scan_dirs(false, scan_job_rx).await;
|
self.scan_dirs(false, scan_job_rx).await;
|
||||||
|
|
||||||
@ -4025,13 +4039,7 @@ impl BackgroundScanner {
|
|||||||
.await;
|
.await;
|
||||||
|
|
||||||
let mut state = self.state.lock();
|
let mut state = self.state.lock();
|
||||||
let snapshot = &mut state.snapshot;
|
|
||||||
let is_idle = snapshot.completed_scan_id == snapshot.scan_id;
|
|
||||||
let doing_recursive_update = scan_queue_tx.is_some();
|
let doing_recursive_update = scan_queue_tx.is_some();
|
||||||
snapshot.scan_id += 1;
|
|
||||||
if is_idle && !doing_recursive_update {
|
|
||||||
snapshot.completed_scan_id = snapshot.scan_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove any entries for paths that no longer exist or are being recursively
|
// Remove any entries for paths that no longer exist or are being recursively
|
||||||
// refreshed. Do this before adding any new entries, so that renames can be
|
// refreshed. Do this before adding any new entries, so that renames can be
|
||||||
|
Loading…
Reference in New Issue
Block a user