From 1bfbb7a0dfe17ef0c550994394dfbf147bea6c29 Mon Sep 17 00:00:00 2001 From: j178 <10510431+j178@users.noreply.github.com> Date: Thu, 3 Oct 2024 15:55:31 +0800 Subject: [PATCH] Include members in roots --- crates/uv-resolver/src/lock/tree.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/uv-resolver/src/lock/tree.rs b/crates/uv-resolver/src/lock/tree.rs index f5a3484e8517..742ec3c3a3a9 100644 --- a/crates/uv-resolver/src/lock/tree.rs +++ b/crates/uv-resolver/src/lock/tree.rs @@ -166,13 +166,20 @@ impl<'env> TreeDisplay<'env> { } } + let members = &lock.manifest.members; // Compute the root nodes. let roots = lock .packages .iter() - .map(|dist| &dist.id) - .filter(|id| !non_roots.contains(*id)) - .collect::>(); + .filter_map(|dist| { + // Always include workspace members in roots. + if !non_roots.contains(&dist.id) || members.contains(dist.name()) { + Some(&dist.id) + } else { + None + } + }) + .collect_vec(); Self { roots, @@ -313,7 +320,7 @@ impl<'env> TreeDisplay<'env> { let mut lines = Vec::new(); if self.packages.is_empty() { - for id in &self.roots { + for &id in &self.roots { path.clear(); lines.extend(self.visit(Node::Root(id), &mut visited, &mut path)); }