Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ finalized in place with a date — no renaming/migration step needed.

- **thiserror 1.0 → 2.0 (direct).** Drop-in for all error enums (`#[error]`, `#[from]` unchanged); tantivy's chain still carries thiserror 1.x transitively until upstream moves.

- **File-watch stack majors: notify 6.1 → 8.2, notify-debouncer-full 0.3 → 0.7.** The debouncer absorbed `Watcher` into `Debouncer` itself (`debouncer.watch()/unwatch()` replace `.watcher().watch()`), and root cache tracking is now automatic, so the explicit `cache().add_root()` call goes away. The watcher's cache type now follows upstream's per-platform recommendation (`RecommendedCache`: `FileIdMap` on Windows/macOS, `NoCache` on Linux — file-ID tracking is an internal rename-detection optimization; event mapping never reads file IDs directly). Also removes `mio 0.8.11` from the lock entirely (it rode the Linux-only inotify 0.9 path; notify 8 uses inotify 0.11).

## [1.3.19]

### Changed
Expand Down
61 changes: 23 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ tree-sitter-proto = "0.4.0"

# File handling
ignore = "0.4"
notify = { version = "6.1", default-features = false, features = ["macos_fsevent"] }
notify-debouncer-full = "0.3"
notify = { version = "8.2", default-features = false, features = ["macos_fsevent"] }
notify-debouncer-full = "0.7"
walkdir = "2.5"
fs2 = "0.4" # Cross-platform file locking

Expand Down
17 changes: 6 additions & 11 deletions src/watch/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::{anyhow, Result};
use ignore::gitignore::{Gitignore, GitignoreBuilder};
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
use notify_debouncer_full::{new_debouncer, DebounceEventResult, Debouncer, FileIdMap};
use notify::{RecommendedWatcher, RecursiveMode};
use notify_debouncer_full::{new_debouncer, DebounceEventResult, Debouncer, RecommendedCache};
use std::collections::HashSet;
use std::path::{Path, PathBuf};
use std::process::Command;
Expand Down Expand Up @@ -67,7 +67,7 @@ pub enum FileEvent {
/// 3. Batched events for efficient processing
pub struct FileWatcher {
root: PathBuf,
debouncer: Option<Debouncer<RecommendedWatcher, FileIdMap>>,
debouncer: Option<Debouncer<RecommendedWatcher, RecommendedCache>>,
receiver: Option<Receiver<DebounceEventResult>>,
/// Compiled .gitignore matcher for the repo root (None if no .gitignore found).
gitignore: Option<Gitignore>,
Expand Down Expand Up @@ -195,17 +195,12 @@ impl FileWatcher {
self.receiver = Some(rx);
self.debouncer = Some(debouncer);

// Start watching the root directory
// Start watching the root directory (Debouncer implements Watcher directly
// since notify-debouncer-full 0.7 and tracks file-ID cache roots itself)
if let Some(ref mut debouncer) = self.debouncer {
debouncer
.watcher()
.watch(&self.root, RecursiveMode::Recursive)
.map_err(|e| anyhow!("Failed to watch directory: {}", e))?;

// Also watch with the cache (for file ID tracking)
debouncer
.cache()
.add_root(&self.root, RecursiveMode::Recursive);
}

Ok(())
Expand All @@ -219,7 +214,7 @@ impl FileWatcher {
/// Stop watching
pub fn stop(&mut self) {
if let Some(ref mut debouncer) = self.debouncer {
let _ = debouncer.watcher().unwatch(&self.root);
let _ = debouncer.unwatch(&self.root);
}
self.debouncer = None;
self.receiver = None;
Expand Down
Loading