diff --git a/src/change_processor.rs b/src/change_processor.rs index d46e2e80..86176325 100644 --- a/src/change_processor.rs +++ b/src/change_processor.rs @@ -86,6 +86,9 @@ impl ChangeProcessor { // (non-serve commands). never() blocks forever without selecting. let critical_error_receiver = critical_error_receiver.unwrap_or_else(crossbeam_channel::never); + // Canonicalize project_root so path comparisons work with the + // \\?\ prefix that std::fs::canonicalize adds on Windows. + let project_root = std::fs::canonicalize(&project_root).unwrap_or(project_root); let task = JobThreadContext { tree, vfs, @@ -644,8 +647,11 @@ impl JobThreadContext { self.display_path(current_path) ); match current_path.parent() { - Some(parent) => current_path = parent, - None => break Vec::new(), + // Stop walking if we've reached or passed the project root. + Some(parent) if parent.starts_with(&self.project_root) => { + current_path = parent; + } + _ => break Vec::new(), } }; diff --git a/src/snapshot_middleware/project.rs b/src/snapshot_middleware/project.rs index e73f2719..88deac44 100644 --- a/src/snapshot_middleware/project.rs +++ b/src/snapshot_middleware/project.rs @@ -147,7 +147,10 @@ pub fn snapshot_project( // We SHOULD NOT mark the project file as a relevant path for any // nodes that aren't roots. They'll be updated as part of the project // file being updated. - snapshot.metadata.relevant_paths.push(path.to_path_buf()); + snapshot + .metadata + .relevant_paths + .push(vfs.canonicalize(path)?); Ok(Some(snapshot)) }