Fix missed renames in #22632 (#23688)

Fix a bug where a GPUI macro still used `ModelContext`
Rename `AsyncAppContext` -> `AsyncApp`
Rename update_model, read_model, insert_model, and reserve_model to
update_entity, read_entity, insert_entity, and reserve_entity

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki
2025-01-26 23:37:34 +00:00
committed by GitHub
parent 83141d07e9
commit a6b1514246
118 changed files with 708 additions and 757 deletions
+6 -6
View File
@@ -79,11 +79,11 @@ use git::blame::GitBlame;
use gpui::{
div, impl_actions, point, prelude::*, px, relative, size, Action, AnyElement, App,
AsyncWindowContext, AvailableSpace, Bounds, ClipboardEntry, ClipboardItem, Context,
DispatchPhase, ElementId, Entity, EventEmitter, FocusHandle, FocusOutEvent, Focusable, FontId,
FontWeight, Global, HighlightStyle, Hsla, InteractiveText, KeyContext, MouseButton, PaintQuad,
ParentElement, Pixels, Render, SharedString, Size, Styled, StyledText, Subscription, Task,
TextStyle, TextStyleRefinement, UTF16Selection, UnderlineStyle, UniformListScrollHandle,
ViewInputHandler, WeakEntity, WeakFocusHandle, Window,
DispatchPhase, ElementId, Entity, EntityInputHandler, EventEmitter, FocusHandle, FocusOutEvent,
Focusable, FontId, FontWeight, Global, HighlightStyle, Hsla, InteractiveText, KeyContext,
MouseButton, PaintQuad, ParentElement, Pixels, Render, SharedString, Size, Styled, StyledText,
Subscription, Task, TextStyle, TextStyleRefinement, UTF16Selection, UnderlineStyle,
UniformListScrollHandle, WeakEntity, WeakFocusHandle, Window,
};
use highlight_matching_bracket::refresh_matching_bracket_highlights;
use hover_popover::{hide_hover, HoverState};
@@ -15355,7 +15355,7 @@ impl Render for Editor {
}
}
impl ViewInputHandler for Editor {
impl EntityInputHandler for Editor {
fn text_for_range(
&mut self,
range_utf16: Range<usize>,
+6 -6
View File
@@ -7331,7 +7331,7 @@ async fn test_multibuffer_format_during_save(cx: &mut gpui::TestAppContext) {
);
multi_buffer
});
let multi_buffer_editor = cx.new_window_model(|window, cx| {
let multi_buffer_editor = cx.new_window_entity(|window, cx| {
Editor::new(
EditorMode::Full,
multi_buffer,
@@ -12595,7 +12595,7 @@ async fn test_mutlibuffer_in_navigation_history(cx: &mut gpui::TestAppContext) {
let project = Project::test(fs, ["/a".as_ref()], cx).await;
let workspace = cx.add_window(|window, cx| Workspace::test_new(project.clone(), window, cx));
let cx = &mut VisualTestContext::from_window(*workspace.deref(), cx);
let multi_buffer_editor = cx.new_window_model(|window, cx| {
let multi_buffer_editor = cx.new_window_entity(|window, cx| {
Editor::new(
EditorMode::Full,
multi_buffer,
@@ -14800,7 +14800,7 @@ async fn test_find_enclosing_node_with_task(cx: &mut gpui::TestAppContext) {
let buffer = cx.new(|cx| Buffer::local(text, cx).with_language(language, cx));
let multi_buffer = cx.new(|cx| MultiBuffer::singleton(buffer.clone(), cx));
let editor = cx.new_window_model(|window, cx| {
let editor = cx.new_window_entity(|window, cx| {
Editor::new(
EditorMode::Full,
multi_buffer,
@@ -14954,7 +14954,7 @@ async fn test_multi_buffer_folding(cx: &mut gpui::TestAppContext) {
);
multi_buffer
});
let multi_buffer_editor = cx.new_window_model(|window, cx| {
let multi_buffer_editor = cx.new_window_entity(|window, cx| {
Editor::new(
EditorMode::Full,
multi_buffer,
@@ -15109,7 +15109,7 @@ async fn test_multi_buffer_single_excerpts_folding(cx: &mut gpui::TestAppContext
multi_buffer
});
let multi_buffer_editor = cx.new_window_model(|window, cx| {
let multi_buffer_editor = cx.new_window_entity(|window, cx| {
Editor::new(
EditorMode::Full,
multi_buffer,
@@ -15229,7 +15229,7 @@ async fn test_multi_buffer_with_single_excerpt_folding(cx: &mut gpui::TestAppCon
);
multi_buffer
});
let multi_buffer_editor = cx.new_window_model(|window, cx| {
let multi_buffer_editor = cx.new_window_entity(|window, cx| {
Editor::new(
EditorMode::Full,
multi_buffer,
+2 -2
View File
@@ -306,7 +306,7 @@ fn show_hover(
let mut background_color: Option<Hsla> = None;
let parsed_content = cx
.new_window_model(|window, cx| {
.new_window_entity(|window, cx| {
let status_colors = cx.theme().status();
match local_diagnostic.diagnostic.severity {
@@ -556,7 +556,7 @@ async fn parse_blocks(
.join("\n\n");
let rendered_block = cx
.new_window_model(|window, cx| {
.new_window_entity(|window, cx| {
let settings = ThemeSettings::get_global(cx);
let ui_font_family = settings.ui_font.family.clone();
let ui_font_fallbacks = settings.ui_font.fallbacks.clone();
+18 -18
View File
@@ -14,8 +14,8 @@ use std::{ops::Range, sync::Arc};
use sum_tree::TreeMap;
use text::OffsetRangeExt;
use ui::{
prelude::*, ActiveTheme, ContextMenu, IconButtonShape, InteractiveElement, IntoElement,
ModelContext, ParentElement, PopoverMenu, Styled, Tooltip, Window,
prelude::*, ActiveTheme, Context, Context, ContextMenu, IconButtonShape, InteractiveElement,
IntoElement, ParentElement, PopoverMenu, Styled, Tooltip, Window,
};
use util::RangeExt;
use workspace::Item;
@@ -84,7 +84,7 @@ impl DiffMap {
&mut self,
change_set: Model<BufferChangeSet>,
window: &mut Window,
cx: &mut ModelContext<Editor>,
cx: &mut Context<Editor>,
) {
let buffer_id = change_set.read(cx).buffer_id;
self.snapshot
@@ -216,7 +216,7 @@ impl Editor {
&mut self,
hovered_hunk: &HoveredHunk,
window: &mut Window,
cx: &mut ModelContext<Editor>,
cx: &mut Context<Editor>,
) {
let editor_snapshot = self.snapshot(window, cx);
if let Some(diff_hunk) = to_diff_hunk(hovered_hunk, &editor_snapshot.buffer_snapshot) {
@@ -229,7 +229,7 @@ impl Editor {
&mut self,
_: &ToggleHunkDiff,
window: &mut Window,
cx: &mut ModelContext<Self>,
cx: &mut Context<Self>,
) {
let snapshot = self.snapshot(window, cx);
let selections = self.selections.all(cx);
@@ -240,7 +240,7 @@ impl Editor {
&mut self,
_: &ExpandAllHunkDiffs,
window: &mut Window,
cx: &mut ModelContext<Self>,
cx: &mut Context<Self>,
) {
let snapshot = self.snapshot(window, cx);
let display_rows_with_expanded_hunks = self
@@ -280,7 +280,7 @@ impl Editor {
&mut self,
hunks_to_toggle: Vec<MultiBufferDiffHunk>,
window: &mut Window,
cx: &mut ModelContext<Self>,
cx: &mut Context<Self>,
) {
if self.diff_map.expand_all {
return;
@@ -389,7 +389,7 @@ impl Editor {
diff_base_buffer: Option<Model<Buffer>>,
hunk: &HoveredHunk,
window: &mut Window,
cx: &mut ModelContext<Editor>,
cx: &mut Context<Editor>,
) -> Option<()> {
let buffer = self.buffer.clone();
let multi_buffer_snapshot = buffer.read(cx).snapshot(cx);
@@ -491,7 +491,7 @@ impl Editor {
&mut self,
range: Range<Anchor>,
window: &mut Window,
cx: &mut ModelContext<Editor>,
cx: &mut Context<Editor>,
) -> Option<()> {
let multi_buffer = self.buffer.read(cx);
let multi_buffer_snapshot = multi_buffer.snapshot(cx);
@@ -518,7 +518,7 @@ impl Editor {
&mut self,
_: &ApplyAllDiffHunks,
window: &mut Window,
cx: &mut ModelContext<Self>,
cx: &mut Context<Self>,
) {
let buffers = self.buffer.read(cx).all_buffers();
for branch_buffer in buffers {
@@ -536,7 +536,7 @@ impl Editor {
&mut self,
_: &ApplyDiffHunk,
window: &mut Window,
cx: &mut ModelContext<Self>,
cx: &mut Context<Self>,
) {
let snapshot = self.snapshot(window, cx);
let hunks = hunks_for_selections(&snapshot, &self.selections.all(cx));
@@ -572,7 +572,7 @@ impl Editor {
fn hunk_header_block(
&self,
hunk: &HoveredHunk,
cx: &mut ModelContext<Editor>,
cx: &mut Context<Editor>,
) -> BlockProperties<Anchor> {
let is_branch_buffer = self
.buffer
@@ -860,7 +860,7 @@ impl Editor {
diff_base_buffer: Model<Buffer>,
deleted_text_height: u32,
window: &mut Window,
cx: &mut ModelContext<Editor>,
cx: &mut Context<Editor>,
) -> BlockProperties<Anchor> {
let gutter_color = match hunk.status {
DiffHunkStatus::Added => unreachable!(),
@@ -923,7 +923,7 @@ impl Editor {
}
}
pub(super) fn clear_expanded_diff_hunks(&mut self, cx: &mut ModelContext<Editor>) -> bool {
pub(super) fn clear_expanded_diff_hunks(&mut self, cx: &mut Context<Editor>) -> bool {
if self.diff_map.expand_all {
return false;
}
@@ -947,7 +947,7 @@ impl Editor {
diff_map: &mut DiffMap,
buffer_id: BufferId,
window: &mut Window,
cx: &mut ModelContext<Self>,
cx: &mut Context<Self>,
) {
let diff_base_state = diff_map.diff_bases.get_mut(&buffer_id);
let mut diff_base_buffer = None;
@@ -1119,7 +1119,7 @@ impl Editor {
&mut self,
position: Anchor,
window: &mut Window,
cx: &mut ModelContext<Self>,
cx: &mut Context<Self>,
) {
let snapshot = self.snapshot(window, cx);
let position = position.to_point(&snapshot.buffer_snapshot);
@@ -1147,7 +1147,7 @@ impl Editor {
&mut self,
position: Anchor,
window: &mut Window,
cx: &mut ModelContext<Self>,
cx: &mut Context<Self>,
) {
let snapshot = self.snapshot(window, cx);
let position = position.to_point(&snapshot.buffer_snapshot);
@@ -1212,7 +1212,7 @@ fn editor_with_deleted_text(
deleted_color: Hsla,
hunk: &HoveredHunk,
window: &mut Window,
cx: &mut ModelContext<Editor>,
cx: &mut Context<Editor>,
) -> (u32, Model<Editor>) {
let parent_editor = cx.model().downgrade();
let editor = cx.new(|cx| {
+2 -2
View File
@@ -19,7 +19,7 @@ use crate::{
use anyhow::Context as _;
use clock::Global;
use futures::future;
use gpui::{AsyncAppContext, Context, Entity, Task, Window};
use gpui::{AsyncApp, Context, Entity, Task, Window};
use language::{language_settings::InlayHintKind, Buffer, BufferSnapshot};
use parking_lot::RwLock;
use project::{InlayHint, ResolveState};
@@ -840,7 +840,7 @@ fn new_update_task(
));
let query_range_failed =
|range: &Range<language::Anchor>, e: anyhow::Error, cx: &mut AsyncAppContext| {
|range: &Range<language::Anchor>, e: anyhow::Error, cx: &mut AsyncApp| {
log::error!("inlay hint update task for range failed: {e:#?}");
editor
.update(cx, |editor, cx| {
@@ -329,7 +329,7 @@ impl EditorLspTestContext {
where
T: 'static + request::Request,
T::Params: 'static + Send,
F: 'static + Send + FnMut(lsp::Url, T::Params, gpui::AsyncAppContext) -> Fut,
F: 'static + Send + FnMut(lsp::Url, T::Params, gpui::AsyncApp) -> Fut,
Fut: 'static + Send + Future<Output = Result<T::Result>>,
{
let url = self.buffer_lsp_url.clone();