Rename model based variable names to entity (#24198)

## Context
While looking through the client crate, I noticed that some of the old
functions and variables were still using gpui::model name that was
deprecated during the gpui3 transition. This PR renames those instances
of model to entity to be more inline with gpui3.

In addition, I also renamed `model` to `entity` in cases found by the
below search terms given by @someone13574

- model = cx.
- model: Entity
- model: &Entity
- OpenedModelHandle
- model.update
- model.upgrade
- model = .*\.root (regex)
- parent_model
- model = cx.new
- cx.spawn(move |model

Release Notes:

- N/A
This commit is contained in:
Anthony Eid 2025-02-04 13:24:35 -05:00 committed by GitHub
parent 27d1c689cf
commit 8c7096f7a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 332 additions and 327 deletions

View file

@ -47,14 +47,14 @@ pub struct IndentGuides {
}
pub fn indent_guides<V: Render>(
model: Entity<V>,
entity: Entity<V>,
indent_size: Pixels,
colors: IndentGuideColors,
compute_indents_fn: impl Fn(&mut V, Range<usize>, &mut Window, &mut Context<V>) -> SmallVec<[usize; 64]>
+ 'static,
) -> IndentGuides {
let compute_indents_fn = Box::new(move |range, window: &mut Window, cx: &mut App| {
model.update(cx, |this, cx| compute_indents_fn(this, range, window, cx))
entity.update(cx, |this, cx| compute_indents_fn(this, range, window, cx))
});
IndentGuides {
colors,
@ -78,7 +78,7 @@ impl IndentGuides {
/// Sets a custom callback that will be called when the indent guides need to be rendered.
pub fn with_render_fn<V: Render>(
mut self,
model: Entity<V>,
entity: Entity<V>,
render_fn: impl Fn(
&mut V,
RenderIndentGuideParams,
@ -88,7 +88,7 @@ impl IndentGuides {
+ 'static,
) -> Self {
let render_fn = move |params, window: &mut Window, cx: &mut App| {
model.update(cx, |this, cx| render_fn(this, params, window, cx))
entity.update(cx, |this, cx| render_fn(this, params, window, cx))
};
self.render_fn = Some(Box::new(render_fn));
self

View file

@ -114,7 +114,7 @@ impl ScrollbarState {
}
/// Set a parent model which should be notified whenever this Scrollbar gets a scroll event.
pub fn parent_model<V: 'static>(mut self, v: &Entity<V>) -> Self {
pub fn parent_entity<V: 'static>(mut self, v: &Entity<V>) -> Self {
self.parent_id = Some(v.entity_id());
self
}