Add rs-notify implementation of fs::watch
(#9040)
This PR simplifies the Zed file system abstraction and implements `Fs::watch` for linux and windows. TODO: - [x] Figure out why this fails to initialize the file watchers when we have to initialize the config directory paths, but succeeds on subsequent runs. - [x] Fix macOS dependencies on old fsevents::Event crate Release Notes: - N/A
This commit is contained in:
parent
456efb53ad
commit
ca696fd5f6
13 changed files with 478 additions and 493 deletions
|
@ -3336,7 +3336,7 @@ impl BackgroundScanner {
|
|||
}
|
||||
}
|
||||
|
||||
async fn run(&mut self, mut fs_events_rx: Pin<Box<dyn Send + Stream<Item = Vec<fs::Event>>>>) {
|
||||
async fn run(&mut self, mut fs_events_rx: Pin<Box<dyn Send + Stream<Item = Vec<PathBuf>>>>) {
|
||||
use futures::FutureExt as _;
|
||||
|
||||
// Populate ignores above the root.
|
||||
|
@ -3389,11 +3389,9 @@ impl BackgroundScanner {
|
|||
// For these events, update events cannot be as precise, because we didn't
|
||||
// have the previous state loaded yet.
|
||||
self.phase = BackgroundScannerPhase::EventsReceivedDuringInitialScan;
|
||||
if let Poll::Ready(Some(events)) = futures::poll!(fs_events_rx.next()) {
|
||||
let mut paths = fs::fs_events_paths(events);
|
||||
|
||||
while let Poll::Ready(Some(more_events)) = futures::poll!(fs_events_rx.next()) {
|
||||
paths.extend(fs::fs_events_paths(more_events));
|
||||
if let Poll::Ready(Some(mut paths)) = futures::poll!(fs_events_rx.next()) {
|
||||
while let Poll::Ready(Some(more_paths)) = futures::poll!(fs_events_rx.next()) {
|
||||
paths.extend(more_paths);
|
||||
}
|
||||
self.process_events(paths).await;
|
||||
}
|
||||
|
@ -3430,12 +3428,10 @@ impl BackgroundScanner {
|
|||
}
|
||||
}
|
||||
|
||||
events = fs_events_rx.next().fuse() => {
|
||||
let Some(events) = events else { break };
|
||||
let mut paths = fs::fs_events_paths(events);
|
||||
|
||||
while let Poll::Ready(Some(more_events)) = futures::poll!(fs_events_rx.next()) {
|
||||
paths.extend(fs::fs_events_paths(more_events));
|
||||
paths = fs_events_rx.next().fuse() => {
|
||||
let Some(mut paths) = paths else { break };
|
||||
while let Poll::Ready(Some(more_paths)) = futures::poll!(fs_events_rx.next()) {
|
||||
paths.extend(more_paths);
|
||||
}
|
||||
self.process_events(paths.clone()).await;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue