sidebar: Add property tests (#52540)
## Context
<!-- What does this PR do, and why? How is it expected to impact users?
Not just what changed, but what motivated it and why this approach.
Link to Linear issue (e.g., ENG-123) or GitHub issue (e.g., Closes #456)
if one exists — helps with traceability. -->
## How to Review
<!-- Help reviewers focus their attention:
- For small PRs: note what to focus on (e.g., "error handling in
foo.rs")
- For large PRs (>400 LOC): provide a guided tour — numbered list of
files/commits to read in order. (The `large-pr` label is applied
automatically.)
- See the review process guidelines for comment conventions -->
## Self-Review Checklist
<!-- Check before requesting review: -->
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- N/A
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
1 parent
8cdae31758
commit
4cb10dfdbd
3 files changed
+4705
-4254
No files matched your search
@@ -73,6 +73,16 @@ impl ProjectGroup {
|
||||
.first()
|
||||
.expect("groups always have at least one workspace")
|
||||
}
|
||||
|
||||
pub fn main_workspace(&self, cx: &App) -> &Entity<Workspace> {
|
||||
self.workspaces
|
||||
.iter()
|
||||
.find(|ws| {
|
||||
!crate::root_repository_snapshots(ws, cx)
|
||||
.any(|snapshot| snapshot.is_linked_worktree())
|
||||
})
|
||||
.unwrap_or_else(|| self.first_workspace())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ProjectGroupBuilder {
|
||||
@@ -91,7 +101,6 @@ impl ProjectGroupBuilder {
|
||||
|
||||
pub fn from_multiworkspace(mw: &MultiWorkspace, cx: &App) -> Self {
|
||||
let mut builder = Self::new();
|
||||
|
||||
// First pass: collect all directory mappings from every workspace
|
||||
// so we know how to canonicalize any path (including linked
|
||||
// worktree paths discovered by the main repo's workspace).
|
||||
@@ -148,9 +157,8 @@ impl ProjectGroupBuilder {
|
||||
workspace: &Entity<Workspace>,
|
||||
cx: &App,
|
||||
) -> ProjectGroupName {
|
||||
let paths: Vec<_> = workspace
|
||||
.read(cx)
|
||||
.root_paths(cx)
|
||||
let root_paths = workspace.read(cx).root_paths(cx);
|
||||
let paths: Vec<_> = root_paths
|
||||
.iter()
|
||||
.map(|p| self.canonicalize_path(p).to_path_buf())
|
||||
.collect();
|
||||
|
||||
+29
-4250
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user