project panel: Add indent guides for sticky items (#34092)

- Adds new trait `StickyItemsDecoration` in `sticky_items` which is
implemented by `IndentGuides` from `indent_guides`.

<img width="347" alt="image"
src="https://github.com/user-attachments/assets/577748bc-13f6-41b8-9266-6a0b72349a18"
/>

Release Notes:

- N/A
This commit is contained in:
Smit Barmase 2025-07-09 05:28:25 +05:30 committed by GitHub
parent ad8b823555
commit 3a247ee947
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 580 additions and 400 deletions

View file

@ -55,23 +55,27 @@ impl Render for IndentGuidesStory {
}),
)
.with_sizing_behavior(gpui::ListSizingBehavior::Infer)
.with_decoration(ui::indent_guides(
cx.entity().clone(),
px(16.),
ui::IndentGuideColors {
default: Color::Info.color(cx),
hover: Color::Accent.color(cx),
active: Color::Accent.color(cx),
},
|this, range, _cx, _context| {
this.depths
.iter()
.skip(range.start)
.take(range.end - range.start)
.cloned()
.collect()
},
)),
.with_decoration(
ui::indent_guides(
px(16.),
ui::IndentGuideColors {
default: Color::Info.color(cx),
hover: Color::Accent.color(cx),
active: Color::Accent.color(cx),
},
)
.with_compute_indents_fn(
cx.entity().clone(),
|this, range, _cx, _context| {
this.depths
.iter()
.skip(range.start)
.take(range.end - range.start)
.cloned()
.collect()
},
),
),
),
)
}