gpui: Simplify uniform list API by removing entity param (#32480)
This PR also introduces `Context::processor`, a sibling of `Context::listener` that takes a strong pointer to entity and allows for a return result. Release Notes: - N/A Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
c55630889a
commit
f567bb52ff
17 changed files with 80 additions and 77 deletions
|
@ -6,7 +6,7 @@ use gpui::{
|
|||
};
|
||||
use project::WorktreeId;
|
||||
use settings::Settings;
|
||||
use std::{path::Path, sync::Arc};
|
||||
use std::{ops::Range, path::Path, sync::Arc};
|
||||
use theme::ThemeSettings;
|
||||
use ui::prelude::*;
|
||||
use workspace::item::Item;
|
||||
|
@ -224,10 +224,9 @@ impl Render for ProjectIndexDebugView {
|
|||
.into_any_element()
|
||||
} else {
|
||||
let mut list = uniform_list(
|
||||
cx.entity().clone(),
|
||||
"ProjectIndexDebugView",
|
||||
self.rows.len(),
|
||||
move |this, range, _, cx| {
|
||||
cx.processor(move |this, range: Range<usize>, _, cx| {
|
||||
this.rows[range]
|
||||
.iter()
|
||||
.enumerate()
|
||||
|
@ -262,7 +261,7 @@ impl Render for ProjectIndexDebugView {
|
|||
})),
|
||||
})
|
||||
.collect()
|
||||
},
|
||||
}),
|
||||
)
|
||||
.track_scroll(self.list_scroll_handle.clone())
|
||||
.size_full()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue