Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Dequalify WindowContext and ViewContext references (#22477)
Michael Sloana15360bcc8d7
diff --git a/crates/assistant/src/slash_command/tab_command.rs b/crates/assistant/src/slash_command/tab_command.rsindex b6e38f2e479..adcb8398be0 100644--- a/crates/assistant/src/slash_command/tab_command.rs+++ b/crates/assistant/src/slash_command/tab_command.rs@@ -281,7 +281,7 @@ fn tab_items_for_queries(fn active_item_buffer(workspace: &mut Workspace,- cx: &mut ui::ViewContext<Workspace>,+ cx: &mut ViewContext<Workspace>,) -> anyhow::Result<BufferSnapshot> {let active_editor = workspace.active_item(cx)diff --git a/crates/auto_update_ui/src/update_notification.rs b/crates/auto_update_ui/src/update_notification.rsindex 7568a0eb1a9..33ac333a302 100644--- a/crates/auto_update_ui/src/update_notification.rs+++ b/crates/auto_update_ui/src/update_notification.rs@@ -18,7 +18,7 @@ pub struct UpdateNotification {impl EventEmitter<DismissEvent> for UpdateNotification {}impl Render for UpdateNotification {- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl IntoElement {+ fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {let app_name = ReleaseChannel::global(cx).display_name();v_flex()diff --git a/crates/collab_ui/src/chat_panel.rs b/crates/collab_ui/src/chat_panel.rsindex 75055247cba..4e6d8940b6d 100644--- a/crates/collab_ui/src/chat_panel.rs+++ b/crates/collab_ui/src/chat_panel.rs@@ -1096,7 +1096,7 @@ impl FocusableView for ChatPanel {}impl Panel for ChatPanel {- fn position(&self, cx: &gpui::WindowContext) -> DockPosition {+ fn position(&self, cx: &WindowContext) -> DockPosition {ChatPanelSettings::get_global(cx).dock}@@ -1112,7 +1112,7 @@ impl Panel for ChatPanel {);}- fn size(&self, cx: &gpui::WindowContext) -> Pixels {+ fn size(&self, cx: &WindowContext) -> Pixels {self.width.unwrap_or_else(|| ChatPanelSettings::get_global(cx).default_width)}diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rsindex f5e345043da..1f60f65b418 100644--- a/crates/collab_ui/src/collab_panel.rs+++ b/crates/collab_ui/src/collab_panel.rs@@ -2719,7 +2719,7 @@ impl Render for CollabPanel {impl EventEmitter<PanelEvent> for CollabPanel {}impl Panel for CollabPanel {- fn position(&self, cx: &gpui::WindowContext) -> DockPosition {+ fn position(&self, cx: &WindowContext) -> DockPosition {CollaborationPanelSettings::get_global(cx).dock}@@ -2735,7 +2735,7 @@ impl Panel for CollabPanel {);}- fn size(&self, cx: &gpui::WindowContext) -> Pixels {+ fn size(&self, cx: &WindowContext) -> Pixels {self.width.unwrap_or_else(|| CollaborationPanelSettings::get_global(cx).default_width)}@@ -2746,7 +2746,7 @@ impl Panel for CollabPanel {cx.notify();}- fn icon(&self, cx: &gpui::WindowContext) -> Option<ui::IconName> {+ fn icon(&self, cx: &WindowContext) -> Option<ui::IconName> {CollaborationPanelSettings::get_global(cx).button.then_some(ui::IconName::UserGroup)diff --git a/crates/collab_ui/src/notification_panel.rs b/crates/collab_ui/src/notification_panel.rsindex 410b90c7271..005220471a1 100644--- a/crates/collab_ui/src/notification_panel.rs+++ b/crates/collab_ui/src/notification_panel.rs@@ -662,7 +662,7 @@ impl Panel for NotificationPanel {"NotificationPanel"}- fn position(&self, cx: &gpui::WindowContext) -> DockPosition {+ fn position(&self, cx: &WindowContext) -> DockPosition {NotificationPanelSettings::get_global(cx).dock}@@ -678,7 +678,7 @@ impl Panel for NotificationPanel {);}- fn size(&self, cx: &gpui::WindowContext) -> Pixels {+ fn size(&self, cx: &WindowContext) -> Pixels {self.width.unwrap_or_else(|| NotificationPanelSettings::get_global(cx).default_width)}@@ -702,7 +702,7 @@ impl Panel for NotificationPanel {}}- fn icon(&self, cx: &gpui::WindowContext) -> Option<IconName> {+ fn icon(&self, cx: &WindowContext) -> Option<IconName> {let show_button = NotificationPanelSettings::get_global(cx).button;if !show_button {return None;diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rsindex 208971763db..4dca33e3ada 100644--- a/crates/git_ui/src/git_panel.rs+++ b/crates/git_ui/src/git_panel.rs@@ -1199,7 +1199,7 @@ impl Panel for GitPanel {"GitPanel"}- fn position(&self, cx: &gpui::WindowContext) -> DockPosition {+ fn position(&self, cx: &WindowContext) -> DockPosition {GitPanelSettings::get_global(cx).dock}@@ -1215,7 +1215,7 @@ impl Panel for GitPanel {);}- fn size(&self, cx: &gpui::WindowContext) -> Pixels {+ fn size(&self, cx: &WindowContext) -> Pixels {self.width.unwrap_or_else(|| GitPanelSettings::get_global(cx).default_width)}diff --git a/crates/gpui/src/elements/animation.rs b/crates/gpui/src/elements/animation.rsindex bffa52cfbaf..2cab9e8fa46 100644--- a/crates/gpui/src/elements/animation.rs+++ b/crates/gpui/src/elements/animation.rs@@ -1,6 +1,6 @@use std::time::{Duration, Instant};-use crate::{AnyElement, Element, ElementId, GlobalElementId, IntoElement};+use crate::{AnyElement, Element, ElementId, GlobalElementId, IntoElement, WindowContext};pub use easing::*;@@ -104,7 +104,7 @@ impl<E: IntoElement + 'static> Element for AnimationElement<E> {fn request_layout(&mut self,global_id: Option<&GlobalElementId>,- cx: &mut crate::WindowContext,+ cx: &mut WindowContext,) -> (crate::LayoutId, Self::RequestLayoutState) {cx.with_element_state(global_id.unwrap(), |state, cx| {let state = state.unwrap_or_else(|| AnimationState {@@ -145,7 +145,7 @@ impl<E: IntoElement + 'static> Element for AnimationElement<E> {_id: Option<&GlobalElementId>,_bounds: crate::Bounds<crate::Pixels>,element: &mut Self::RequestLayoutState,- cx: &mut crate::WindowContext,+ cx: &mut WindowContext,) -> Self::PrepaintState {element.prepaint(cx);}@@ -156,7 +156,7 @@ impl<E: IntoElement + 'static> Element for AnimationElement<E> {_bounds: crate::Bounds<crate::Pixels>,element: &mut Self::RequestLayoutState,_: &mut Self::PrepaintState,- cx: &mut crate::WindowContext,+ cx: &mut WindowContext,) {element.paint(cx);}diff --git a/crates/gpui/src/elements/list.rs b/crates/gpui/src/elements/list.rsindex 47f0a82774e..e652f303735 100644--- a/crates/gpui/src/elements/list.rs+++ b/crates/gpui/src/elements/list.rs@@ -716,7 +716,7 @@ impl Element for List {fn request_layout(&mut self,_id: Option<&GlobalElementId>,- cx: &mut crate::WindowContext,+ cx: &mut WindowContext,) -> (crate::LayoutId, Self::RequestLayoutState) {let layout_id = match self.sizing_behavior {ListSizingBehavior::Infer => {@@ -827,7 +827,7 @@ impl Element for List {bounds: Bounds<crate::Pixels>,_: &mut Self::RequestLayoutState,prepaint: &mut Self::PrepaintState,- cx: &mut crate::WindowContext,+ cx: &mut WindowContext,) {cx.with_content_mask(Some(ContentMask { bounds }), |cx| {for item in &mut prepaint.layout.item_layouts {diff --git a/crates/gpui/src/interactive.rs b/crates/gpui/src/interactive.rsindex daa9b30877c..a6cff28ffbe 100644--- a/crates/gpui/src/interactive.rs+++ b/crates/gpui/src/interactive.rs@@ -468,7 +468,7 @@ mod test {use crate::{self as gpui, div, FocusHandle, InteractiveElement, IntoElement, KeyBinding, Keystroke,- ParentElement, Render, TestAppContext, VisualContext,+ ParentElement, Render, TestAppContext, ViewContext, VisualContext,};struct TestView {@@ -480,7 +480,7 @@ mod test {actions!(test, [TestAction]);impl Render for TestView {- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl IntoElement {+ fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {div().id("testview").child(div().key_context("parent")diff --git a/crates/gpui_macros/src/derive_render.rs b/crates/gpui_macros/src/derive_render.rsindex 2b39248f808..e76466fd107 100644--- a/crates/gpui_macros/src/derive_render.rs+++ b/crates/gpui_macros/src/derive_render.rs@@ -11,7 +11,7 @@ pub fn derive_render(input: TokenStream) -> TokenStream {impl #impl_generics gpui::Render for #type_name #type_generics#where_clause{- fn render(&mut self, _cx: &mut gpui::ViewContext<Self>) -> impl gpui::Element {+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl gpui::Element {gpui::Empty}}diff --git a/crates/language_tools/src/syntax_tree_view.rs b/crates/language_tools/src/syntax_tree_view.rsindex f96dc6a87fb..ba40d55761f 100644--- a/crates/language_tools/src/syntax_tree_view.rs+++ b/crates/language_tools/src/syntax_tree_view.rs@@ -273,7 +273,7 @@ impl SyntaxTreeView {}impl Render for SyntaxTreeView {- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl IntoElement {+ fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {let mut rendered = div().flex_1();if let Some(layer) = selfdiff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rsindex 39f1c8a543e..483d64d8eb7 100644--- a/crates/project_panel/src/project_panel.rs+++ b/crates/project_panel/src/project_panel.rs@@ -3810,7 +3810,7 @@ fn item_width_estimate(depth: usize, item_text_chars: usize, is_symlink: bool) -}impl Render for ProjectPanel {- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl IntoElement {+ fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {let has_worktree = !self.visible_entries.is_empty();let project = self.project.read(cx);let indent_size = ProjectPanelSettings::get_global(cx).indent_size;diff --git a/crates/recent_projects/src/ssh_connections.rs b/crates/recent_projects/src/ssh_connections.rsindex 1c084bbf6e9..ad8985d20f0 100644--- a/crates/recent_projects/src/ssh_connections.rs+++ b/crates/recent_projects/src/ssh_connections.rs@@ -357,7 +357,7 @@ impl RenderOnce for SshConnectionHeader {}impl Render for SshConnectionModal {- fn render(&mut self, cx: &mut ui::ViewContext<Self>) -> impl ui::IntoElement {+ fn render(&mut self, cx: &mut ViewContext<Self>) -> impl ui::IntoElement {let nickname = self.prompt.read(cx).nickname.clone();let connection_string = self.prompt.read(cx).connection_string.clone();diff --git a/crates/semantic_index/src/project_index_debug_view.rs b/crates/semantic_index/src/project_index_debug_view.rsindex 4f59290f021..80563bcffa8 100644--- a/crates/semantic_index/src/project_index_debug_view.rs+++ b/crates/semantic_index/src/project_index_debug_view.rs@@ -196,7 +196,7 @@ impl ProjectIndexDebugView {}impl Render for ProjectIndexDebugView {- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl IntoElement {+ fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {if let Some(selected_path) = self.selected_path.as_ref() {v_flex().child(diff --git a/crates/storybook/src/stories/focus.rs b/crates/storybook/src/stories/focus.rsindex 4240aa6fd19..9eb715dbd91 100644--- a/crates/storybook/src/stories/focus.rs+++ b/crates/storybook/src/stories/focus.rs@@ -56,7 +56,7 @@ impl FocusStory {}impl Render for FocusStory {- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl IntoElement {+ fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {let theme = cx.theme();let color_1 = theme.status().created;let color_2 = theme.status().modified;diff --git a/crates/storybook/src/stories/picker.rs b/crates/storybook/src/stories/picker.rsindex 5df6cc23c41..19c115a6b24 100644--- a/crates/storybook/src/stories/picker.rs+++ b/crates/storybook/src/stories/picker.rs@@ -45,7 +45,7 @@ impl PickerDelegate for Delegate {&self,ix: usize,selected: bool,- _cx: &mut gpui::ViewContext<Picker<Self>>,+ _cx: &mut ViewContext<Picker<Self>>,) -> Option<Self::ListItem> {let candidate_ix = self.matches.get(ix)?;// TASK: Make StringMatchCandidate::string a SharedString@@ -64,12 +64,12 @@ impl PickerDelegate for Delegate {self.selected_ix}- fn set_selected_index(&mut self, ix: usize, cx: &mut gpui::ViewContext<Picker<Self>>) {+ fn set_selected_index(&mut self, ix: usize, cx: &mut ViewContext<Picker<Self>>) {self.selected_ix = ix;cx.notify();}- fn confirm(&mut self, secondary: bool, _cx: &mut gpui::ViewContext<Picker<Self>>) {+ fn confirm(&mut self, secondary: bool, _cx: &mut ViewContext<Picker<Self>>) {let candidate_ix = self.matches[self.selected_ix];let candidate = self.candidates[candidate_ix].string.clone();@@ -80,15 +80,11 @@ impl PickerDelegate for Delegate {}}- fn dismissed(&mut self, cx: &mut gpui::ViewContext<Picker<Self>>) {+ fn dismissed(&mut self, cx: &mut ViewContext<Picker<Self>>) {cx.quit();}- fn update_matches(- &mut self,- query: String,- cx: &mut gpui::ViewContext<Picker<Self>>,- ) -> Task<()> {+ fn update_matches(&mut self, query: String, cx: &mut ViewContext<Picker<Self>>) -> Task<()> {let candidates = self.candidates.clone();self.matches = cx.background_executor()@@ -194,7 +190,7 @@ impl PickerStory {}impl Render for PickerStory {- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl IntoElement {+ fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {div().bg(cx.theme().styles.colors.background).size_full()diff --git a/crates/storybook/src/stories/scroll.rs b/crates/storybook/src/stories/scroll.rsindex 096afaccf6f..ace2b4811fe 100644--- a/crates/storybook/src/stories/scroll.rs+++ b/crates/storybook/src/stories/scroll.rs@@ -11,7 +11,7 @@ impl ScrollStory {}impl Render for ScrollStory {- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl IntoElement {+ fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {let theme = cx.theme();let color_1 = theme.status().created;let color_2 = theme.status().modified;diff --git a/crates/storybook/src/stories/text.rs b/crates/storybook/src/stories/text.rsindex 6c37b88ee6d..8aa0ea701b7 100644--- a/crates/storybook/src/stories/text.rs+++ b/crates/storybook/src/stories/text.rs@@ -1,6 +1,6 @@use gpui::{div, green, red, HighlightStyle, InteractiveText, IntoElement, ParentElement, Render, Styled,- StyledText, View, VisualContext, WindowContext,+ StyledText, View, ViewContext, VisualContext, WindowContext,};use indoc::indoc;use story::*;@@ -14,7 +14,7 @@ impl TextStory {}impl Render for TextStory {- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl IntoElement {+ fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {Story::container().child(Story::title("Text")).children(vec![diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rsindex ee3fbd8f39a..1ca5b7adb14 100644--- a/crates/terminal_view/src/terminal_view.rs+++ b/crates/terminal_view/src/terminal_view.rs@@ -420,7 +420,7 @@ impl TerminalView {cx.notify();}- pub fn should_show_cursor(&self, focused: bool, cx: &mut gpui::ViewContext<Self>) -> bool {+ pub fn should_show_cursor(&self, focused: bool, cx: &mut ViewContext<Self>) -> bool {//Don't blink the cursor when not focused, blinking is disabled, or pausedif !focused|| self.blinking_pauseddiff --git a/crates/welcome/src/base_keymap_picker.rs b/crates/welcome/src/base_keymap_picker.rsindex 0d546ebed25..fcffef91aa7 100644--- a/crates/welcome/src/base_keymap_picker.rs+++ b/crates/welcome/src/base_keymap_picker.rs@@ -194,7 +194,7 @@ impl PickerDelegate for BaseKeymapSelectorDelegate {&self,ix: usize,selected: bool,- _cx: &mut gpui::ViewContext<Picker<Self>>,+ _cx: &mut ViewContext<Picker<Self>>,) -> Option<Self::ListItem> {let keymap_match = &self.matches[ix];diff --git a/crates/welcome/src/welcome.rs b/crates/welcome/src/welcome.rsindex 7a0b5711b78..6264f72a121 100644--- a/crates/welcome/src/welcome.rs+++ b/crates/welcome/src/welcome.rs@@ -69,7 +69,7 @@ pub struct WelcomePage {}impl Render for WelcomePage {- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl IntoElement {+ fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {h_flex().size_full().bg(cx.theme().colors().editor_background)diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rsindex fa69c9aa612..46201de2a3b 100644--- a/crates/workspace/src/dock.rs+++ b/crates/workspace/src/dock.rs@@ -844,7 +844,7 @@ pub mod test {"TestPanel"}- fn position(&self, _: &gpui::WindowContext) -> super::DockPosition {+ fn position(&self, _: &WindowContext) -> super::DockPosition {self.position}diff --git a/crates/workspace/src/item.rs b/crates/workspace/src/item.rsindex 2808bd498f1..3a3a61b319a 100644--- a/crates/workspace/src/item.rs+++ b/crates/workspace/src/item.rs@@ -1239,11 +1239,7 @@ pub mod test {None}- fn tab_content(- &self,- params: TabContentParams,- _cx: &ui::prelude::WindowContext,- ) -> AnyElement {+ fn tab_content(&self, params: TabContentParams, _cx: &WindowContext) -> AnyElement {self.tab_detail.set(params.detail);gpui::div().into_any_element()}diff --git a/crates/workspace/src/pane_group.rs b/crates/workspace/src/pane_group.rsindex 722c48f0585..168f6539e01 100644--- a/crates/workspace/src/pane_group.rs+++ b/crates/workspace/src/pane_group.rs@@ -1018,7 +1018,7 @@ mod element {fn request_layout(&mut self,_global_id: Option<&GlobalElementId>,- cx: &mut ui::prelude::WindowContext,+ cx: &mut WindowContext,) -> (gpui::LayoutId, Self::RequestLayoutState) {let style = Style {flex_grow: 1.,@@ -1119,7 +1119,7 @@ mod element {bounds: gpui::Bounds<ui::prelude::Pixels>,_: &mut Self::RequestLayoutState,layout: &mut Self::PrepaintState,- cx: &mut ui::prelude::WindowContext,+ cx: &mut WindowContext,) {for child in &mut layout.children {child.element.paint(cx);diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rsindex 284980bf50d..b6795cda142 100644--- a/crates/zed/src/zed.rs+++ b/crates/zed/src/zed.rs@@ -695,7 +695,7 @@ fn initialize_pane(workspace: &Workspace, pane: &View<Pane>, cx: &mut ViewContex});}-fn about(_: &mut Workspace, _: &zed_actions::About, cx: &mut gpui::ViewContext<Workspace>) {+fn about(_: &mut Workspace, _: &zed_actions::About, cx: &mut ViewContext<Workspace>) {let release_channel = ReleaseChannel::global(cx).display_name();let version = env!("CARGO_PKG_VERSION");let message = format!("{release_channel} {version}");