Dequalify WindowContext and ViewContext references (#22477)
Release Notes: - N/A
This commit is contained in:
parent
016b5d60e1
commit
a15360bcc8
25 changed files with 43 additions and 51 deletions
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) = self
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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![
|
||||
|
|
|
@ -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 paused
|
||||
if !focused
|
||||
|| self.blinking_paused
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -844,7 +844,7 @@ pub mod test {
|
|||
"TestPanel"
|
||||
}
|
||||
|
||||
fn position(&self, _: &gpui::WindowContext) -> super::DockPosition {
|
||||
fn position(&self, _: &WindowContext) -> super::DockPosition {
|
||||
self.position
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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}");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue