Skip to content

Commit

Permalink
Dequalify WindowContext and AsyncWindowContext identifiers (#22444)
Browse files Browse the repository at this point in the history
This makes a WIP automated refactoring a bit easier to write

Release Notes:

- N/A
  • Loading branch information
mgsloan authored Dec 28, 2024
1 parent ac60dcd commit 9815358
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 22 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions crates/assistant/src/slash_command/auto_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use assistant_slash_command::{
};
use feature_flags::FeatureFlag;
use futures::StreamExt;
use gpui::{AppContext, AsyncAppContext, Task, WeakView};
use gpui::{AppContext, AsyncAppContext, AsyncWindowContext, Task, WeakView, WindowContext};
use language::{CodeLabel, LspAdapterDelegate};
use language_model::{
LanguageModelCompletionEvent, LanguageModelRegistry, LanguageModelRequest,
Expand All @@ -14,7 +14,7 @@ use language_model::{
use semantic_index::{FileSummary, SemanticDb};
use smol::channel;
use std::sync::{atomic::AtomicBool, Arc};
use ui::{prelude::*, BorrowAppContext, WindowContext};
use ui::{prelude::*, BorrowAppContext};
use util::ResultExt;
use workspace::Workspace;

Expand Down Expand Up @@ -115,7 +115,7 @@ impl SlashCommand for AutoCommand {
return Task::ready(Err(anyhow!("no project indexer")));
};

let task = cx.spawn(|cx: gpui::AsyncWindowContext| async move {
let task = cx.spawn(|cx: AsyncWindowContext| async move {
let summaries = project_index
.read_with(&cx, |project_index, cx| project_index.all_summaries(cx))?
.await?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl PickerDelegate for FetchContextPickerDelegate {

fn set_selected_index(&mut self, _ix: usize, _cx: &mut ViewContext<Picker<Self>>) {}

fn placeholder_text(&self, _cx: &mut ui::WindowContext) -> Arc<str> {
fn placeholder_text(&self, _cx: &mut WindowContext) -> Arc<str> {
"Enter a URL…".into()
}

Expand Down
1 change: 0 additions & 1 deletion crates/context_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ serde.workspace = true
serde_json.workspace = true
settings.workspace = true
smol.workspace = true
ui.workspace = true
url = { workspace = true, features = ["serde"] }
util.workspace = true
workspace.workspace = true
4 changes: 2 additions & 2 deletions crates/context_server/src/context_server_tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use anyhow::{anyhow, bail};
use assistant_tool::Tool;
use gpui::{Model, Task};
use gpui::{Model, Task, WindowContext};

use crate::manager::ContextServerManager;
use crate::types;
Expand Down Expand Up @@ -52,7 +52,7 @@ impl Tool for ContextServerTool {
self: std::sync::Arc<Self>,
input: serde_json::Value,
_workspace: gpui::WeakView<workspace::Workspace>,
cx: &mut ui::WindowContext,
cx: &mut WindowContext,
) -> gpui::Task<gpui::Result<String>> {
if let Some(server) = self.server_manager.read(cx).get_server(&self.server_id) {
cx.foreground_executor().spawn({
Expand Down
2 changes: 1 addition & 1 deletion crates/editor/src/proposed_changes_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl EventEmitter<EditorEvent> for ProposedChangesEditor {}
impl Item for ProposedChangesEditor {
type Event = EditorEvent;

fn tab_icon(&self, _cx: &ui::WindowContext) -> Option<Icon> {
fn tab_icon(&self, _cx: &WindowContext) -> Option<Icon> {
Some(Icon::new(IconName::Diff))
}

Expand Down
4 changes: 2 additions & 2 deletions crates/editor/src/scroll/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
ScrollAnchor, ScrollCursorBottom, ScrollCursorCenter, ScrollCursorCenterTopBottom,
ScrollCursorTop, SCROLL_CENTER_TOP_BOTTOM_DEBOUNCE_TIMEOUT,
};
use gpui::{Point, ViewContext};
use gpui::{AsyncWindowContext, Point, ViewContext};

impl Editor {
pub fn next_screen(&mut self, _: &NextScreen, cx: &mut ViewContext<Editor>) {
Expand Down Expand Up @@ -75,7 +75,7 @@ impl Editor {

self.next_scroll_position = self.next_scroll_position.next();
self._scroll_cursor_center_top_bottom_task =
cx.spawn(|editor, mut cx: gpui::AsyncWindowContext| async move {
cx.spawn(|editor, mut cx: AsyncWindowContext| async move {
cx.background_executor()
.timer(SCROLL_CENTER_TOP_BOTTOM_DEBOUNCE_TIMEOUT)
.await;
Expand Down
3 changes: 1 addition & 2 deletions crates/feedback/src/system_specs.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use client::telemetry;
use gpui::Task;
use gpui::{Task, WindowContext};
use human_bytes::human_bytes;
use release_channel::{AppCommitSha, AppVersion, ReleaseChannel};
use serde::Serialize;
use std::{env, fmt::Display};
use sysinfo::{MemoryRefreshKind, RefreshKind, System};
use ui::WindowContext;

#[derive(Clone, Debug, Serialize)]
pub struct SystemSpecs {
Expand Down
5 changes: 2 additions & 3 deletions crates/language_model/src/fake_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ use crate::{
LanguageModelProviderState, LanguageModelRequest,
};
use futures::{channel::mpsc, future::BoxFuture, stream::BoxStream, FutureExt, StreamExt};
use gpui::{AnyView, AppContext, AsyncAppContext, Task};
use gpui::{AnyView, AppContext, AsyncAppContext, Model, Task, WindowContext};
use http_client::Result;
use parking_lot::Mutex;
use serde::Serialize;
use std::sync::Arc;
use ui::WindowContext;

pub fn language_model_id() -> LanguageModelId {
LanguageModelId::from("fake".to_string())
Expand All @@ -33,7 +32,7 @@ pub struct FakeLanguageModelProvider;
impl LanguageModelProviderState for FakeLanguageModelProvider {
type ObservableEntity = ();

fn observable_entity(&self) -> Option<gpui::Model<Self::ObservableEntity>> {
fn observable_entity(&self) -> Option<Model<Self::ObservableEntity>> {
None
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/repl/src/notebook/notebook_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ impl Item for NotebookEditor {
.into_any_element()
}

fn tab_icon(&self, _cx: &ui::WindowContext) -> Option<Icon> {
fn tab_icon(&self, _cx: &WindowContext) -> Option<Icon> {
Some(IconName::Book.into())
}

Expand Down
3 changes: 1 addition & 2 deletions crates/vim/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ use editor::{
display_map::ToDisplayPoint,
Bias, Editor, ToPoint,
};
use gpui::{actions, impl_actions, Action, AppContext, Global, ViewContext};
use gpui::{actions, impl_actions, Action, AppContext, Global, ViewContext, WindowContext};
use language::Point;
use multi_buffer::MultiBufferRow;
use regex::Regex;
use search::{BufferSearchBar, SearchOptions};
use serde::Deserialize;
use ui::WindowContext;
use util::ResultExt;
use workspace::{notifications::NotifyResultExt, SaveIntent};

Expand Down
5 changes: 2 additions & 3 deletions crates/workspace/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,11 +1057,10 @@ pub mod test {
use gpui::{
AnyElement, AppContext, Context as _, EntityId, EventEmitter, FocusableView,
InteractiveElement, IntoElement, Model, Render, SharedString, Task, View, ViewContext,
VisualContext, WeakView,
VisualContext, WeakView, WindowContext,
};
use project::{Project, ProjectEntryId, ProjectPath, WorktreeId};
use std::{any::Any, cell::Cell, path::Path};
use ui::WindowContext;

pub struct TestProjectItem {
pub entry_id: Option<ProjectEntryId>,
Expand Down Expand Up @@ -1376,7 +1375,7 @@ pub mod test {
fn cleanup(
_workspace_id: WorkspaceId,
_alive_items: Vec<ItemId>,
_cx: &mut ui::WindowContext,
_cx: &mut WindowContext,
) -> Task<anyhow::Result<()>> {
Task::ready(Ok(()))
}
Expand Down

0 comments on commit 9815358

Please sign in to comment.