Remove more references to 'model' in GPUI APIs (#23693)

Mikayla Maki created

Release Notes:

- N/A

Change summary

crates/activity_indicator/src/activity_indicator.rs             |  2 
crates/assistant/src/assistant_panel.rs                         |  8 
crates/assistant/src/inline_assistant.rs                        |  8 
crates/assistant/src/terminal_inline_assistant.rs               |  2 
crates/assistant2/src/active_thread.rs                          |  2 
crates/assistant2/src/assistant_panel.rs                        |  4 
crates/assistant2/src/context_picker.rs                         |  4 
crates/assistant2/src/context_strip.rs                          |  2 
crates/assistant2/src/inline_assistant.rs                       | 12 
crates/assistant2/src/terminal_inline_assistant.rs              |  2 
crates/assistant2/src/thread_history.rs                         |  2 
crates/assistant_context_editor/src/context_editor.rs           | 20 
crates/assistant_context_editor/src/context_store.rs            |  2 
crates/assistant_slash_commands/src/terminal_command.rs         |  2 
crates/breadcrumbs/src/breadcrumbs.rs                           |  2 
crates/call/src/cross_platform/mod.rs                           |  4 
crates/call/src/cross_platform/room.rs                          |  2 
crates/call/src/macos/mod.rs                                    |  4 
crates/call/src/macos/room.rs                                   |  2 
crates/channel/src/channel_buffer.rs                            |  2 
crates/channel/src/channel_chat.rs                              |  2 
crates/channel/src/channel_store.rs                             |  8 
crates/client/src/user.rs                                       | 10 
crates/collab/src/tests/editor_tests.rs                         |  2 
crates/collab/src/tests/notification_tests.rs                   |  4 
crates/collab/src/tests/test_server.rs                          |  4 
crates/collab_ui/src/channel_view.rs                            |  2 
crates/collab_ui/src/chat_panel.rs                              |  4 
crates/collab_ui/src/chat_panel/message_editor.rs               |  2 
crates/collab_ui/src/collab_panel.rs                            | 10 
crates/collab_ui/src/collab_panel/channel_modal.rs              |  4 
crates/collab_ui/src/collab_panel/contact_finder.rs             |  2 
crates/collab_ui/src/notification_panel.rs                      |  8 
crates/command_palette/src/command_palette.rs                   |  2 
crates/diagnostics/src/diagnostics.rs                           |  2 
crates/editor/src/code_context_menus.rs                         |  4 
crates/editor/src/editor.rs                                     |  4 
crates/editor/src/editor_tests.rs                               | 20 
crates/editor/src/element.rs                                    |  4 
crates/editor/src/git/project_diff.rs                           |  2 
crates/editor/src/hunk_diff.rs                                  |  6 
crates/editor/src/scroll.rs                                     |  2 
crates/editor/src/test/editor_lsp_test_context.rs               |  2 
crates/editor/src/test/editor_test_context.rs                   |  6 
crates/extensions_ui/src/extensions_ui.rs                       |  8 
crates/feedback/src/feedback_modal.rs                           |  2 
crates/file_finder/src/file_finder.rs                           |  4 
crates/git_ui/src/git_panel.rs                                  | 10 
crates/git_ui/src/repository_selector.rs                        |  2 
crates/go_to_line/src/go_to_line.rs                             |  4 
crates/gpui/examples/input.rs                                   |  4 
crates/gpui/examples/uniform_list.rs                            |  2 
crates/gpui/src/app.rs                                          |  6 
crates/gpui/src/app/async_context.rs                            |  5 
crates/gpui/src/app/model_context.rs                            | 58 +-
crates/gpui/src/app/test_context.rs                             |  4 
crates/gpui/src/window.rs                                       | 28 
crates/inline_completion_button/src/inline_completion_button.rs |  8 
crates/language/src/buffer.rs                                   |  2 
crates/language/src/buffer_tests.rs                             |  4 
crates/language_model_selector/src/language_model_selector.rs   |  2 
crates/language_models/src/provider/cloud.rs                    |  2 
crates/language_selector/src/language_selector.rs               |  2 
crates/language_tools/src/lsp_log.rs                            |  6 
crates/language_tools/src/syntax_tree_view.rs                   |  4 
crates/markdown/src/markdown.rs                                 |  2 
crates/markdown_preview/src/markdown_preview_view.rs            |  2 
crates/notifications/src/notification_store.rs                  |  6 
crates/outline/src/outline.rs                                   |  4 
crates/outline_panel/src/outline_panel.rs                       | 12 
crates/picker/src/picker.rs                                     |  4 
crates/project/src/buffer_store.rs                              |  6 
crates/project/src/connection_manager.rs                        |  2 
crates/project/src/git.rs                                       |  2 
crates/project/src/image_store.rs                               |  2 
crates/project/src/lsp_store.rs                                 |  6 
crates/project/src/project.rs                                   |  6 
crates/project_panel/src/project_panel.rs                       | 10 
crates/project_symbols/src/project_symbols.rs                   |  2 
crates/recent_projects/src/disconnected_overlay.rs              |  2 
crates/recent_projects/src/recent_projects.rs                   |  2 
crates/recent_projects/src/remote_servers.rs                    | 16 
crates/remote_server/src/headless_project.rs                    | 12 
crates/repl/src/notebook/notebook_ui.rs                         |  4 
crates/repl/src/repl_sessions_ui.rs                             |  2 
crates/repl/src/session.rs                                      |  4 
crates/search/src/buffer_search.rs                              |  2 
crates/search/src/project_search.rs                             |  6 
crates/semantic_index/src/project_index_debug_view.rs           |  4 
crates/snippets_ui/src/snippets_ui.rs                           |  2 
crates/storybook/src/stories/indent_guides.rs                   |  4 
crates/tab_switcher/src/tab_switcher.rs                         |  2 
crates/terminal_view/src/terminal_panel.rs                      |  6 
crates/terminal_view/src/terminal_view.rs                       |  6 
crates/theme_selector/src/theme_selector.rs                     |  2 
crates/toolchain_selector/src/toolchain_selector.rs             |  2 
crates/ui/src/components/context_menu.rs                        |  4 
crates/vcs_menu/src/lib.rs                                      |  2 
crates/vim/src/mode_indicator.rs                                |  4 
crates/vim/src/normal/repeat.rs                                 |  2 
crates/vim/src/normal/search.rs                                 |  4 
crates/vim/src/vim.rs                                           | 10 
crates/welcome/src/base_keymap_picker.rs                        |  2 
crates/welcome/src/multibuffer_hint.rs                          |  2 
crates/workspace/src/dock.rs                                    |  2 
crates/workspace/src/notifications.rs                           |  2 
crates/workspace/src/pane.rs                                    | 30 
crates/workspace/src/pane_group.rs                              |  2 
crates/workspace/src/workspace.rs                               | 14 
crates/worktree/src/worktree.rs                                 |  4 
crates/worktree/src/worktree_tests.rs                           |  2 
crates/zed/src/main.rs                                          |  2 
crates/zed/src/zed.rs                                           |  8 
crates/zed/src/zed/inline_completion_registry.rs                |  7 
crates/zed_predict_tos/src/zed_predict_tos.rs                   |  2 
115 files changed, 309 insertions(+), 311 deletions(-)

Detailed changes

crates/activity_indicator/src/activity_indicator.rs 🔗

@@ -473,7 +473,7 @@ impl Render for ActivityIndicator {
         let Some(content) = self.content_to_render(cx) else {
             return result;
         };
-        let this = cx.model().downgrade();
+        let this = cx.entity().downgrade();
         let truncate_content = content.message.len() > MAX_MESSAGE_LEN;
         result.gap_2().child(
             PopoverMenu::new("activity-indicator-popover")

crates/assistant/src/assistant_panel.rs 🔗

@@ -155,7 +155,7 @@ impl AssistantPanel {
 
                     let project_paths = if let Some(tab) = dropped_item.downcast_ref::<DraggedTab>()
                     {
-                        if tab.pane == cx.model() {
+                        if tab.pane == cx.entity() {
                             return None;
                         }
                         let item = tab.pane.read(cx).item_for_index(tab.ix);
@@ -231,7 +231,7 @@ impl AssistantPanel {
                         pane.active_item()
                             .map_or(false, |item| item.downcast::<ContextHistory>().is_some()),
                     );
-                let _pane = cx.model().clone();
+                let _pane = cx.entity().clone();
                 let right_children = h_flex()
                     .gap(DynamicSpacing::Base02.rems(cx))
                     .child(
@@ -617,7 +617,7 @@ impl AssistantPanel {
                     InlineAssistant::update_global(cx, |assistant, cx| {
                         assistant.assist(
                             &active_editor,
-                            Some(cx.model().downgrade()),
+                            Some(cx.entity().downgrade()),
                             include_context.then_some(&assistant_panel),
                             initial_prompt,
                             window,
@@ -629,7 +629,7 @@ impl AssistantPanel {
                     TerminalInlineAssistant::update_global(cx, |assistant, cx| {
                         assistant.assist(
                             &active_terminal,
-                            Some(cx.model().downgrade()),
+                            Some(cx.entity().downgrade()),
                             Some(&assistant_panel),
                             initial_prompt,
                             window,

crates/assistant/src/inline_assistant.rs 🔗

@@ -77,7 +77,7 @@ pub fn init(
         let Some(window) = window else {
             return;
         };
-        let workspace = cx.model().clone();
+        let workspace = cx.entity().clone();
         InlineAssistant::update_global(cx, |inline_assistant, cx| {
             inline_assistant.register_workspace(&workspace, window, cx)
         });
@@ -211,7 +211,7 @@ impl InlineAssistant {
                 } else {
                     editor.add_code_action_provider(
                         Rc::new(AssistantCodeActionProvider {
-                            editor: cx.model().downgrade(),
+                            editor: cx.entity().downgrade(),
                             workspace: workspace.downgrade(),
                         }),
                         window,
@@ -1345,7 +1345,7 @@ impl EditorInlineAssists {
                     })
                 }),
                 editor.update(cx, |editor, cx| {
-                    let editor_handle = cx.model().downgrade();
+                    let editor_handle = cx.entity().downgrade();
                     editor.register_action(move |_: &editor::actions::Newline, window, cx| {
                         InlineAssistant::update_global(cx, |this, cx| {
                             if let Some(editor) = editor_handle.upgrade() {
@@ -1355,7 +1355,7 @@ impl EditorInlineAssists {
                     })
                 }),
                 editor.update(cx, |editor, cx| {
-                    let editor_handle = cx.model().downgrade();
+                    let editor_handle = cx.entity().downgrade();
                     editor.register_action(move |_: &editor::actions::Cancel, window, cx| {
                         InlineAssistant::update_global(cx, |this, cx| {
                             if let Some(editor) = editor_handle.upgrade() {

crates/assistant/src/terminal_inline_assistant.rs 🔗

@@ -242,7 +242,7 @@ impl TerminalInlineAssistant {
         let (latest_output, working_directory) = assist
             .terminal
             .update(cx, |terminal, cx| {
-                let terminal = terminal.model().read(cx);
+                let terminal = terminal.entity().read(cx);
                 let latest_output = terminal.last_n_non_empty_lines(DEFAULT_CONTEXT_LINES);
                 let working_directory = terminal
                     .working_directory()

crates/assistant2/src/active_thread.rs 🔗

@@ -56,7 +56,7 @@ impl ActiveThread {
             messages: Vec::new(),
             rendered_messages_by_id: HashMap::default(),
             list_state: ListState::new(0, ListAlignment::Bottom, px(1024.), {
-                let this = cx.model().downgrade();
+                let this = cx.entity().downgrade();
                 move |ix, _: &mut Window, cx: &mut App| {
                     this.update(cx, |this, cx| this.render_message(ix, cx))
                         .unwrap()

crates/assistant2/src/assistant_panel.rs 🔗

@@ -158,7 +158,7 @@ impl AssistantPanel {
         let project = workspace.project().clone();
         let language_registry = project.read(cx).languages().clone();
         let workspace = workspace.weak_handle();
-        let weak_self = cx.model().downgrade();
+        let weak_self = cx.entity().downgrade();
 
         let message_editor = cx.new(|cx| {
             MessageEditor::new(
@@ -811,7 +811,7 @@ impl AssistantPanel {
                     .child(v_flex().mx_auto().w_4_5().gap_2().children(
                         recent_threads.into_iter().map(|thread| {
                             // TODO: keyboard navigation
-                            PastThread::new(thread, cx.model().downgrade(), false)
+                            PastThread::new(thread, cx.entity().downgrade(), false)
                         }),
                     ))
                     .child(

crates/assistant2/src/context_picker.rs 🔗

@@ -78,7 +78,7 @@ impl ContextPicker {
     }
 
     fn build_menu(&mut self, window: &mut Window, cx: &mut Context<Self>) -> Entity<ContextMenu> {
-        let context_picker = cx.model().clone();
+        let context_picker = cx.entity().clone();
 
         let menu = ContextMenu::build(window, cx, move |menu, _window, cx| {
             let recent = self.recent_entries(cx);
@@ -144,7 +144,7 @@ impl ContextPicker {
     }
 
     fn select_kind(&mut self, kind: ContextKind, window: &mut Window, cx: &mut Context<Self>) {
-        let context_picker = cx.model().downgrade();
+        let context_picker = cx.entity().downgrade();
 
         match kind {
             ContextKind::File => {

crates/assistant2/src/context_strip.rs 🔗

@@ -393,7 +393,7 @@ impl Render for ContextStrip {
             .on_action(cx.listener(Self::remove_focused_context))
             .on_action(cx.listener(Self::accept_suggested_context))
             .on_children_prepainted({
-                let model = cx.model().downgrade();
+                let model = cx.entity().downgrade();
                 move |children_bounds, _window, cx| {
                     model
                         .update(cx, |this, _| {

crates/assistant2/src/inline_assistant.rs 🔗

@@ -58,7 +58,7 @@ pub fn init(
         let Some(window) = window else {
             return;
         };
-        let workspace = cx.model().clone();
+        let workspace = cx.entity().clone();
         InlineAssistant::update_global(cx, |inline_assistant, cx| {
             inline_assistant.register_workspace(&workspace, window, cx)
         });
@@ -196,7 +196,7 @@ impl InlineAssistant {
 
                     editor.add_code_action_provider(
                         Rc::new(AssistantCodeActionProvider {
-                            editor: cx.model().downgrade(),
+                            editor: cx.entity().downgrade(),
                             workspace: workspace.downgrade(),
                             thread_store,
                         }),
@@ -249,7 +249,7 @@ impl InlineAssistant {
                     InlineAssistant::update_global(cx, |assistant, cx| {
                         assistant.assist(
                             &active_editor,
-                            cx.model().downgrade(),
+                            cx.entity().downgrade(),
                             thread_store,
                             window,
                             cx,
@@ -260,7 +260,7 @@ impl InlineAssistant {
                     TerminalInlineAssistant::update_global(cx, |assistant, cx| {
                         assistant.assist(
                             &active_terminal,
-                            cx.model().downgrade(),
+                            cx.entity().downgrade(),
                             thread_store,
                             window,
                             cx,
@@ -1472,7 +1472,7 @@ impl EditorInlineAssists {
                     })
                 }),
                 editor.update(cx, |editor, cx| {
-                    let editor_handle = cx.model().downgrade();
+                    let editor_handle = cx.entity().downgrade();
                     editor.register_action(move |_: &editor::actions::Newline, window, cx| {
                         InlineAssistant::update_global(cx, |this, cx| {
                             if let Some(editor) = editor_handle.upgrade() {
@@ -1482,7 +1482,7 @@ impl EditorInlineAssists {
                     })
                 }),
                 editor.update(cx, |editor, cx| {
-                    let editor_handle = cx.model().downgrade();
+                    let editor_handle = cx.entity().downgrade();
                     editor.register_action(move |_: &editor::actions::Cancel, window, cx| {
                         InlineAssistant::update_global(cx, |this, cx| {
                             if let Some(editor) = editor_handle.upgrade() {

crates/assistant2/src/terminal_inline_assistant.rs 🔗

@@ -222,7 +222,7 @@ impl TerminalInlineAssistant {
         let (latest_output, working_directory) = assist
             .terminal
             .update(cx, |terminal, cx| {
-                let terminal = terminal.model().read(cx);
+                let terminal = terminal.entity().read(cx);
                 let latest_output = terminal.last_n_non_empty_lines(DEFAULT_CONTEXT_LINES);
                 let working_directory = terminal
                     .working_directory()

crates/assistant2/src/thread_history.rs 🔗

@@ -154,7 +154,7 @@ impl Render for ThreadHistory {
                 } else {
                     history.child(
                         uniform_list(
-                            cx.model().clone(),
+                            cx.entity().clone(),
                             "thread-history",
                             threads.len(),
                             move |history, range, _window, _cx| {

crates/assistant_context_editor/src/context_editor.rs 🔗

@@ -213,7 +213,7 @@ impl ContextEditor {
     ) -> Self {
         let completion_provider = SlashCommandCompletionProvider::new(
             context.read(cx).slash_commands().clone(),
-            Some(cx.model().downgrade()),
+            Some(cx.entity().downgrade()),
             Some(workspace.clone()),
         );
 
@@ -551,7 +551,7 @@ impl ContextEditor {
         window: &mut Window,
         cx: &mut Context<Self>,
     ) {
-        let context_editor = cx.model().downgrade();
+        let context_editor = cx.entity().downgrade();
 
         match event {
             ContextEvent::MessagesEdited => {
@@ -605,7 +605,7 @@ impl ContextEditor {
                         .map(|tool_use| {
                             let placeholder = FoldPlaceholder {
                                 render: render_fold_icon_button(
-                                    cx.model().downgrade(),
+                                    cx.entity().downgrade(),
                                     IconName::PocketKnife,
                                     tool_use.name.clone().into(),
                                 ),
@@ -789,7 +789,7 @@ impl ContextEditor {
 
                     let placeholder = FoldPlaceholder {
                         render: render_fold_icon_button(
-                            cx.model().downgrade(),
+                            cx.entity().downgrade(),
                             IconName::PocketKnife,
                             format!("Tool Result: {tool_use_id}").into(),
                         ),
@@ -937,7 +937,7 @@ impl ContextEditor {
         window: &mut Window,
         cx: &mut Context<ContextEditor>,
     ) {
-        let this = cx.model().downgrade();
+        let this = cx.entity().downgrade();
         let mut editors_to_close = Vec::new();
 
         self.editor.update(cx, |editor, cx| {
@@ -1081,7 +1081,7 @@ impl ContextEditor {
                         start..end,
                         FoldPlaceholder {
                             render: render_fold_icon_button(
-                                cx.model().downgrade(),
+                                cx.entity().downgrade(),
                                 section.icon,
                                 section.label.clone(),
                             ),
@@ -1843,7 +1843,7 @@ impl ContextEditor {
                 editor.insert("\n", window, cx);
 
                 let fold_placeholder =
-                    quote_selection_fold_placeholder(crease_title, cx.model().downgrade());
+                    quote_selection_fold_placeholder(crease_title, cx.entity().downgrade());
                 let crease = Crease::inline(
                     anchor_before..anchor_after,
                     fold_placeholder,
@@ -2027,7 +2027,7 @@ impl ContextEditor {
                     let buffer = editor.buffer().read(cx).snapshot(cx);
 
                     let mut buffer_rows_to_fold = BTreeSet::new();
-                    let weak_editor = cx.model().downgrade();
+                    let weak_editor = cx.entity().downgrade();
                     editor.insert_creases(
                         metadata.creases.into_iter().map(|metadata| {
                             let start = buffer.anchor_after(
@@ -2509,7 +2509,7 @@ impl ContextEditor {
     fn render_inject_context_menu(&self, cx: &mut Context<Self>) -> impl IntoElement {
         slash_command_picker::SlashCommandSelector::new(
             self.slash_commands.clone(),
-            cx.model().downgrade(),
+            cx.entity().downgrade(),
             Button::new("trigger", "Add Context")
                 .icon(IconName::Plus)
                 .icon_size(IconSize::Small)
@@ -3699,7 +3699,7 @@ pub fn make_lsp_adapter_delegate(
             Ok(Some(LocalLspAdapterDelegate::new(
                 project.languages().clone(),
                 project.environment(),
-                cx.weak_model(),
+                cx.weak_entity(),
                 &worktree,
                 http_client,
                 project.fs().clone(),

crates/assistant_context_editor/src/context_store.rs 🔗

@@ -318,7 +318,7 @@ impl ContextStore {
                 .client
                 .subscribe_to_entity(remote_id)
                 .log_err()
-                .map(|subscription| subscription.set_model(&cx.model(), &mut cx.to_async()));
+                .map(|subscription| subscription.set_model(&cx.entity(), &mut cx.to_async()));
             self.advertise_contexts(cx);
         } else {
             self.client_subscription = None;

crates/breadcrumbs/src/breadcrumbs.rs 🔗

@@ -152,7 +152,7 @@ impl ToolbarItemView for Breadcrumbs {
             return ToolbarItemLocation::Hidden;
         };
 
-        let this = cx.model().downgrade();
+        let this = cx.entity().downgrade();
         self.subscription = Some(item.subscribe_to_item_events(
             window,
             cx,

crates/call/src/cross_platform/mod.rs 🔗

@@ -105,8 +105,8 @@ impl ActiveCall {
             incoming_call: watch::channel(),
             _join_debouncer: OneAtATime { cancel: None },
             _subscriptions: vec![
-                client.add_request_handler(cx.weak_model(), Self::handle_incoming_call),
-                client.add_message_handler(cx.weak_model(), Self::handle_call_canceled),
+                client.add_request_handler(cx.weak_entity(), Self::handle_incoming_call),
+                client.add_message_handler(cx.weak_entity(), Self::handle_call_canceled),
             ],
             client,
             user_store,

crates/call/src/cross_platform/room.rs 🔗

@@ -148,7 +148,7 @@ impl Room {
             pending_participants: Default::default(),
             pending_call_count: 0,
             client_subscriptions: vec![
-                client.add_message_handler(cx.weak_model(), Self::handle_room_updated)
+                client.add_message_handler(cx.weak_entity(), Self::handle_room_updated)
             ],
             _subscriptions: vec![
                 cx.on_release(Self::released),

crates/call/src/macos/mod.rs 🔗

@@ -98,8 +98,8 @@ impl ActiveCall {
             incoming_call: watch::channel(),
             _join_debouncer: OneAtATime { cancel: None },
             _subscriptions: vec![
-                client.add_request_handler(cx.weak_model(), Self::handle_incoming_call),
-                client.add_message_handler(cx.weak_model(), Self::handle_call_canceled),
+                client.add_request_handler(cx.weak_entity(), Self::handle_incoming_call),
+                client.add_message_handler(cx.weak_entity(), Self::handle_call_canceled),
             ],
             client,
             user_store,

crates/call/src/macos/room.rs 🔗

@@ -204,7 +204,7 @@ impl Room {
             pending_participants: Default::default(),
             pending_call_count: 0,
             client_subscriptions: vec![
-                client.add_message_handler(cx.weak_model(), Self::handle_room_updated)
+                client.add_message_handler(cx.weak_entity(), Self::handle_room_updated)
             ],
             _subscriptions: vec![
                 cx.on_release(Self::released),

crates/channel/src/channel_buffer.rs 🔗

@@ -81,7 +81,7 @@ impl ChannelBuffer {
                 collaborators: Default::default(),
                 acknowledge_task: None,
                 channel_id: channel.id,
-                subscription: Some(subscription.set_model(&cx.model(), &mut cx.to_async())),
+                subscription: Some(subscription.set_model(&cx.entity(), &mut cx.to_async())),
                 user_store,
                 channel_store,
             };

crates/channel/src/channel_chat.rs 🔗

@@ -132,7 +132,7 @@ impl ChannelChat {
                 last_acknowledged_id: None,
                 rng: StdRng::from_entropy(),
                 first_loaded_message_id: None,
-                _subscription: subscription.set_model(&cx.model(), &mut cx.to_async()),
+                _subscription: subscription.set_model(&cx.entity(), &mut cx.to_async()),
             }
         })?;
         Self::handle_loaded_messages(

crates/channel/src/channel_store.rs 🔗

@@ -158,8 +158,8 @@ impl ChannelStore {
 
     pub fn new(client: Arc<Client>, user_store: Entity<UserStore>, cx: &mut Context<Self>) -> Self {
         let rpc_subscriptions = [
-            client.add_message_handler(cx.weak_model(), Self::handle_update_channels),
-            client.add_message_handler(cx.weak_model(), Self::handle_update_user_channels),
+            client.add_message_handler(cx.weak_entity(), Self::handle_update_channels),
+            client.add_message_handler(cx.weak_entity(), Self::handle_update_user_channels),
         ];
 
         let mut connection_status = client.status();
@@ -306,7 +306,7 @@ impl ChannelStore {
     ) -> Task<Result<Entity<ChannelBuffer>>> {
         let client = self.client.clone();
         let user_store = self.user_store.clone();
-        let channel_store = cx.model();
+        let channel_store = cx.entity();
         self.open_channel_resource(
             channel_id,
             |this| &mut this.opened_buffers,
@@ -436,7 +436,7 @@ impl ChannelStore {
     ) -> Task<Result<Entity<ChannelChat>>> {
         let client = self.client.clone();
         let user_store = self.user_store.clone();
-        let this = cx.model();
+        let this = cx.entity();
         self.open_channel_resource(
             channel_id,
             |this| &mut this.opened_chats,

crates/client/src/user.rs 🔗

@@ -146,10 +146,10 @@ impl UserStore {
         let (mut current_user_tx, current_user_rx) = watch::channel();
         let (update_contacts_tx, mut update_contacts_rx) = mpsc::unbounded();
         let rpc_subscriptions = vec![
-            client.add_message_handler(cx.weak_model(), Self::handle_update_plan),
-            client.add_message_handler(cx.weak_model(), Self::handle_update_contacts),
-            client.add_message_handler(cx.weak_model(), Self::handle_update_invite_info),
-            client.add_message_handler(cx.weak_model(), Self::handle_show_contacts),
+            client.add_message_handler(cx.weak_entity(), Self::handle_update_plan),
+            client.add_message_handler(cx.weak_entity(), Self::handle_update_contacts),
+            client.add_message_handler(cx.weak_entity(), Self::handle_update_invite_info),
+            client.add_message_handler(cx.weak_entity(), Self::handle_show_contacts),
         ];
         Self {
             users: Default::default(),
@@ -262,7 +262,7 @@ impl UserStore {
                 Ok(())
             }),
             pending_contact_requests: Default::default(),
-            weak_self: cx.weak_model(),
+            weak_self: cx.weak_entity(),
         }
     }
 

crates/collab/src/tests/editor_tests.rs 🔗

@@ -91,7 +91,7 @@ async fn test_host_disconnect(
         )
     });
     let cx_b = &mut VisualTestContext::from_window(*workspace_b, cx_b);
-    let workspace_b_view = workspace_b.root_model(cx_b).unwrap();
+    let workspace_b_view = workspace_b.root(cx_b).unwrap();
 
     let editor_b = workspace_b
         .update(cx_b, |workspace, window, cx| {

crates/collab/src/tests/notification_tests.rs 🔗

@@ -21,14 +21,14 @@ async fn test_notifications(
     let notification_events_b = Arc::new(Mutex::new(Vec::new()));
     client_a.notification_store().update(cx_a, |_, cx| {
         let events = notification_events_a.clone();
-        cx.subscribe(&cx.model(), move |_, _, event, _| {
+        cx.subscribe(&cx.entity(), move |_, _, event, _| {
             events.lock().push(event.clone());
         })
         .detach()
     });
     client_b.notification_store().update(cx_b, |_, cx| {
         let events = notification_events_b.clone();
-        cx.subscribe(&cx.model(), move |_, _, event, _| {
+        cx.subscribe(&cx.entity(), move |_, _, event, _| {
             events.lock().push(event.clone());
         })
         .detach()

crates/collab/src/tests/test_server.rs 🔗

@@ -849,7 +849,7 @@ impl TestClient {
     ) -> (Entity<Workspace>, &'a mut VisualTestContext) {
         let window = cx.update(|cx| cx.active_window().unwrap().downcast::<Workspace>().unwrap());
 
-        let model = window.root_model(cx).unwrap();
+        let model = window.root(cx).unwrap();
         let cx = VisualTestContext::from_window(*window.deref(), cx).as_mut();
         // it might be nice to try and cleanup these at the end of each test.
         (model, cx)
@@ -861,7 +861,7 @@ pub fn open_channel_notes(
     cx: &mut VisualTestContext,
 ) -> Task<anyhow::Result<Entity<ChannelView>>> {
     let window = cx.update(|_, cx| cx.active_window().unwrap().downcast::<Workspace>().unwrap());
-    let model = window.root_model(cx).unwrap();
+    let model = window.root(cx).unwrap();
 
     cx.update(|window, cx| ChannelView::open(channel_id, None, model.clone(), window, cx))
 }

crates/collab_ui/src/channel_view.rs 🔗

@@ -204,7 +204,7 @@ impl ChannelView {
         cx: &mut Context<Self>,
     ) -> Self {
         let buffer = channel_buffer.read(cx).buffer();
-        let this = cx.model().downgrade();
+        let this = cx.entity().downgrade();
         let editor = cx.new(|cx| {
             let mut editor = Editor::for_buffer(buffer, None, window, cx);
             editor.set_collaboration_hub(Box::new(ChannelBufferCollaborationHub(

crates/collab_ui/src/chat_panel.rs 🔗

@@ -97,7 +97,7 @@ impl ChatPanel {
         });
 
         cx.new(|cx| {
-            let model = cx.model().downgrade();
+            let model = cx.entity().downgrade();
             let message_list = ListState::new(
                 0,
                 gpui::ListAlignment::Bottom,
@@ -680,7 +680,7 @@ impl ChatPanel {
                 })
             })
             .when_some(message_id, |el, message_id| {
-                let this = cx.model().clone();
+                let this = cx.entity().clone();
 
                 el.child(
                     self.render_popover_button(

crates/collab_ui/src/chat_panel/message_editor.rs 🔗

@@ -101,7 +101,7 @@ impl MessageEditor {
         window: &mut Window,
         cx: &mut Context<Self>,
     ) -> Self {
-        let this = cx.model().downgrade();
+        let this = cx.entity().downgrade();
         editor.update(cx, |editor, cx| {
             editor.set_soft_wrap_mode(SoftWrap::EditorWidth, cx);
             editor.set_use_autoclose(false);

crates/collab_ui/src/collab_panel.rs 🔗

@@ -73,7 +73,7 @@ pub fn init(cx: &mut App) {
                 .and_then(|room| room.read(cx).channel_id());
 
             if let Some(channel_id) = channel_id {
-                let workspace = cx.model().clone();
+                let workspace = cx.entity().clone();
                 window.defer(cx, move |window, cx| {
                     ChannelView::open(channel_id, None, workspace, window, cx)
                         .detach_and_log_err(cx)
@@ -239,7 +239,7 @@ impl CollabPanel {
             )
             .detach();
 
-            let model = cx.model().downgrade();
+            let model = cx.entity().downgrade();
             let list_state = ListState::new(
                 0,
                 gpui::ListAlignment::Top,
@@ -1040,7 +1040,7 @@ impl CollabPanel {
         window: &mut Window,
         cx: &mut Context<Self>,
     ) {
-        let this = cx.model().clone();
+        let this = cx.entity().clone();
         if !(role == proto::ChannelRole::Guest
             || role == proto::ChannelRole::Talker
             || role == proto::ChannelRole::Member)
@@ -1170,7 +1170,7 @@ impl CollabPanel {
                 .channel_for_id(clipboard.channel_id)
                 .map(|channel| channel.name.clone())
         });
-        let this = cx.model().clone();
+        let this = cx.entity().clone();
 
         let context_menu = ContextMenu::build(window, cx, |mut context_menu, window, cx| {
             if self.has_subchannels(ix) {
@@ -1337,7 +1337,7 @@ impl CollabPanel {
         window: &mut Window,
         cx: &mut Context<Self>,
     ) {
-        let this = cx.model().clone();
+        let this = cx.entity().clone();
         let in_room = ActiveCall::global(cx).read(cx).room().is_some();
 
         let context_menu = ContextMenu::build(window, cx, |mut context_menu, _, _| {

crates/collab_ui/src/collab_panel/channel_modal.rs 🔗

@@ -40,7 +40,7 @@ impl ChannelModal {
         cx: &mut Context<Self>,
     ) -> Self {
         cx.observe(&channel_store, |_, _, cx| cx.notify()).detach();
-        let channel_modal = cx.model().downgrade();
+        let channel_modal = cx.entity().downgrade();
         let picker = cx.new(|cx| {
             Picker::uniform_list(
                 ChannelModalDelegate {
@@ -581,7 +581,7 @@ impl ChannelModalDelegate {
             return;
         };
         let user_id = membership.user.id;
-        let picker = cx.model().clone();
+        let picker = cx.entity().clone();
         let context_menu = ContextMenu::build(window, cx, |mut menu, _window, _cx| {
             let role = membership.role;
 

crates/collab_ui/src/collab_panel/contact_finder.rs 🔗

@@ -16,7 +16,7 @@ pub struct ContactFinder {
 impl ContactFinder {
     pub fn new(user_store: Entity<UserStore>, window: &mut Window, cx: &mut Context<Self>) -> Self {
         let delegate = ContactFinderDelegate {
-            parent: cx.model().downgrade(),
+            parent: cx.entity().downgrade(),
             user_store,
             potential_contacts: Arc::from([]),
             selected_index: 0,

crates/collab_ui/src/notification_panel.rs 🔗

@@ -110,7 +110,7 @@ impl NotificationPanel {
             })
             .detach();
 
-            let model = cx.model().downgrade();
+            let model = cx.entity().downgrade();
             let notification_list =
                 ListState::new(0, ListAlignment::Top, px(1000.), move |ix, window, cx| {
                     model
@@ -323,7 +323,7 @@ impl NotificationPanel {
                                             .justify_end()
                                             .child(Button::new("decline", "Decline").on_click({
                                                 let notification = notification.clone();
-                                                let model = cx.model().clone();
+                                                let model = cx.entity().clone();
                                                 move |_, _, cx| {
                                                     model.update(cx, |this, cx| {
                                                         this.respond_to_notification(
@@ -336,7 +336,7 @@ impl NotificationPanel {
                                             }))
                                             .child(Button::new("accept", "Accept").on_click({
                                                 let notification = notification.clone();
-                                                let model = cx.model().clone();
+                                                let model = cx.entity().clone();
                                                 move |_, _, cx| {
                                                     model.update(cx, |this, cx| {
                                                         this.respond_to_notification(
@@ -570,7 +570,7 @@ impl NotificationPanel {
 
                 workspace.dismiss_notification(&id, cx);
                 workspace.show_notification(id, cx, |cx| {
-                    let workspace = cx.model().downgrade();
+                    let workspace = cx.entity().downgrade();
                     cx.new(|_| NotificationToast {
                         notification_id,
                         actor,

crates/command_palette/src/command_palette.rs 🔗

@@ -107,7 +107,7 @@ impl CommandPalette {
             .collect();
 
         let delegate =
-            CommandPaletteDelegate::new(cx.model().downgrade(), commands, previous_focus_handle);
+            CommandPaletteDelegate::new(cx.entity().downgrade(), commands, previous_focus_handle);
 
         let picker = cx.new(|cx| {
             let picker = Picker::uniform_list(delegate, window, cx);

crates/diagnostics/src/diagnostics.rs 🔗

@@ -283,7 +283,7 @@ impl ProjectDiagnosticsEditor {
         if let Some(existing) = workspace.item_of_type::<ProjectDiagnosticsEditor>(cx) {
             workspace.activate_item(&existing, true, true, window, cx);
         } else {
-            let workspace_handle = cx.model().downgrade();
+            let workspace_handle = cx.entity().downgrade();
 
             let include_warnings = match cx.try_global::<IncludeWarnings>() {
                 Some(include_warnings) => include_warnings.0,

crates/editor/src/code_context_menus.rs 🔗

@@ -495,7 +495,7 @@ impl CompletionsMenu {
         let last_rendered_range = self.last_rendered_range.clone();
         let style = style.clone();
         let list = uniform_list(
-            cx.model().clone(),
+            cx.entity().clone(),
             "completions",
             self.entries.borrow().len(),
             move |_editor, range, _window, cx| {
@@ -1090,7 +1090,7 @@ impl CodeActionsMenu {
         let actions = self.actions.clone();
         let selected_item = self.selected_item;
         let list = uniform_list(
-            cx.model().clone(),
+            cx.entity().clone(),
             "code_actions_menu",
             self.actions.len(),
             move |_this, range, _, cx| {

crates/editor/src/editor.rs 🔗

@@ -1159,7 +1159,7 @@ impl Editor {
     ) -> Self {
         let style = window.text_style();
         let font_size = style.font_size.to_pixels(window.rem_size());
-        let editor = cx.model().downgrade();
+        let editor = cx.entity().downgrade();
         let fold_placeholder = FoldPlaceholder {
             constrain_width: true,
             render: Arc::new(move |fold_id, fold_range, _, cx| {
@@ -15339,7 +15339,7 @@ impl Render for Editor {
         };
 
         EditorElement::new(
-            &cx.model(),
+            &cx.entity(),
             EditorStyle {
                 background,
                 local_player: cx.theme().players().local(),

crates/editor/src/editor_tests.rs 🔗

@@ -62,7 +62,7 @@ fn test_edit_events(cx: &mut TestAppContext) {
     let editor1 = cx.add_window({
         let events = events.clone();
         |window, cx| {
-            let model = cx.model().clone();
+            let model = cx.entity().clone();
             cx.subscribe_in(
                 &model,
                 window,
@@ -83,7 +83,7 @@ fn test_edit_events(cx: &mut TestAppContext) {
         let events = events.clone();
         |window, cx| {
             cx.subscribe_in(
-                &cx.model().clone(),
+                &cx.entity().clone(),
                 window,
                 move |_, _, event: &EditorEvent, _, _| match event {
                     EditorEvent::Edited { .. } => events.borrow_mut().push(("editor2", "edited")),
@@ -689,7 +689,7 @@ async fn test_navigation_history(cx: &mut TestAppContext) {
         cx.new(|cx| {
             let buffer = MultiBuffer::build_simple(&sample_text(300, 5, 'a'), cx);
             let mut editor = build_editor(buffer.clone(), window, cx);
-            let handle = cx.model();
+            let handle = cx.entity();
             editor.set_nav_history(Some(pane.read(cx).nav_history_for_item(&handle)));
 
             fn pop_history(editor: &mut Editor, cx: &mut App) -> Option<NavigationEntry> {
@@ -10180,8 +10180,8 @@ async fn test_following(cx: &mut gpui::TestAppContext) {
     let is_still_following = Rc::new(RefCell::new(true));
     let follower_edit_event_count = Rc::new(RefCell::new(0));
     let pending_update = Rc::new(RefCell::new(None));
-    let leader_model = leader.root_model(cx).unwrap();
-    let follower_model = follower.root_model(cx).unwrap();
+    let leader_model = leader.root(cx).unwrap();
+    let follower_model = follower.root(cx).unwrap();
     _ = follower.update(cx, {
         let update = pending_update.clone();
         let is_still_following = is_still_following.clone();
@@ -10368,7 +10368,7 @@ async fn test_following_with_multiple_excerpts(cx: &mut gpui::TestAppContext) {
     // Start following the editor when it has no excerpts.
     let mut state_message =
         leader.update_in(cx, |leader, window, cx| leader.to_state_proto(window, cx));
-    let workspace_model = workspace.root_model(cx).unwrap();
+    let workspace_model = workspace.root(cx).unwrap();
     let follower_1 = cx
         .update_window(*workspace.deref(), |_, window, cx| {
             Editor::from_state_proto(
@@ -10470,7 +10470,7 @@ async fn test_following_with_multiple_excerpts(cx: &mut gpui::TestAppContext) {
     // Start following separately after it already has excerpts.
     let mut state_message =
         leader.update_in(cx, |leader, window, cx| leader.to_state_proto(window, cx));
-    let workspace_model = workspace.root_model(cx).unwrap();
+    let workspace_model = workspace.root(cx).unwrap();
     let follower_2 = cx
         .update_window(*workspace.deref(), |_, window, cx| {
             Editor::from_state_proto(
@@ -14497,7 +14497,7 @@ fn test_crease_insertion_and_rendering(cx: &mut TestAppContext) {
             let _div = snapshot.render_crease_toggle(
                 MultiBufferRow(1),
                 false,
-                cx.model().clone(),
+                cx.entity().clone(),
                 window,
                 cx,
             );
@@ -14718,7 +14718,7 @@ async fn test_goto_definition_with_find_all_references_fallback(cx: &mut gpui::T
             "Initially, only one, test, editor should be open in the workspace"
         );
         assert_eq!(
-            test_editor_cx.model(),
+            test_editor_cx.entity(),
             editors.last().expect("Asserted len is 1").clone()
         );
     });
@@ -14754,7 +14754,7 @@ async fn test_goto_definition_with_find_all_references_fallback(cx: &mut gpui::T
         );
         let references_fallback_text = editors
             .into_iter()
-            .find(|new_editor| *new_editor != test_editor_cx.model())
+            .find(|new_editor| *new_editor != test_editor_cx.entity())
             .expect("Should have one non-test editor now")
             .read(test_editor_cx)
             .text(test_editor_cx);

crates/editor/src/element.rs 🔗

@@ -6246,7 +6246,7 @@ impl Element for EditorElement {
 
                         let height = self.style.text.line_height_in_pixels(rem_size);
                         if auto_width {
-                            let editor_handle = cx.model().clone();
+                            let editor_handle = cx.entity().clone();
                             let style = self.style.clone();
                             window.request_measured_layout(
                                 Style::default(),
@@ -6287,7 +6287,7 @@ impl Element for EditorElement {
                         }
                     }
                     EditorMode::AutoHeight { max_lines } => {
-                        let editor_handle = cx.model().clone();
+                        let editor_handle = cx.entity().clone();
                         let max_line_number_width =
                             self.max_line_number_width(&editor.snapshot(window, cx), window, cx);
                         window.request_measured_layout(

crates/editor/src/git/project_diff.rs 🔗

@@ -77,7 +77,7 @@ impl ProjectDiffEditor {
         if let Some(existing) = workspace.item_of_type::<Self>(cx) {
             workspace.activate_item(&existing, true, true, window, cx);
         } else {
-            let workspace_handle = cx.model().downgrade();
+            let workspace_handle = cx.entity().downgrade();
             let project_diff =
                 cx.new(|cx| Self::new(workspace.project().clone(), workspace_handle, window, cx));
             workspace.add_item_to_active_pane(Box::new(project_diff), None, true, window, cx);

crates/editor/src/hunk_diff.rs 🔗

@@ -596,7 +596,7 @@ impl Editor {
             style: BlockStyle::Sticky,
             priority: 0,
             render: Arc::new({
-                let editor = cx.model().clone();
+                let editor = cx.entity().clone();
                 let hunk = hunk.clone();
                 let has_multiple_hunks = self.has_multiple_hunks(cx);
 
@@ -870,7 +870,7 @@ impl Editor {
         let deleted_hunk_color = deleted_hunk_color(cx);
         let (editor_height, editor_with_deleted_text) =
             editor_with_deleted_text(diff_base_buffer, deleted_hunk_color, hunk, window, cx);
-        let editor = cx.model().clone();
+        let editor = cx.entity().clone();
         let hunk = hunk.clone();
         let height = editor_height.max(deleted_text_height);
         BlockProperties {
@@ -1214,7 +1214,7 @@ fn editor_with_deleted_text(
     window: &mut Window,
     cx: &mut Context<Editor>,
 ) -> (u32, Model<Editor>) {
-    let parent_editor = cx.model().downgrade();
+    let parent_editor = cx.entity().downgrade();
     let editor = cx.new(|cx| {
         let multi_buffer = cx.new(|_| MultiBuffer::without_headers(language::Capability::ReadOnly));
         multi_buffer.update(cx, |multi_buffer, cx| {

crates/editor/src/scroll.rs 🔗

@@ -317,7 +317,7 @@ impl ScrollManager {
         self.show_scrollbar(window, cx);
         self.autoscroll_request.take();
         if let Some(workspace_id) = workspace_id {
-            let item_id = cx.model().entity_id().as_u64() as ItemId;
+            let item_id = cx.entity().entity_id().as_u64() as ItemId;
 
             cx.foreground_executor()
                 .spawn(async move {

crates/editor/src/test/editor_lsp_test_context.rs 🔗

@@ -133,7 +133,7 @@ impl EditorLspTestContext {
 
         let window = cx.add_window(|window, cx| Workspace::test_new(project.clone(), window, cx));
 
-        let workspace = window.root_model(cx).unwrap();
+        let workspace = window.root(cx).unwrap();
 
         let mut cx = VisualTestContext::from_window(*window.deref(), cx);
         project

crates/editor/src/test/editor_test_context.rs 🔗

@@ -67,7 +67,7 @@ impl EditorTestContext {
             window.focus(&editor.focus_handle(cx));
             editor
         });
-        let editor_view = editor.root_model(cx).unwrap();
+        let editor_view = editor.root(cx).unwrap();
 
         cx.run_until_parked();
         Self {
@@ -89,7 +89,7 @@ impl EditorTestContext {
     }
 
     pub async fn for_editor(editor: WindowHandle<Editor>, cx: &mut gpui::TestAppContext) -> Self {
-        let editor_view = editor.root_model(cx).unwrap();
+        let editor_view = editor.root(cx).unwrap();
         Self {
             cx: VisualTestContext::from_window(*editor.deref(), cx),
             window: editor.into(),
@@ -126,7 +126,7 @@ impl EditorTestContext {
             editor
         });
 
-        let editor_view = editor.root_model(cx).unwrap();
+        let editor_view = editor.root(cx).unwrap();
         Self {
             cx: VisualTestContext::from_window(*editor.deref(), cx),
             window: editor.into(),

crates/extensions_ui/src/extensions_ui.rs 🔗

@@ -74,7 +74,7 @@ pub fn init(cx: &mut App) {
                     cx,
                 );
 
-                let workspace_handle = cx.model().downgrade();
+                let workspace_handle = cx.entity().downgrade();
                 window
                     .spawn(cx, |mut cx| async move {
                         let extension_path =
@@ -533,7 +533,7 @@ impl ExtensionsPage {
         extension: &ExtensionMetadata,
         cx: &mut Context<Self>,
     ) -> ExtensionCard {
-        let this = cx.model().clone();
+        let this = cx.entity().clone();
         let status = Self::extension_status(&extension.id, cx);
         let has_dev_extension = Self::dev_extension_exists(&extension.id, cx);
 
@@ -715,7 +715,7 @@ impl ExtensionsPage {
                 workspace.toggle_modal(window, cx, |window, cx| {
                     let delegate = ExtensionVersionSelectorDelegate::new(
                         fs,
-                        cx.model().downgrade(),
+                        cx.entity().downgrade(),
                         extension_versions,
                     );
 
@@ -1160,7 +1160,7 @@ impl Render for ExtensionsPage {
                     return this.py_4().child(self.render_empty_state(cx));
                 }
 
-                let extensions_page = cx.model().clone();
+                let extensions_page = cx.entity().clone();
                 let scroll_handle = self.list.clone();
                 this.child(
                     uniform_list(extensions_page, "entries", count, Self::render_extensions)

crates/feedback/src/feedback_modal.rs 🔗

@@ -132,7 +132,7 @@ impl ModalView for FeedbackModal {
 
 impl FeedbackModal {
     pub fn register(workspace: &mut Workspace, _: &mut Window, cx: &mut Context<Workspace>) {
-        let _handle = cx.model().downgrade();
+        let _handle = cx.entity().downgrade();
         workspace.register_action(move |workspace, _: &GiveFeedback, window, cx| {
             workspace
                 .with_local_workspace(window, cx, |workspace, window, cx| {

crates/file_finder/src/file_finder.rs 🔗

@@ -147,10 +147,10 @@ impl FileFinder {
             workspace
                 .update_in(&mut cx, |workspace, window, cx| {
                     let project = workspace.project().clone();
-                    let weak_workspace = cx.model().downgrade();
+                    let weak_workspace = cx.entity().downgrade();
                     workspace.toggle_modal(window, cx, |window, cx| {
                         let delegate = FileFinderDelegate::new(
-                            cx.model().downgrade(),
+                            cx.entity().downgrade(),
                             weak_workspace,
                             project,
                             currently_opened_path,

crates/git_ui/src/git_panel.rs 🔗

@@ -156,7 +156,7 @@ impl GitPanel {
         let git_state = project.read(cx).git_state().cloned();
         let active_repository = project.read(cx).active_repository(cx);
         let (err_sender, mut err_receiver) = mpsc::channel(1);
-        let workspace = cx.model().downgrade();
+        let workspace = cx.entity().downgrade();
 
         let git_panel = cx.new(|cx| {
             let focus_handle = cx.focus_handle();
@@ -193,7 +193,7 @@ impl GitPanel {
                 current_modifiers: window.modifiers(),
                 width: Some(px(360.)),
                 scrollbar_state: ScrollbarState::new(scroll_handle.clone())
-                    .parent_model(&cx.model()),
+                    .parent_model(&cx.entity()),
                 selected_entry: None,
                 show_scrollbar: false,
                 hide_scrollbar_task: None,
@@ -703,7 +703,7 @@ impl GitPanel {
     }
 
     fn schedule_update(&mut self, window: &mut Window, cx: &mut Context<Self>) {
-        let handle = cx.model().downgrade();
+        let handle = cx.entity().downgrade();
         self.update_visible_entries_task = cx.spawn_in(window, |_, mut cx| async move {
             cx.background_executor().timer(UPDATE_DEBOUNCE).await;
             if let Some(this) = handle.upgrade() {
@@ -1114,7 +1114,7 @@ impl GitPanel {
             .size_full()
             .overflow_hidden()
             .child(
-                uniform_list(cx.model().clone(), "entries", entry_count, {
+                uniform_list(cx.entity().clone(), "entries", entry_count, {
                     move |git_panel, range, _window, cx| {
                         let mut items = Vec::with_capacity(range.end - range.start);
                         git_panel.for_each_visible_entry(range, cx, |ix, details, cx| {
@@ -1167,7 +1167,7 @@ impl GitPanel {
         let checkbox_id =
             ElementId::Name(format!("checkbox_{}", entry_details.display_name).into());
         let is_tree_view = false;
-        let handle = cx.model().downgrade();
+        let handle = cx.entity().downgrade();
 
         let end_slot = h_flex()
             .invisible()

crates/git_ui/src/repository_selector.rs 🔗

@@ -27,7 +27,7 @@ impl RepositorySelector {
         let filtered_repositories = all_repositories.clone();
         let delegate = RepositorySelectorDelegate {
             project: project.downgrade(),
-            repository_selector: cx.model().downgrade(),
+            repository_selector: cx.entity().downgrade(),
             repository_entries: all_repositories,
             filtered_repositories,
             selected_index: 0,

crates/go_to_line/src/go_to_line.rs 🔗

@@ -42,7 +42,7 @@ enum GoToLineRowHighlights {}
 
 impl GoToLine {
     fn register(editor: &mut Editor, _window: Option<&mut Window>, cx: &mut Context<Editor>) {
-        let handle = cx.model().downgrade();
+        let handle = cx.entity().downgrade();
         editor
             .register_action(move |_: &editor::actions::ToggleGoToLine, window, cx| {
                 let Some(editor_handle) = handle.upgrade() else {
@@ -94,7 +94,7 @@ impl GoToLine {
 
         let line_editor = cx.new(|cx| {
             let mut editor = Editor::single_line(window, cx);
-            let editor_handle = cx.model().downgrade();
+            let editor_handle = cx.entity().downgrade();
             editor
                 .register_action::<Tab>({
                     move |_, window, cx| {

crates/gpui/examples/input.rs 🔗

@@ -572,7 +572,7 @@ impl Render for TextInput {
                     .p(px(4.))
                     .bg(white())
                     .child(TextElement {
-                        input: cx.model().clone(),
+                        input: cx.entity().clone(),
                     }),
             )
     }
@@ -697,7 +697,7 @@ fn main() {
                 },
             )
             .unwrap();
-        let view = window.root_model(cx).unwrap();
+        let view = window.root(cx).unwrap();
         cx.observe_keystrokes(move |ev, _, cx| {
             view.update(cx, |view, cx| {
                 view.recent_keystrokes.push(ev.keystroke.clone());

crates/gpui/examples/uniform_list.rs 🔗

@@ -9,7 +9,7 @@ impl Render for UniformListExample {
     fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
         div().size_full().bg(rgb(0xffffff)).child(
             uniform_list(
-                cx.model().clone(),
+                cx.entity().clone(),
                 "entries",
                 50,
                 |_this, range, _window, _cx| {

crates/gpui/src/app.rs 🔗

@@ -603,7 +603,7 @@ impl App {
                     cx.window_update_stack.push(id);
                     let root_view = build_root_view(&mut window, cx);
                     cx.window_update_stack.pop();
-                    window.root_model.replace(root_view.into());
+                    window.root.replace(root_view.into());
                     window.defer(cx, |window: &mut Window, cx| window.appearance_changed(cx));
                     cx.window_handles.insert(id, window.handle);
                     cx.windows.get_mut(id).unwrap().replace(window);
@@ -999,7 +999,7 @@ impl App {
                 .take()
                 .ok_or_else(|| anyhow!("window not found"))?;
 
-            let root_view = window.root_model.clone().unwrap();
+            let root_view = window.root.clone().unwrap();
 
             cx.window_update_stack.push(window.handle.id);
             let result = update(root_view, &mut window, cx);
@@ -1666,7 +1666,7 @@ impl AppContext for App {
             .as_ref()
             .expect("attempted to read a window that is already on the stack");
 
-        let root_view = window.root_model.clone().unwrap();
+        let root_view = window.root.clone().unwrap();
         let view = root_view
             .downcast::<T>()
             .map_err(|_| anyhow!("root view's type has changed"))?;

crates/gpui/src/app/async_context.rs 🔗

@@ -399,9 +399,8 @@ impl VisualContext for AsyncWindowContext {
     where
         V: 'static + Render,
     {
-        self.window.update(self, |_, window, cx| {
-            window.replace_root_model(cx, build_view)
-        })
+        self.window
+            .update(self, |_, window, cx| window.replace_root(cx, build_view))
     }
 
     fn focus<V>(&mut self, view: &Entity<V>) -> Self::Result<()>

crates/gpui/src/app/model_context.rs 🔗

@@ -35,14 +35,14 @@ impl<'a, T: 'static> Context<'a, T> {
     }
 
     /// Returns a handle to the model belonging to this context.
-    pub fn model(&self) -> Entity<T> {
-        self.weak_model()
+    pub fn entity(&self) -> Entity<T> {
+        self.weak_entity()
             .upgrade()
             .expect("The entity must be alive if we have a model context")
     }
 
     /// Returns a weak handle to the model belonging to this context.
-    pub fn weak_model(&self) -> WeakEntity<T> {
+    pub fn weak_entity(&self) -> WeakEntity<T> {
         self.model_state.clone()
     }
 
@@ -57,7 +57,7 @@ impl<'a, T: 'static> Context<'a, T> {
         T: 'static,
         W: 'static,
     {
-        let this = self.weak_model();
+        let this = self.weak_entity();
         self.app.observe_internal(entity, move |e, cx| {
             if let Some(this) = this.upgrade() {
                 this.update(cx, |this, cx| on_notify(this, e, cx));
@@ -79,7 +79,7 @@ impl<'a, T: 'static> Context<'a, T> {
         T2: 'static + EventEmitter<Evt>,
         Evt: 'static,
     {
-        let this = self.weak_model();
+        let this = self.weak_entity();
         self.app.subscribe_internal(entity, move |e, event, cx| {
             if let Some(this) = this.upgrade() {
                 this.update(cx, |this, cx| on_event(this, e, event, cx));
@@ -117,7 +117,7 @@ impl<'a, T: 'static> Context<'a, T> {
         T2: 'static,
     {
         let entity_id = entity.entity_id();
-        let this = self.weak_model();
+        let this = self.weak_entity();
         let (subscription, activate) = self.app.release_listeners.insert(
             entity_id,
             Box::new(move |entity, cx| {
@@ -139,7 +139,7 @@ impl<'a, T: 'static> Context<'a, T> {
     where
         T: 'static,
     {
-        let handle = self.weak_model();
+        let handle = self.weak_entity();
         let (subscription, activate) = self.global_observers.insert(
             TypeId::of::<G>(),
             Box::new(move |cx| handle.update(cx, |view, cx| f(view, cx)).is_ok()),
@@ -158,7 +158,7 @@ impl<'a, T: 'static> Context<'a, T> {
         Fut: 'static + Future<Output = ()>,
         T: 'static,
     {
-        let handle = self.weak_model();
+        let handle = self.weak_entity();
         let (subscription, activate) = self.app.quit_observers.insert(
             (),
             Box::new(move |cx| {
@@ -189,7 +189,7 @@ impl<'a, T: 'static> Context<'a, T> {
         Fut: Future<Output = R> + 'static,
         R: 'static,
     {
-        let this = self.weak_model();
+        let this = self.weak_entity();
         self.app.spawn(|cx| f(this, cx))
     }
 
@@ -202,7 +202,7 @@ impl<'a, T: 'static> Context<'a, T> {
         &self,
         f: impl Fn(&mut T, &E, &mut Window, &mut Context<T>) + 'static,
     ) -> impl Fn(&E, &mut Window, &mut App) + 'static {
-        let view = self.model().downgrade();
+        let view = self.entity().downgrade();
         move |e: &E, window: &mut Window, cx: &mut App| {
             view.update(cx, |view, cx| f(view, e, window, cx)).ok();
         }
@@ -221,7 +221,7 @@ impl<'a, T: 'static> Context<'a, T> {
     ) where
         T: 'static,
     {
-        let view = self.model();
+        let view = self.entity();
         window.on_next_frame(move |window, cx| view.update(cx, |view, cx| f(view, window, cx)));
     }
 
@@ -232,7 +232,7 @@ impl<'a, T: 'static> Context<'a, T> {
         window: &Window,
         f: impl FnOnce(&mut T, &mut Window, &mut Context<T>) + 'static,
     ) {
-        let view = self.model();
+        let view = self.entity();
         window.defer(self, move |window, cx| {
             view.update(cx, |view, cx| f(view, window, cx))
         });
@@ -252,7 +252,7 @@ impl<'a, T: 'static> Context<'a, T> {
         let observed_id = observed.entity_id();
         let observed = observed.downgrade();
         let window_handle = window.handle;
-        let observer = self.weak_model();
+        let observer = self.weak_entity();
         self.new_observer(
             observed_id,
             Box::new(move |cx| {
@@ -290,7 +290,7 @@ impl<'a, T: 'static> Context<'a, T> {
     {
         let emitter = emitter.downgrade();
         let window_handle = window.handle;
-        let subscriber = self.weak_model();
+        let subscriber = self.weak_entity();
         self.new_subscription(
             emitter.entity_id(),
             (
@@ -348,7 +348,7 @@ impl<'a, T: 'static> Context<'a, T> {
         T: 'static,
         V2: 'static,
     {
-        let observer = self.weak_model();
+        let observer = self.weak_entity();
         let window_handle = window.handle;
         let (subscription, activate) = self.release_listeners.insert(
             observed.entity_id(),
@@ -371,7 +371,7 @@ impl<'a, T: 'static> Context<'a, T> {
         window: &mut Window,
         mut callback: impl FnMut(&mut T, &mut Window, &mut Context<T>) + 'static,
     ) -> Subscription {
-        let view = self.weak_model();
+        let view = self.weak_entity();
         let (subscription, activate) = window.bounds_observers.insert(
             (),
             Box::new(move |window, cx| {
@@ -389,7 +389,7 @@ impl<'a, T: 'static> Context<'a, T> {
         window: &mut Window,
         mut callback: impl FnMut(&mut T, &mut Window, &mut Context<T>) + 'static,
     ) -> Subscription {
-        let view = self.weak_model();
+        let view = self.weak_entity();
         let (subscription, activate) = window.activation_observers.insert(
             (),
             Box::new(move |window, cx| {
@@ -407,7 +407,7 @@ impl<'a, T: 'static> Context<'a, T> {
         window: &mut Window,
         mut callback: impl FnMut(&mut T, &mut Window, &mut Context<T>) + 'static,
     ) -> Subscription {
-        let view = self.weak_model();
+        let view = self.weak_entity();
         let (subscription, activate) = window.appearance_observers.insert(
             (),
             Box::new(move |window, cx| {
@@ -435,7 +435,7 @@ impl<'a, T: 'static> Context<'a, T> {
             subscription
         }
 
-        let view = self.weak_model();
+        let view = self.weak_entity();
         inner(
             &mut self.keystroke_observers,
             Box::new(move |event, window, cx| {
@@ -455,7 +455,7 @@ impl<'a, T: 'static> Context<'a, T> {
         window: &mut Window,
         mut callback: impl FnMut(&mut T, &mut Window, &mut Context<T>) + 'static,
     ) -> Subscription {
-        let view = self.weak_model();
+        let view = self.weak_entity();
         let (subscription, activate) = window.pending_input_observers.insert(
             (),
             Box::new(move |window, cx| {
@@ -475,7 +475,7 @@ impl<'a, T: 'static> Context<'a, T> {
         window: &mut Window,
         mut listener: impl FnMut(&mut T, &mut Window, &mut Context<T>) + 'static,
     ) -> Subscription {
-        let view = self.weak_model();
+        let view = self.weak_entity();
         let focus_id = handle.id;
         let (subscription, activate) =
             window.new_focus_listener(Box::new(move |event, window, cx| {
@@ -501,7 +501,7 @@ impl<'a, T: 'static> Context<'a, T> {
         window: &mut Window,
         mut listener: impl FnMut(&mut T, &mut Window, &mut Context<T>) + 'static,
     ) -> Subscription {
-        let view = self.weak_model();
+        let view = self.weak_entity();
         let focus_id = handle.id;
         let (subscription, activate) =
             window.new_focus_listener(Box::new(move |event, window, cx| {
@@ -524,7 +524,7 @@ impl<'a, T: 'static> Context<'a, T> {
         window: &mut Window,
         mut listener: impl FnMut(&mut T, &mut Window, &mut Context<T>) + 'static,
     ) -> Subscription {
-        let view = self.weak_model();
+        let view = self.weak_entity();
         let focus_id = handle.id;
         let (subscription, activate) =
             window.new_focus_listener(Box::new(move |event, window, cx| {
@@ -550,7 +550,7 @@ impl<'a, T: 'static> Context<'a, T> {
         window: &mut Window,
         mut listener: impl FnMut(&mut T, &mut Window, &mut Context<T>) + 'static,
     ) -> Subscription {
-        let view = self.weak_model();
+        let view = self.weak_entity();
         let (subscription, activate) = window.focus_lost_listeners.insert(
             (),
             Box::new(move |window, cx| {
@@ -570,7 +570,7 @@ impl<'a, T: 'static> Context<'a, T> {
         window: &mut Window,
         mut listener: impl FnMut(&mut T, FocusOutEvent, &mut Window, &mut Context<T>) + 'static,
     ) -> Subscription {
-        let view = self.weak_model();
+        let view = self.weak_entity();
         let focus_id = handle.id;
         let (subscription, activate) =
             window.new_focus_listener(Box::new(move |event, window, cx| {
@@ -606,7 +606,7 @@ impl<'a, T: 'static> Context<'a, T> {
         R: 'static,
         Fut: Future<Output = R> + 'static,
     {
-        let view = self.weak_model();
+        let view = self.weak_entity();
         window.spawn(self, |mut cx| f(view, cx))
     }
 
@@ -617,7 +617,7 @@ impl<'a, T: 'static> Context<'a, T> {
         mut f: impl FnMut(&mut T, &mut Window, &mut Context<'_, T>) + 'static,
     ) -> Subscription {
         let window_handle = window.handle;
-        let view = self.weak_model();
+        let view = self.weak_entity();
         let (subscription, activate) = self.global_observers.insert(
             TypeId::of::<G>(),
             Box::new(move |cx| {
@@ -639,7 +639,7 @@ impl<'a, T: 'static> Context<'a, T> {
         window: &mut Window,
         listener: impl Fn(&mut T, &dyn Any, DispatchPhase, &mut Window, &mut Context<T>) + 'static,
     ) {
-        let handle = self.weak_model();
+        let handle = self.weak_entity();
         window.on_action(action_type, move |action, phase, window, cx| {
             handle
                 .update(cx, |view, cx| {
@@ -654,7 +654,7 @@ impl<'a, T: 'static> Context<'a, T> {
     where
         T: Focusable,
     {
-        let view = self.model();
+        let view = self.entity();
         window.defer(self, move |window, cx| {
             view.read(cx).focus_handle(cx).focus(window)
         })

crates/gpui/src/app/test_context.rs 🔗

@@ -238,7 +238,7 @@ impl TestAppContext {
             )
             .unwrap();
         drop(cx);
-        let view = window.root_model(self).unwrap();
+        let view = window.root(self).unwrap();
         let cx = VisualTestContext::from_window(*window.deref(), self).as_mut();
         cx.run_until_parked();
 
@@ -946,7 +946,7 @@ impl VisualContext for VisualTestContext {
     {
         self.window
             .update(&mut self.cx, |_, window, cx| {
-                window.replace_root_model(cx, build_view)
+                window.replace_root(cx, build_view)
             })
             .unwrap()
     }

crates/gpui/src/window.rs 🔗

@@ -609,7 +609,7 @@ pub struct Window {
     rem_size_override_stack: SmallVec<[Pixels; 8]>,
     pub(crate) viewport_size: Size<Pixels>,
     layout_engine: Option<TaffyLayoutEngine>,
-    pub(crate) root_model: Option<AnyView>,
+    pub(crate) root: Option<AnyView>,
     pub(crate) element_id_stack: SmallVec<[ElementId; 32]>,
     pub(crate) text_style_stack: Vec<TextStyleRefinement>,
     pub(crate) element_offset_stack: Vec<Point<Pixels>>,
@@ -887,7 +887,7 @@ impl Window {
             rem_size_override_stack: SmallVec::new(),
             viewport_size: content_size,
             layout_engine: Some(TaffyLayoutEngine::new()),
-            root_model: None,
+            root: None,
             element_id_stack: SmallVec::default(),
             text_style_stack: Vec::new(),
             element_offset_stack: Vec::new(),
@@ -1019,27 +1019,27 @@ impl Window {
         subscription
     }
 
-    pub fn replace_root_model<V>(
+    pub fn replace_root<E>(
         &mut self,
         cx: &mut App,
-        build_view: impl FnOnce(&mut Window, &mut Context<'_, V>) -> V,
-    ) -> Entity<V>
+        build_view: impl FnOnce(&mut Window, &mut Context<'_, E>) -> E,
+    ) -> Entity<E>
     where
-        V: 'static + Render,
+        E: 'static + Render,
     {
         let view = cx.new(|cx| build_view(self, cx));
-        self.root_model = Some(view.clone().into());
+        self.root = Some(view.clone().into());
         self.refresh();
         view
     }
 
-    pub fn root_model<V>(&mut self) -> Option<Option<Entity<V>>>
+    pub fn root<E>(&self) -> Option<Option<Entity<E>>>
     where
-        V: 'static + Render,
+        E: 'static + Render,
     {
-        self.root_model
+        self.root
             .as_ref()
-            .map(|view| view.clone().downcast::<V>().ok())
+            .map(|view| view.clone().downcast::<E>().ok())
     }
 
     /// Obtain a handle to the window that belongs to this context.
@@ -1632,7 +1632,7 @@ impl Window {
         self.tooltip_bounds.take();
 
         // Layout all root elements.
-        let mut root_element = self.root_model.as_ref().unwrap().clone().into_any();
+        let mut root_element = self.root.as_ref().unwrap().clone().into_any();
         root_element.prepaint_as_root(Point::default(), self.viewport_size.into(), self, cx);
 
         let mut sorted_deferred_draws =
@@ -3816,7 +3816,7 @@ impl<V: 'static + Render> WindowHandle<V> {
             .and_then(|window| {
                 window
                     .as_ref()
-                    .and_then(|window| window.root_model.clone())
+                    .and_then(|window| window.root.clone())
                     .map(|root_view| root_view.downcast::<V>())
             })
             .ok_or_else(|| anyhow!("window not found"))?
@@ -3838,7 +3838,7 @@ impl<V: 'static + Render> WindowHandle<V> {
     /// Read the root view pointer off of this window.
     ///
     /// This will fail if the window is closed or if the root view's type does not match `V`.
-    pub fn root_model<C>(&self, cx: &C) -> Result<Entity<V>>
+    pub fn entity<C>(&self, cx: &C) -> Result<Entity<V>>
     where
         C: AppContext,
     {

crates/inline_completion_button/src/inline_completion_button.rs 🔗

@@ -121,7 +121,7 @@ impl Render for InlineCompletionButton {
                             }),
                     );
                 }
-                let this = cx.model().clone();
+                let this = cx.entity().clone();
 
                 div().child(
                     PopoverMenu::new("copilot")
@@ -173,7 +173,7 @@ impl Render for InlineCompletionButton {
                 let icon = status.to_icon();
                 let tooltip_text = status.to_tooltip();
                 let has_menu = status.has_menu();
-                let this = cx.model().clone();
+                let this = cx.entity().clone();
                 let fs = self.fs.clone();
 
                 return div().child(
@@ -268,7 +268,7 @@ impl Render for InlineCompletionButton {
                     );
                 }
 
-                let this = cx.model().clone();
+                let this = cx.entity().clone();
                 let button = IconButton::new("zeta", IconName::ZedPredict).when(
                     !self.popover_menu_handle.is_deployed(),
                     |button| {
@@ -399,7 +399,7 @@ impl InlineCompletionButton {
                 None,
                 move |window, cx| {
                     if let Some(workspace) = window.window_handle().downcast::<Workspace>() {
-                        if let Ok(workspace) = workspace.root_model(cx) {
+                        if let Ok(workspace) = workspace.root(cx) {
                             let workspace = workspace.downgrade();
                             window
                                 .spawn(cx, |cx| {

crates/language/src/buffer.rs 🔗

@@ -972,7 +972,7 @@ impl Buffer {
     }
 
     pub fn branch(&mut self, cx: &mut Context<Self>) -> Entity<Self> {
-        let this = cx.model();
+        let this = cx.entity();
         cx.new(|cx| {
             let mut branch = Self {
                 branch_state: Some(BufferBranchState {

crates/language/src/buffer_tests.rs 🔗

@@ -2805,7 +2805,7 @@ fn test_random_collaboration(cx: &mut App, mut rng: StdRng) {
             );
             buffer.set_group_interval(Duration::from_millis(rng.gen_range(0..=200)));
             let network = network.clone();
-            cx.subscribe(&cx.model(), move |buffer, _, event, _| {
+            cx.subscribe(&cx.entity(), move |buffer, _, event, _| {
                 if let BufferEvent::Operation {
                     operation,
                     is_local: true,
@@ -2936,7 +2936,7 @@ fn test_random_collaboration(cx: &mut App, mut rng: StdRng) {
                     );
                     new_buffer.set_group_interval(Duration::from_millis(rng.gen_range(0..=200)));
                     let network = network.clone();
-                    cx.subscribe(&cx.model(), move |buffer, _, event, _| {
+                    cx.subscribe(&cx.entity(), move |buffer, _, event, _| {
                         if let BufferEvent::Operation {
                             operation,
                             is_local: true,

crates/language_model_selector/src/language_model_selector.rs 🔗

@@ -33,7 +33,7 @@ impl LanguageModelSelector {
 
         let all_models = Self::all_models(cx);
         let delegate = LanguageModelPickerDelegate {
-            language_model_selector: cx.model().downgrade(),
+            language_model_selector: cx.entity().downgrade(),
             on_model_changed: on_model_changed.clone(),
             all_models: all_models.clone(),
             filtered_models: all_models,

crates/language_models/src/provider/cloud.rs 🔗

@@ -124,7 +124,7 @@ impl RefreshLlmTokenListener {
     fn new(client: Arc<Client>, cx: &mut Context<Self>) -> Self {
         Self {
             _llm_token_subscription: client
-                .add_message_handler(cx.weak_model(), Self::handle_refresh_llm_token),
+                .add_message_handler(cx.weak_entity(), Self::handle_refresh_llm_token),
         }
     }
 

crates/language_selector/src/language_selector.rs 🔗

@@ -67,7 +67,7 @@ impl LanguageSelector {
         cx: &mut Context<Self>,
     ) -> Self {
         let delegate = LanguageSelectorDelegate::new(
-            cx.model().downgrade(),
+            cx.entity().downgrade(),
             buffer,
             project,
             language_registry,

crates/language_tools/src/lsp_log.rs 🔗

@@ -242,7 +242,7 @@ impl LogStore {
                 if let copilot::Event::CopilotLanguageServerStarted = inline_completion_event {
                     if let Some(server) = copilot.read(cx).language_server() {
                         let server_id = server.server_id();
-                        let weak_this = cx.weak_model();
+                        let weak_this = cx.weak_entity();
                         this.copilot_log_subscription =
                             Some(server.on_notification::<copilot::request::LogMessage, _>(
                                 move |params, mut cx| {
@@ -926,7 +926,7 @@ impl LspLogView {
                 .expect("log buffer should be a singleton")
                 .update(cx, |_, cx| {
                     cx.spawn({
-                        let buffer = cx.model();
+                        let buffer = cx.entity();
                         |_, mut cx| async move {
                             let language = language.await.ok();
                             buffer.update(&mut cx, |buffer, cx| {
@@ -1222,7 +1222,7 @@ impl Render for LspLogToolbarItemView {
                 )
             })
             .collect();
-        let log_toolbar_view = cx.model().clone();
+        let log_toolbar_view = cx.entity().clone();
         let lsp_menu = PopoverMenu::new("LspLogView")
             .anchor(Corner::TopLeft)
             .trigger(Button::new(

crates/language_tools/src/syntax_tree_view.rs 🔗

@@ -303,7 +303,7 @@ impl Render for SyntaxTreeView {
         {
             let layer = layer.clone();
             rendered = rendered.child(uniform_list(
-                cx.model().clone(),
+                cx.entity().clone(),
                 "SyntaxTreeView",
                 layer.node().descendant_count(),
                 move |this, range, _, cx| {
@@ -451,7 +451,7 @@ impl SyntaxTreeToolbarItemView {
         let active_layer = buffer_state.active_layer.clone()?;
         let active_buffer = buffer_state.buffer.read(cx).snapshot();
 
-        let view = cx.model().clone();
+        let view = cx.entity().clone();
         Some(
             PopoverMenu::new("Syntax Tree")
                 .trigger(Self::render_header(&active_layer))

crates/markdown/src/markdown.rs 🔗

@@ -219,7 +219,7 @@ impl Markdown {
 impl Render for Markdown {
     fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
         MarkdownElement::new(
-            cx.model().clone(),
+            cx.entity().clone(),
             self.style.clone(),
             self.language_registry.clone(),
             self.fallback_code_block_language.clone(),

crates/markdown_preview/src/markdown_preview_view.rs 🔗

@@ -144,7 +144,7 @@ impl MarkdownPreviewView {
         cx: &mut Context<Workspace>,
     ) -> Entity<Self> {
         cx.new(|cx| {
-            let view = cx.model().downgrade();
+            let view = cx.entity().downgrade();
 
             let list_state = ListState::new(
                 0,

crates/notifications/src/notification_store.rs 🔗

@@ -103,9 +103,9 @@ impl NotificationStore {
             channel_messages: Default::default(),
             _watch_connection_status: watch_connection_status,
             _subscriptions: vec![
-                client.add_message_handler(cx.weak_model(), Self::handle_new_notification),
-                client.add_message_handler(cx.weak_model(), Self::handle_delete_notification),
-                client.add_message_handler(cx.weak_model(), Self::handle_update_notification),
+                client.add_message_handler(cx.weak_entity(), Self::handle_new_notification),
+                client.add_message_handler(cx.weak_entity(), Self::handle_delete_notification),
+                client.add_message_handler(cx.weak_entity(), Self::handle_update_notification),
             ],
             user_store,
             client,

crates/outline/src/outline.rs 🔗

@@ -88,7 +88,7 @@ impl Render for OutlineView {
 impl OutlineView {
     fn register(editor: &mut Editor, _: Option<&mut Window>, cx: &mut Context<Editor>) {
         if editor.mode() == EditorMode::Full {
-            let handle = cx.model().downgrade();
+            let handle = cx.entity().downgrade();
             editor
                 .register_action(move |action, window, cx| {
                     if let Some(editor) = handle.upgrade() {
@@ -105,7 +105,7 @@ impl OutlineView {
         window: &mut Window,
         cx: &mut Context<Self>,
     ) -> OutlineView {
-        let delegate = OutlineViewDelegate::new(cx.model().downgrade(), outline, editor, cx);
+        let delegate = OutlineViewDelegate::new(cx.entity().downgrade(), outline, editor, cx);
         let picker = cx.new(|cx| {
             Picker::uniform_list(delegate, window, cx).max_height(Some(vh(0.75, window)))
         });

crates/outline_panel/src/outline_panel.rs 🔗

@@ -709,7 +709,7 @@ impl OutlinePanel {
         cx: &mut Context<Workspace>,
     ) -> Entity<Self> {
         let project = workspace.project().clone();
-        let workspace_handle = cx.model().downgrade();
+        let workspace_handle = cx.entity().downgrade();
         let outline_panel = cx.new(|cx| {
             let filter_editor = cx.new(|cx| {
                 let mut editor = Editor::single_line(window, cx);
@@ -796,9 +796,9 @@ impl OutlinePanel {
                 show_scrollbar: !Self::should_autohide_scrollbar(cx),
                 hide_scrollbar_task: None,
                 vertical_scrollbar_state: ScrollbarState::new(scroll_handle.clone())
-                    .parent_model(&cx.model()),
+                    .parent_model(&cx.entity()),
                 horizontal_scrollbar_state: ScrollbarState::new(scroll_handle.clone())
-                    .parent_model(&cx.model()),
+                    .parent_model(&cx.entity()),
                 max_width_item_index: None,
                 scroll_handle,
                 focus_handle,
@@ -4467,7 +4467,7 @@ impl OutlinePanel {
                 let multi_buffer_snapshot = self
                     .active_editor()
                     .map(|editor| editor.read(cx).buffer().read(cx).snapshot(cx));
-                uniform_list(cx.model().clone(), "entries", items_len, {
+                uniform_list(cx.entity().clone(), "entries", items_len, {
                     move |outline_panel, range, window, cx| {
                         let entries = outline_panel.cached_entries.get(range);
                         entries
@@ -4534,7 +4534,7 @@ impl OutlinePanel {
                 .when(show_indent_guides, |list| {
                     list.with_decoration(
                         ui::indent_guides(
-                            cx.model().clone(),
+                            cx.entity().clone(),
                             px(indent_size),
                             IndentGuideColors::panel(cx),
                             |outline_panel, range, _, _| {
@@ -4547,7 +4547,7 @@ impl OutlinePanel {
                             },
                         )
                         .with_render_fn(
-                            cx.model().clone(),
+                            cx.entity().clone(),
                             move |outline_panel, params, _, _| {
                                 const LEFT_OFFSET: f32 = 14.;
 

crates/picker/src/picker.rs 🔗

@@ -281,7 +281,7 @@ impl<D: PickerDelegate> Picker<D> {
                 ElementContainer::UniformList(UniformListScrollHandle::new())
             }
             ContainerKind::List => {
-                let model = cx.model().downgrade();
+                let model = cx.entity().downgrade();
                 ElementContainer::List(ListState::new(
                     0,
                     gpui::ListAlignment::Top,
@@ -643,7 +643,7 @@ impl<D: PickerDelegate> Picker<D> {
         };
         match &self.element_container {
             ElementContainer::UniformList(scroll_handle) => uniform_list(
-                cx.model().clone(),
+                cx.entity().clone(),
                 "candidates",
                 self.delegate.match_count(),
                 move |picker, visible_range, window, cx| {

crates/project/src/buffer_store.rs 🔗

@@ -687,7 +687,7 @@ impl LocalBufferStore {
                     buffer_id,
                 );
                 events.push(BufferStoreEvent::BufferChangedFilePath {
-                    buffer: cx.model(),
+                    buffer: cx.entity(),
                     old_file: buffer.file().cloned(),
                 });
             }
@@ -875,7 +875,7 @@ impl LocalBufferStore {
                         if !push_to_history {
                             buffer.forget_transaction(transaction.id);
                         }
-                        project_transaction.0.insert(cx.model(), transaction);
+                        project_transaction.0.insert(cx.entity(), transaction);
                     }
                 })?;
             }
@@ -1302,7 +1302,7 @@ impl BufferStore {
             unstaged_changes: None,
         };
 
-        let handle = cx.model().downgrade();
+        let handle = cx.entity().downgrade();
         buffer.update(cx, move |_, cx| {
             cx.on_release(move |buffer, cx| {
                 handle

crates/project/src/connection_manager.rs 🔗

@@ -39,7 +39,7 @@ impl Manager {
         project: &Entity<Project>,
         cx: &mut Context<Self>,
     ) {
-        let manager = cx.weak_model();
+        let manager = cx.weak_entity();
         project.update(cx, |_, cx| {
             let manager = manager.clone();
             cx.on_release(move |project, cx| {

crates/project/src/git.rs 🔗

@@ -122,7 +122,7 @@ impl GitState {
 
         let mut new_repositories = Vec::new();
         let mut new_active_index = None;
-        let this = cx.weak_model();
+        let this = cx.weak_entity();
 
         worktree_store.update(cx, |worktree_store, cx| {
             for worktree in worktree_store.worktrees() {

crates/project/src/image_store.rs 🔗

@@ -203,7 +203,7 @@ pub struct ImageStore {
 
 impl ImageStore {
     pub fn local(worktree_store: Entity<WorktreeStore>, cx: &mut Context<Self>) -> Self {
-        let this = cx.weak_model();
+        let this = cx.weak_entity();
         Self {
             state: Box::new(cx.new(|cx| {
                 let subscription = cx.subscribe(

crates/project/src/lsp_store.rs 🔗

@@ -417,7 +417,7 @@ impl LocalLspStore {
             let delegate = LocalLspAdapterDelegate::new(
                 self.languages.clone(),
                 &self.environment,
-                cx.weak_model(),
+                cx.weak_entity(),
                 &worktree,
                 self.http_client.clone(),
                 self.fs.clone(),
@@ -5153,7 +5153,7 @@ impl LspStore {
                             let delegate = LocalLspAdapterDelegate::new(
                                 local.languages.clone(),
                                 &local.environment,
-                                cx.weak_model(),
+                                cx.weak_entity(),
                                 &worktree,
                                 local.http_client.clone(),
                                 local.fs.clone(),
@@ -8159,7 +8159,7 @@ impl LanguageServerWatchedPathsBuilder {
         language_server_id: LanguageServerId,
         cx: &mut Context<LspStore>,
     ) -> LanguageServerWatchedPaths {
-        let project = cx.weak_model();
+        let project = cx.weak_entity();
 
         const LSP_ABS_PATH_OBSERVE: Duration = Duration::from_millis(100);
         let abs_paths = self

crates/project/src/project.rs 🔗

@@ -869,7 +869,7 @@ impl Project {
             };
 
             let ssh = ssh.read(cx);
-            ssh.subscribe_to_entity(SSH_PROJECT_ID, &cx.model());
+            ssh.subscribe_to_entity(SSH_PROJECT_ID, &cx.entity());
             ssh.subscribe_to_entity(SSH_PROJECT_ID, &this.buffer_store);
             ssh.subscribe_to_entity(SSH_PROJECT_ID, &this.worktree_store);
             ssh.subscribe_to_entity(SSH_PROJECT_ID, &this.lsp_store);
@@ -1585,7 +1585,7 @@ impl Project {
         self.client_subscriptions.extend([
             self.client
                 .subscribe_to_entity(project_id)?
-                .set_model(&cx.model(), &mut cx.to_async()),
+                .set_model(&cx.entity(), &mut cx.to_async()),
             self.client
                 .subscribe_to_entity(project_id)?
                 .set_model(&self.worktree_store, &mut cx.to_async()),
@@ -2427,7 +2427,7 @@ impl Project {
             delay
         } else {
             if first_insertion {
-                let this = cx.weak_model();
+                let this = cx.weak_entity();
                 cx.defer(move |cx| {
                     if let Some(this) = this.upgrade() {
                         this.update(cx, |this, cx| {

crates/project_panel/src/project_panel.rs 🔗

@@ -401,9 +401,9 @@ impl ProjectPanel {
                 show_scrollbar: !Self::should_autohide_scrollbar(cx),
                 hide_scrollbar_task: None,
                 vertical_scrollbar_state: ScrollbarState::new(scroll_handle.clone())
-                    .parent_model(&cx.model()),
+                    .parent_model(&cx.entity()),
                 horizontal_scrollbar_state: ScrollbarState::new(scroll_handle.clone())
-                    .parent_model(&cx.model()),
+                    .parent_model(&cx.entity()),
                 max_width_item_index: None,
                 diagnostics: Default::default(),
                 scroll_handle,
@@ -4227,7 +4227,7 @@ impl Render for ProjectPanel {
                 )
                 .track_focus(&self.focus_handle(cx))
                 .child(
-                    uniform_list(cx.model().clone(), "entries", item_count, {
+                    uniform_list(cx.entity().clone(), "entries", item_count, {
                         |this, range, window, cx| {
                             let mut items = Vec::with_capacity(range.end - range.start);
                             this.for_each_visible_entry(
@@ -4244,7 +4244,7 @@ impl Render for ProjectPanel {
                     .when(show_indent_guides, |list| {
                         list.with_decoration(
                             ui::indent_guides(
-                                cx.model().clone(),
+                                cx.entity().clone(),
                                 px(indent_size),
                                 IndentGuideColors::panel(cx),
                                 |this, range, window, cx| {
@@ -4287,7 +4287,7 @@ impl Render for ProjectPanel {
                                 },
                             ))
                             .with_render_fn(
-                                cx.model().clone(),
+                                cx.entity().clone(),
                                 move |this, params, _, cx| {
                                     const LEFT_OFFSET: f32 = 14.;
                                     const PADDING_Y: f32 = 4.;

crates/project_symbols/src/project_symbols.rs 🔗

@@ -21,7 +21,7 @@ pub fn init(cx: &mut App) {
             workspace.register_action(
                 |workspace, _: &workspace::ToggleProjectSymbols, window, cx| {
                     let project = workspace.project().clone();
-                    let handle = cx.model().downgrade();
+                    let handle = cx.entity().downgrade();
                     workspace.toggle_modal(window, cx, move |window, cx| {
                         let delegate = ProjectSymbolsDelegate::new(handle, project);
                         Picker::uniform_list(delegate, window, cx).width(rems(34.))

crates/recent_projects/src/disconnected_overlay.rs 🔗

@@ -64,7 +64,7 @@ impl DisconnectedOverlay {
                 ) {
                     return;
                 }
-                let handle = cx.model().downgrade();
+                let handle = cx.entity().downgrade();
 
                 let ssh_connection_options = project.read(cx).ssh_connection_options(cx);
                 let host = if let Some(ssh_connection_options) = ssh_connection_options {

crates/recent_projects/src/recent_projects.rs 🔗

@@ -109,7 +109,7 @@ impl RecentProjects {
         window: &mut Window,
         cx: &mut Context<Workspace>,
     ) {
-        let weak = cx.model().downgrade();
+        let weak = cx.entity().downgrade();
         workspace.toggle_modal(window, cx, |window, cx| {
             let delegate = RecentProjectsDelegate::new(weak, create_new_window, true);
 

crates/recent_projects/src/remote_servers.rs 🔗

@@ -145,7 +145,7 @@ impl ProjectPicker {
                     let Ok(Some(paths)) = rx.await else {
                         workspace
                             .update_in(&mut cx, |workspace, window, cx| {
-                                let weak = cx.model().downgrade();
+                                let weak = cx.entity().downgrade();
                                 workspace.toggle_modal(window, cx, |window, cx| {
                                     RemoteServerProjects::new(window, cx, weak)
                                 });
@@ -326,14 +326,14 @@ impl RemoteServerProjects {
         _: &mut Context<Workspace>,
     ) {
         workspace.register_action(|workspace, _: &OpenRemote, window, cx| {
-            let handle = cx.model().downgrade();
+            let handle = cx.entity().downgrade();
             workspace.toggle_modal(window, cx, |window, cx| Self::new(window, cx, handle))
         });
     }
 
     pub fn open(workspace: Entity<Workspace>, window: &mut Window, cx: &mut App) {
         workspace.update(cx, |workspace, cx| {
-            let handle = cx.model().downgrade();
+            let handle = cx.entity().downgrade();
             workspace.toggle_modal(window, cx, |window, cx| Self::new(window, cx, handle))
         })
     }
@@ -523,7 +523,7 @@ impl RemoteServerProjects {
                     let Some(Some(session)) = session else {
                         workspace
                             .update_in(&mut cx, |workspace, window, cx| {
-                                let weak = cx.model().downgrade();
+                                let weak = cx.entity().downgrade();
                                 workspace.toggle_modal(window, cx, |window, cx| {
                                     RemoteServerProjects::new(window, cx, weak)
                                 });
@@ -535,7 +535,7 @@ impl RemoteServerProjects {
                     workspace
                         .update_in(&mut cx, |workspace, window, cx| {
                             let app_state = workspace.app_state().clone();
-                            let weak = cx.model().downgrade();
+                            let weak = cx.entity().downgrade();
                             let project = project::Project::ssh(
                                 session,
                                 app_state.client.clone(),
@@ -1152,7 +1152,7 @@ impl RemoteServerProjects {
                                     let connection_string = connection_string.clone();
                                     move |_, _: &menu::Confirm, window, cx| {
                                         remove_ssh_server(
-                                            cx.model().clone(),
+                                            cx.entity().clone(),
                                             server_index,
                                             connection_string.clone(),
                                             window,
@@ -1172,7 +1172,7 @@ impl RemoteServerProjects {
                                         .child(Label::new("Remove Server").color(Color::Error))
                                         .on_click(cx.listener(move |_, _, window, cx| {
                                             remove_ssh_server(
-                                                cx.model().clone(),
+                                                cx.entity().clone(),
                                                 server_index,
                                                 connection_string.clone(),
                                                 window,
@@ -1280,7 +1280,7 @@ impl RemoteServerProjects {
                 state = new_state.clone();
             }
         }
-        let scroll_state = state.scrollbar.parent_model(&cx.model());
+        let scroll_state = state.scrollbar.parent_model(&cx.entity());
         let connect_button = div()
             .id("ssh-connect-new-server-container")
             .track_focus(&state.add_new_server.focus_handle)

crates/remote_server/src/headless_project.rs 🔗

@@ -166,19 +166,19 @@ impl HeadlessProject {
 
         session.subscribe_to_entity(SSH_PROJECT_ID, &worktree_store);
         session.subscribe_to_entity(SSH_PROJECT_ID, &buffer_store);
-        session.subscribe_to_entity(SSH_PROJECT_ID, &cx.model());
+        session.subscribe_to_entity(SSH_PROJECT_ID, &cx.entity());
         session.subscribe_to_entity(SSH_PROJECT_ID, &lsp_store);
         session.subscribe_to_entity(SSH_PROJECT_ID, &task_store);
         session.subscribe_to_entity(SSH_PROJECT_ID, &toolchain_store);
         session.subscribe_to_entity(SSH_PROJECT_ID, &settings_observer);
 
-        client.add_request_handler(cx.weak_model(), Self::handle_list_remote_directory);
-        client.add_request_handler(cx.weak_model(), Self::handle_get_path_metadata);
-        client.add_request_handler(cx.weak_model(), Self::handle_shutdown_remote_server);
-        client.add_request_handler(cx.weak_model(), Self::handle_ping);
+        client.add_request_handler(cx.weak_entity(), Self::handle_list_remote_directory);
+        client.add_request_handler(cx.weak_entity(), Self::handle_get_path_metadata);
+        client.add_request_handler(cx.weak_entity(), Self::handle_shutdown_remote_server);
+        client.add_request_handler(cx.weak_entity(), Self::handle_ping);
 
         client.add_model_request_handler(Self::handle_add_worktree);
-        client.add_request_handler(cx.weak_model(), Self::handle_remove_worktree);
+        client.add_request_handler(cx.weak_entity(), Self::handle_remove_worktree);
 
         client.add_model_request_handler(Self::handle_open_buffer_by_path);
         client.add_model_request_handler(Self::handle_open_new_buffer);

crates/repl/src/notebook/notebook_ui.rs 🔗

@@ -113,10 +113,10 @@ impl NotebookEditor {
             );
         }
 
-        let notebook_handle = cx.model().downgrade();
+        let notebook_handle = cx.entity().downgrade();
         let cell_count = cell_order.len();
 
-        let this = cx.model();
+        let this = cx.entity();
         let cell_list = ListState::new(
             cell_count,
             gpui::ListAlignment::Top,

crates/repl/src/repl_sessions_ui.rs 🔗

@@ -92,7 +92,7 @@ pub fn init(cx: &mut App) {
 
                 let project_path = buffer.and_then(|buffer| buffer.read(cx).project_path(cx));
 
-                let editor_handle = cx.model().downgrade();
+                let editor_handle = cx.entity().downgrade();
 
                 if let Some(language) = language {
                     if language.name() == "Python".into() {

crates/repl/src/session.rs 🔗

@@ -245,7 +245,7 @@ impl Session {
             repl_session_id = cx.entity_id().to_string(),
         );
 
-        let session_view = cx.model().clone();
+        let session_view = cx.entity().clone();
 
         let kernel = match self.kernel_specification.clone() {
             KernelSpecification::Jupyter(kernel_specification)
@@ -417,7 +417,7 @@ impl Session {
         };
 
         let parent_message_id = message.header.msg_id.clone();
-        let session_view = cx.model().downgrade();
+        let session_view = cx.entity().downgrade();
         let weak_editor = self.editor.clone();
 
         let on_close: CloseBlockFn = Arc::new(

crates/search/src/buffer_search.rs 🔗

@@ -516,7 +516,7 @@ impl ToolbarItemView for BufferSearchBar {
         if let Some(searchable_item_handle) =
             item.and_then(|item| item.to_searchable_item_handle(cx))
         {
-            let this = cx.model().downgrade();
+            let this = cx.entity().downgrade();
 
             self.active_searchable_item_subscription =
                 Some(searchable_item_handle.subscribe_to_search_events(

crates/search/src/project_search.rs 🔗

@@ -820,7 +820,7 @@ impl ProjectSearchView {
             return;
         };
 
-        let weak_workspace = cx.model().downgrade();
+        let weak_workspace = cx.entity().downgrade();
 
         let model = cx.new(|cx| ProjectSearch::new(workspace.project().clone(), cx));
         let search = cx.new(|cx| ProjectSearchView::new(weak_workspace, model, window, cx, None));
@@ -879,7 +879,7 @@ impl ProjectSearchView {
                     model.search(new_query, cx);
                     model
                 });
-                let weak_workspace = cx.model().downgrade();
+                let weak_workspace = cx.entity().downgrade();
                 workspace.add_item_to_active_pane(
                     Box::new(
                         cx.new(|cx| {
@@ -937,7 +937,7 @@ impl ProjectSearchView {
 
             let settings = settings.cloned();
 
-            let weak_workspace = cx.model().downgrade();
+            let weak_workspace = cx.entity().downgrade();
 
             let project_search = cx.new(|cx| ProjectSearch::new(workspace.project().clone(), cx));
             let project_search_view = cx.new(|cx| {

crates/semantic_index/src/project_index_debug_view.rs 🔗

@@ -115,7 +115,7 @@ impl ProjectIndexDebugView {
                 .collect::<Vec<_>>();
 
             this.update(&mut cx, |this, cx| {
-                let view = cx.model().downgrade();
+                let view = cx.entity().downgrade();
                 this.selected_path = Some(PathState {
                     path: file_path,
                     list_state: ListState::new(
@@ -224,7 +224,7 @@ impl Render for ProjectIndexDebugView {
                 .into_any_element()
         } else {
             let mut list = uniform_list(
-                cx.model().clone(),
+                cx.entity().clone(),
                 "ProjectIndexDebugView",
                 self.rows.len(),
                 move |this, range, _, cx| {

crates/snippets_ui/src/snippets_ui.rs 🔗

@@ -58,7 +58,7 @@ impl ScopeSelector {
         cx: &mut Context<Self>,
     ) -> Self {
         let delegate =
-            ScopeSelectorDelegate::new(workspace, cx.model().downgrade(), language_registry);
+            ScopeSelectorDelegate::new(workspace, cx.entity().downgrade(), language_registry);
 
         let picker = cx.new(|cx| Picker::uniform_list(delegate, window, cx));
 

crates/storybook/src/stories/indent_guides.rs 🔗

@@ -39,7 +39,7 @@ impl Render for IndentGuidesStory {
             .child(
                 v_flex().size_full().child(
                     uniform_list(
-                        cx.model().clone(),
+                        cx.entity().clone(),
                         "some-list",
                         self.depths.len(),
                         |this, range, cx| {
@@ -60,7 +60,7 @@ impl Render for IndentGuidesStory {
                     )
                     .with_sizing_behavior(gpui::ListSizingBehavior::Infer)
                     .with_decoration(ui::indent_guides(
-                        cx.model().clone(),
+                        cx.entity().clone(),
                         px(16.),
                         ui::IndentGuideColors {
                             default: Color::Info.color(cx),

crates/tab_switcher/src/tab_switcher.rs 🔗

@@ -94,7 +94,7 @@ impl TabSwitcher {
             let delegate = TabSwitcherDelegate::new(
                 project,
                 action,
-                cx.model().downgrade(),
+                cx.entity().downgrade(),
                 weak_pane,
                 window,
                 cx,

crates/terminal_view/src/terminal_panel.rs 🔗

@@ -903,7 +903,7 @@ pub fn new_terminal_pane(
     cx: &mut Context<TerminalPanel>,
 ) -> Entity<Pane> {
     let is_local = project.read(cx).is_local();
-    let terminal_panel = cx.model().clone();
+    let terminal_panel = cx.entity().clone();
     let pane = cx.new(|cx| {
         let mut pane = Pane::new(
             workspace.clone(),
@@ -923,7 +923,7 @@ pub fn new_terminal_pane(
         let split_closure_terminal_panel = terminal_panel.downgrade();
         pane.set_can_split(Some(Arc::new(move |pane, dragged_item, _window, cx| {
             if let Some(tab) = dragged_item.downcast_ref::<DraggedTab>() {
-                let is_current_pane = tab.pane == cx.model();
+                let is_current_pane = tab.pane == cx.entity();
                 let Some(can_drag_away) = split_closure_terminal_panel
                     .update(cx, |terminal_panel, _| {
                         let current_panes = terminal_panel.center.panes();
@@ -963,7 +963,7 @@ pub fn new_terminal_pane(
                 return ControlFlow::Break(());
             };
             if let Some(tab) = dropped_item.downcast_ref::<DraggedTab>() {
-                let this_pane = cx.model().clone();
+                let this_pane = cx.entity().clone();
                 let item = if tab.pane == this_pane {
                     pane.item_for_index(tab.ix)
                 } else {

crates/terminal_view/src/terminal_view.rs 🔗

@@ -218,7 +218,7 @@ impl TerminalView {
         }
     }
 
-    pub fn model(&self) -> &Entity<Terminal> {
+    pub fn entity(&self) -> &Entity<Terminal> {
         &self.terminal
     }
 
@@ -1125,7 +1125,7 @@ impl TerminalView {
 impl Render for TerminalView {
     fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
         let terminal_handle = self.terminal.clone();
-        let terminal_view_handle = cx.model().clone();
+        let terminal_view_handle = cx.entity().clone();
 
         let focused = self.focus_handle.is_focused(window);
 
@@ -1771,7 +1771,7 @@ mod tests {
         let project = Project::test(params.fs.clone(), [], cx).await;
         let workspace = cx
             .add_window(|window, cx| Workspace::test_new(project.clone(), window, cx))
-            .root_model(cx)
+            .root(cx)
             .unwrap();
 
         (project, workspace)

crates/theme_selector/src/theme_selector.rs 🔗

@@ -33,7 +33,7 @@ pub fn toggle(
     let fs = workspace.app_state().fs.clone();
     workspace.toggle_modal(window, cx, |window, cx| {
         let delegate = ThemeSelectorDelegate::new(
-            cx.model().downgrade(),
+            cx.entity().downgrade(),
             fs,
             toggle.themes_filter.as_ref(),
             cx,

crates/toolchain_selector/src/toolchain_selector.rs 🔗

@@ -96,7 +96,7 @@ impl ToolchainSelector {
         window: &mut Window,
         cx: &mut Context<Self>,
     ) -> Self {
-        let toolchain_selector = cx.model().downgrade();
+        let toolchain_selector = cx.entity().downgrade();
         let picker = cx.new(|cx| {
             let delegate = ToolchainSelectorDelegate::new(
                 active_toolchain,

crates/ui/src/components/context_menu.rs 🔗

@@ -539,7 +539,7 @@ impl Render for ContextMenu {
                                     disabled,
                                 }) => {
                                     let handler = handler.clone();
-                                    let menu = cx.model().downgrade();
+                                    let menu = cx.entity().downgrade();
                                     let icon_color = if *disabled {
                                         Color::Muted
                                     } else {
@@ -637,7 +637,7 @@ impl Render for ContextMenu {
                                     selectable,
                                 } => {
                                     let handler = handler.clone();
-                                    let menu = cx.model().downgrade();
+                                    let menu = cx.entity().downgrade();
                                     let selectable = *selectable;
                                     ListItem::new(ix)
                                         .inset(true)

crates/vcs_menu/src/lib.rs 🔗

@@ -35,7 +35,7 @@ impl BranchList {
         window: &mut Window,
         cx: &mut Context<Workspace>,
     ) {
-        let this = cx.model().clone();
+        let this = cx.entity().clone();
         cx.spawn_in(window, |_, mut cx| async move {
             // Modal branch picker has a longer trailoff than a popover one.
             let delegate = BranchListDelegate::new(this.clone(), 70, &cx).await?;

crates/vim/src/mode_indicator.rs 🔗

@@ -20,7 +20,7 @@ impl ModeIndicator {
         })
         .detach();
 
-        let handle = cx.model().clone();
+        let handle = cx.entity().clone();
         let window_handle = window.window_handle();
         cx.observe_new::<Vim>(move |_, window, cx| {
             let Some(window) = window else {
@@ -29,7 +29,7 @@ impl ModeIndicator {
             if window.window_handle() != window_handle {
                 return;
             }
-            let vim = cx.model().clone();
+            let vim = cx.entity().clone();
             handle.update(cx, |_, cx| {
                 cx.subscribe(&vim, |mode_indicator, vim, event, cx| match event {
                     VimEvent::Focused => {

crates/vim/src/normal/repeat.rs 🔗

@@ -130,7 +130,7 @@ impl Replayer {
                 text,
                 utf16_range_to_replace,
             } => {
-                let Some(Some(workspace)) = window.root_model::<Workspace>() else {
+                let Some(Some(workspace)) = window.root::<Workspace>() else {
                     return;
                 };
                 let Some(editor) = workspace

crates/vim/src/normal/search.rs 🔗

@@ -291,7 +291,7 @@ impl Vim {
         };
         let count = Vim::take_count(cx).unwrap_or(1);
         let prior_selections = self.editor_selections(window, cx);
-        let vim = cx.model().clone();
+        let vim = cx.entity().clone();
 
         let searched = pane.update(cx, |pane, cx| {
             self.search.direction = direction;
@@ -425,7 +425,7 @@ impl Vim {
                 result.notify_err(workspace, cx);
             })
         }
-        let vim = cx.model().clone();
+        let vim = cx.entity().clone();
         pane.update(cx, |pane, cx| {
             let Some(search_bar) = pane.toolbar().read(cx).item_of_type::<BufferSearchBar>() else {
                 return;

crates/vim/src/vim.rs 🔗

@@ -245,7 +245,7 @@ impl Vim {
     const NAMESPACE: &'static str = "vim";
 
     pub fn new(window: &mut Window, cx: &mut Context<Editor>) -> Entity<Self> {
-        let editor = cx.model().clone();
+        let editor = cx.entity().clone();
 
         cx.new(|cx| Vim {
             mode: Mode::Normal,
@@ -377,7 +377,7 @@ impl Vim {
         editor.unregister_addon::<VimAddon>();
         editor.set_relative_line_number(None, cx);
         if let Some(vim) = Vim::globals(cx).focused_vim() {
-            if vim.entity_id() == cx.model().entity_id() {
+            if vim.entity_id() == cx.entity().entity_id() {
                 Vim::globals(cx).focused_vim = None;
             }
         }
@@ -398,7 +398,7 @@ impl Vim {
     }
 
     pub fn workspace(&self, window: &mut Window) -> Option<Entity<Workspace>> {
-        window.root_model::<Workspace>().flatten()
+        window.root::<Workspace>().flatten()
     }
 
     pub fn pane(&self, window: &mut Window, cx: &mut Context<Self>) -> Option<Entity<Pane>> {
@@ -797,7 +797,7 @@ impl Vim {
 
         if VimSettings::get_global(cx).toggle_relative_line_numbers {
             if let Some(old_vim) = Vim::globals(cx).focused_vim() {
-                if old_vim.entity_id() != cx.model().entity_id() {
+                if old_vim.entity_id() != cx.entity().entity_id() {
                     old_vim.update(cx, |vim, cx| {
                         vim.update_editor(window, cx, |_, editor, _, cx| {
                             editor.set_relative_line_number(None, cx)
@@ -816,7 +816,7 @@ impl Vim {
                 });
             }
         }
-        Vim::globals(cx).focused_vim = Some(cx.model().downgrade());
+        Vim::globals(cx).focused_vim = Some(cx.entity().downgrade());
     }
 
     fn blurred(&mut self, window: &mut Window, cx: &mut Context<Self>) {

crates/welcome/src/base_keymap_picker.rs 🔗

@@ -30,7 +30,7 @@ pub fn toggle(
     let fs = workspace.app_state().fs.clone();
     workspace.toggle_modal(window, cx, |window, cx| {
         BaseKeymapSelector::new(
-            BaseKeymapSelectorDelegate::new(cx.model().downgrade(), fs, cx),
+            BaseKeymapSelectorDelegate::new(cx.entity().downgrade(), fs, cx),
             window,
             cx,
         )

crates/welcome/src/multibuffer_hint.rs 🔗

@@ -109,7 +109,7 @@ impl ToolbarItemView for MultibufferHint {
             return ToolbarItemLocation::Hidden;
         };
 
-        let this = cx.model().downgrade();
+        let this = cx.entity().downgrade();
         self.subscription = Some(active_pane_item.subscribe_to_item_events(
             window,
             cx,

crates/workspace/src/dock.rs 🔗

@@ -240,7 +240,7 @@ impl Dock {
         cx: &mut Context<Workspace>,
     ) -> Entity<Self> {
         let focus_handle = cx.focus_handle();
-        let workspace = cx.model().clone();
+        let workspace = cx.entity().clone();
         let dock = cx.new(|cx| {
             let focus_subscription =
                 cx.on_focus(&focus_handle, window, |dock: &mut Dock, window, cx| {

crates/workspace/src/notifications.rs 🔗

@@ -265,7 +265,7 @@ impl Render for LanguageServerPrompt {
                     )
                     .child(Label::new(request.message.to_string()).size(LabelSize::Small))
                     .children(request.actions.iter().enumerate().map(|(ix, action)| {
-                        let this_handle = cx.model().clone();
+                        let this_handle = cx.entity().clone();
                         Button::new(ix, action.title.clone())
                             .size(ButtonSize::Large)
                             .on_click(move |_, window, cx| {

crates/workspace/src/pane.rs 🔗

@@ -396,7 +396,7 @@ impl Pane {
             cx.subscribe(&project, Self::project_events),
         ];
 
-        let handle = cx.model().downgrade();
+        let handle = cx.entity().downgrade();
         Self {
             alternate_file_items: (None, None),
             focus_handle,
@@ -756,7 +756,7 @@ impl Pane {
 
     fn navigate_backward(&mut self, window: &mut Window, cx: &mut Context<Self>) {
         if let Some(workspace) = self.workspace.upgrade() {
-            let pane = cx.model().downgrade();
+            let pane = cx.entity().downgrade();
             window.defer(cx, move |window, cx| {
                 workspace.update(cx, |workspace, cx| {
                     workspace.go_back(pane, window, cx).detach_and_log_err(cx)
@@ -767,7 +767,7 @@ impl Pane {
 
     fn navigate_forward(&mut self, window: &mut Window, cx: &mut Context<Self>) {
         if let Some(workspace) = self.workspace.upgrade() {
-            let pane = cx.model().downgrade();
+            let pane = cx.entity().downgrade();
             window.defer(cx, move |window, cx| {
                 workspace.update(cx, |workspace, cx| {
                     workspace
@@ -1992,7 +1992,7 @@ impl Pane {
 
     fn update_status_bar(&mut self, window: &mut Window, cx: &mut Context<Self>) {
         let workspace = self.workspace.clone();
-        let pane = cx.model().clone();
+        let pane = cx.entity().clone();
 
         window.defer(cx, move |window, cx| {
             let Ok(status_bar) = workspace.update(cx, |workspace, _| workspace.status_bar.clone())
@@ -2044,7 +2044,7 @@ impl Pane {
 
     fn pin_tab_at(&mut self, ix: usize, window: &mut Window, cx: &mut Context<Self>) {
         maybe!({
-            let pane = cx.model().clone();
+            let pane = cx.entity().clone();
             let destination_index = self.pinned_tab_count.min(ix);
             self.pinned_tab_count += 1;
             let id = self.item_for_index(ix)?.item_id();
@@ -2067,7 +2067,7 @@ impl Pane {
 
     fn unpin_tab_at(&mut self, ix: usize, window: &mut Window, cx: &mut Context<Self>) {
         maybe!({
-            let pane = cx.model().clone();
+            let pane = cx.entity().clone();
             self.pinned_tab_count = self.pinned_tab_count.checked_sub(1)?;
             let destination_index = self.pinned_tab_count;
 
@@ -2214,7 +2214,7 @@ impl Pane {
             .on_drag(
                 DraggedTab {
                     item: item.boxed_clone(),
-                    pane: cx.model().clone(),
+                    pane: cx.entity().clone(),
                     detail,
                     is_active,
                     ix,
@@ -2328,7 +2328,7 @@ impl Pane {
         };
 
         let is_pinned = self.is_tab_pinned(ix);
-        let pane = cx.model().downgrade();
+        let pane = cx.entity().downgrade();
         let menu_context = item.item_focus_handle(cx);
         right_click_menu(ix).trigger(tab).menu(move |window, cx| {
             let pane = pane.clone();
@@ -2534,7 +2534,7 @@ impl Pane {
         let navigate_backward = IconButton::new("navigate_backward", IconName::ArrowLeft)
             .icon_size(IconSize::Small)
             .on_click({
-                let model = cx.model().clone();
+                let model = cx.entity().clone();
                 move |_, window, cx| model.update(cx, |pane, cx| pane.navigate_backward(window, cx))
             })
             .disabled(!self.can_navigate_backward())
@@ -2548,7 +2548,7 @@ impl Pane {
         let navigate_forward = IconButton::new("navigate_forward", IconName::ArrowRight)
             .icon_size(IconSize::Small)
             .on_click({
-                let model = cx.model().clone();
+                let model = cx.entity().clone();
                 move |_, window, cx| model.update(cx, |pane, cx| pane.navigate_forward(window, cx))
             })
             .disabled(!self.can_navigate_forward())
@@ -2732,7 +2732,7 @@ impl Pane {
                 return;
             }
         }
-        let mut to_pane = cx.model().clone();
+        let mut to_pane = cx.entity().clone();
         let split_direction = self.drag_split_direction;
         let item_id = dragged_tab.item.item_id();
         if let Some(preview_item_id) = self.preview_item_id {
@@ -2821,7 +2821,7 @@ impl Pane {
                 return;
             }
         }
-        let mut to_pane = cx.model().clone();
+        let mut to_pane = cx.entity().clone();
         let split_direction = self.drag_split_direction;
         let project_entry_id = *project_entry_id;
         self.workspace
@@ -2895,7 +2895,7 @@ impl Pane {
                 return;
             }
         }
-        let mut to_pane = cx.model().clone();
+        let mut to_pane = cx.entity().clone();
         let mut split_direction = self.drag_split_direction;
         let paths = paths.paths().to_vec();
         let is_remote = self
@@ -3246,7 +3246,7 @@ impl Render for Pane {
                 MouseButton::Navigate(NavigationDirection::Back),
                 cx.listener(|pane, _, window, cx| {
                     if let Some(workspace) = pane.workspace.upgrade() {
-                        let pane = cx.model().downgrade();
+                        let pane = cx.entity().downgrade();
                         window.defer(cx, move |window, cx| {
                             workspace.update(cx, |workspace, cx| {
                                 workspace.go_back(pane, window, cx).detach_and_log_err(cx)
@@ -3259,7 +3259,7 @@ impl Render for Pane {
                 MouseButton::Navigate(NavigationDirection::Forward),
                 cx.listener(|pane, _, window, cx| {
                     if let Some(workspace) = pane.workspace.upgrade() {
-                        let pane = cx.model().downgrade();
+                        let pane = cx.entity().downgrade();
                         window.defer(cx, move |window, cx| {
                             workspace.update(cx, |workspace, cx| {
                                 workspace

crates/workspace/src/pane_group.rs 🔗

@@ -699,7 +699,7 @@ impl PaneAxis {
             basis,
             self.flexes.clone(),
             self.bounding_boxes.clone(),
-            cx.model().downgrade(),
+            cx.entity().downgrade(),
         )
         .children(self.members.iter().enumerate().map(|(ix, member)| {
             if member.contains(active_pane) {

crates/workspace/src/workspace.rs 🔗

@@ -941,7 +941,7 @@ impl Workspace {
         })
         .detach();
 
-        let weak_handle = cx.model().downgrade();
+        let weak_handle = cx.entity().downgrade();
         let pane_history_timestamp = Arc::new(AtomicUsize::new(0));
 
         let center_pane = cx.new(|cx| {
@@ -1216,7 +1216,7 @@ impl Workspace {
             }
             let window = if let Some(window) = requesting_window {
                 cx.update_window(window.into(), |_, window, cx| {
-                    window.replace_root_model(cx, |window, cx| {
+                    window.replace_root(cx, |window, cx| {
                         Workspace::new(
                             Some(workspace_id),
                             project_handle.clone(),
@@ -4962,7 +4962,7 @@ impl Workspace {
     }
 
     pub fn for_window(window: &mut Window, _: &mut App) -> Option<Entity<Workspace>> {
-        window.root_model().flatten()
+        window.root().flatten()
     }
 
     pub fn zoomed_item(&self) -> Option<&AnyWeakView> {
@@ -5265,7 +5265,7 @@ impl Render for Workspace {
                                 .border_b_1()
                                 .border_color(colors.border)
                                 .child({
-                                    let this = cx.model().clone();
+                                    let this = cx.entity().clone();
                                     canvas(
                                         move |bounds, window, cx| {
                                             this.update(cx, |this, cx| {
@@ -5477,8 +5477,8 @@ impl WorkspaceStore {
         Self {
             workspaces: Default::default(),
             _subscriptions: vec![
-                client.add_request_handler(cx.weak_model(), Self::handle_follow),
-                client.add_message_handler(cx.weak_model(), Self::handle_update_followers),
+                client.add_request_handler(cx.weak_entity(), Self::handle_follow),
+                client.add_message_handler(cx.weak_entity(), Self::handle_update_followers),
             ],
             client,
         }
@@ -6146,7 +6146,7 @@ pub fn open_ssh_project(
         }
 
         cx.update_window(window.into(), |_, window, cx| {
-            window.replace_root_model(cx, |window, cx| {
+            window.replace_root(cx, |window, cx| {
                 let mut workspace =
                     Workspace::new(Some(workspace_id), project, app_state.clone(), window, cx);
 

crates/worktree/src/worktree.rs 🔗

@@ -824,7 +824,7 @@ impl Worktree {
 
     pub fn root_file(&self, cx: &Context<Self>) -> Option<Arc<File>> {
         let entry = self.root_entry()?;
-        Some(File::for_entry(entry.clone(), cx.model()))
+        Some(File::for_entry(entry.clone(), cx.entity()))
     }
 
     pub fn observe_updates<F, Fut>(&mut self, project_id: u64, cx: &Context<Worktree>, callback: F)
@@ -1504,7 +1504,7 @@ impl LocalWorktree {
         let entry = self.refresh_entry(path.clone(), None, cx);
         let is_private = self.is_path_private(path.as_ref());
 
-        let worktree = cx.weak_model();
+        let worktree = cx.weak_entity();
         cx.background_executor().spawn(async move {
             let abs_path = abs_path?;
             let content = fs.load_bytes(&abs_path).await?;

crates/worktree/src/worktree_tests.rs 🔗

@@ -1884,7 +1884,7 @@ async fn test_random_worktree_changes(cx: &mut TestAppContext, mut rng: StdRng)
 // all changes to the worktree's snapshot.
 fn check_worktree_change_events(tree: &mut Worktree, cx: &mut Context<Worktree>) {
     let mut entries = tree.entries(true, 0).cloned().collect::<Vec<_>>();
-    cx.subscribe(&cx.model(), move |tree, _, event, _| {
+    cx.subscribe(&cx.entity(), move |tree, _, event, _| {
         if let Event::UpdatedEntries(changes) = event {
             for (path, _, change_type) in changes.iter() {
                 let entry = tree.entry_for_path(path).cloned();

crates/zed/src/main.rs 🔗

@@ -724,7 +724,7 @@ fn handle_open_request(request: OpenRequest, app_state: Arc<AppState>, cx: &mut
 
                 let workspace_window =
                     workspace::get_any_active_workspace(app_state, cx.clone()).await?;
-                let workspace = workspace_window.root_model(&cx)?;
+                let workspace = workspace_window.entity(&cx)?;
 
                 let mut promises = Vec::new();
                 for (channel_id, heading) in request.open_channel_notes {

crates/zed/src/zed.rs 🔗

@@ -143,7 +143,7 @@ pub fn initialize_workspace(
             return;
         };
 
-        let workspace_handle = cx.model().clone();
+        let workspace_handle = cx.entity().clone();
         let center_pane = workspace.active_pane().clone();
         initialize_pane(workspace, &center_pane, window, cx);
         cx.subscribe_in(&workspace_handle, window, {
@@ -214,7 +214,7 @@ pub fn initialize_workspace(
 
         auto_update_ui::notify_of_any_new_update(window, cx);
 
-        let handle = cx.model().downgrade();
+        let handle = cx.entity().downgrade();
         window.on_window_should_close(cx, move |window, cx| {
             handle
                 .update(cx, |workspace, cx| {
@@ -1221,7 +1221,7 @@ fn show_keymap_file_load_error(
         let parsed_markdown = Rc::new(parsed_markdown.await);
         cx.update(|cx| {
             show_app_notification(notification_id, cx, move |cx| {
-                let workspace_handle = cx.model().downgrade();
+                let workspace_handle = cx.entity().downgrade();
                 let parsed_markdown = parsed_markdown.clone();
                 cx.new(move |_cx| {
                     MessageNotification::new_from_builder(move |window, cx| {
@@ -2574,7 +2574,7 @@ mod tests {
             .unwrap();
 
         assert_eq!(
-            opened_workspace.root_model(cx).unwrap().entity_id(),
+            opened_workspace.root(cx).unwrap().entity_id(),
             workspace.entity_id(),
             "Excluded files in subfolders of a workspace root should be opened in the workspace"
         );

crates/zed/src/zed/inline_completion_registry.rs 🔗

@@ -29,7 +29,7 @@ pub fn init(client: Arc<Client>, user_store: Entity<UserStore>, cx: &mut App) {
                 return;
             };
 
-            let editor_handle = cx.model().downgrade();
+            let editor_handle = cx.entity().downgrade();
             cx.on_release({
                 let editor_handle = editor_handle.clone();
                 let editors = editors.clone();
@@ -115,9 +115,8 @@ pub fn init(client: Arc<Client>, user_store: Entity<UserStore>, cx: &mut App) {
                                 return;
                             };
 
-                            let Some(workspace) = window
-                                .downcast::<Workspace>()
-                                .and_then(|w| w.root_model(cx).ok())
+                            let Some(workspace) =
+                                window.downcast::<Workspace>().and_then(|w| w.root(cx).ok())
                             else {
                                 return;
                             };

crates/zed_predict_tos/src/zed_predict_tos.rs 🔗

@@ -36,7 +36,7 @@ impl ZedPredictTos {
         cx: &mut App,
     ) {
         workspace.update(cx, |this, cx| {
-            let workspace = cx.model().clone();
+            let workspace = cx.entity().clone();
             this.toggle_modal(window, cx, |_window, cx| {
                 ZedPredictTos::new(workspace, user_store, cx)
             });