Dequalify WindowContext and AsyncWindowContext identifiers (#22444)

This makes a WIP automated refactoring a bit easier to write

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2024-12-28 14:21:32 -07:00 committed by GitHub
parent ac60dcd67a
commit 9815358bdd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 16 additions and 22 deletions

1
Cargo.lock generated
View file

@ -2928,7 +2928,6 @@ dependencies = [
"serde_json",
"settings",
"smol",
"ui",
"url",
"util",
"workspace",

View file

@ -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,
@ -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;
@ -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?;

View file

@ -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()
}

View file

@ -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

View file

@ -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;
@ -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({

View file

@ -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))
}

View file

@ -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>) {
@ -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;

View file

@ -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 {

View file

@ -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())
@ -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
}
}

View file

@ -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())
}

View file

@ -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};

View file

@ -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>,
@ -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(()))
}