mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-31 19:05:00 +07:00
Merge gpui::Task and scheduler::Task (#53674)
Release Notes: - N/A or Added/Fixed/Improved ...
This commit is contained in:
parent
20620a8c08
commit
be705e677b
143 changed files with 256 additions and 291 deletions
|
|
@ -37,7 +37,7 @@ use futures::future::Shared;
|
|||
use futures::{FutureExt as _, StreamExt as _, future};
|
||||
use gpui::{
|
||||
App, AppContext, AsyncApp, Context, Entity, EntityId, SharedString, Subscription, Task,
|
||||
WeakEntity,
|
||||
TaskExt, WeakEntity,
|
||||
};
|
||||
use language_model::{IconOrSvg, LanguageModel, LanguageModelProvider, LanguageModelRegistry};
|
||||
use project::{AgentId, Project, ProjectItem, ProjectPath, Worktree};
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use extension_host::ExtensionStore;
|
|||
use fs::Fs;
|
||||
use gpui::{
|
||||
Action, Anchor, AnyView, App, AsyncWindowContext, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
ScrollHandle, Subscription, Task, WeakEntity,
|
||||
ScrollHandle, Subscription, Task, TaskExt, WeakEntity,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use language::LanguageRegistry;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use anyhow::Result;
|
|||
use collections::HashSet;
|
||||
use fs::Fs;
|
||||
use gpui::{
|
||||
DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Render, ScrollHandle, Task,
|
||||
DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Render, ScrollHandle, Task, TaskExt,
|
||||
};
|
||||
use language_model::LanguageModelRegistry;
|
||||
use language_models::provider::open_ai_compatible::{AvailableModel, ModelCapabilities};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ use editor::{Editor, EditorElement, EditorStyle};
|
|||
|
||||
use gpui::{
|
||||
AsyncWindowContext, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, ScrollHandle,
|
||||
Subscription, Task, TextStyle, TextStyleRefinement, UnderlineStyle, WeakEntity, prelude::*,
|
||||
Subscription, Task, TaskExt, TextStyle, TextStyleRefinement, UnderlineStyle, WeakEntity,
|
||||
prelude::*,
|
||||
};
|
||||
use language::{Language, LanguageRegistry};
|
||||
use markdown::{Markdown, MarkdownElement, MarkdownStyle};
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use editor::{
|
|||
|
||||
use gpui::{
|
||||
Action, AnyElement, App, AppContext, Empty, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
Global, SharedString, Subscription, Task, WeakEntity, Window, prelude::*,
|
||||
Global, SharedString, Subscription, Task, TaskExt, WeakEntity, Window, prelude::*,
|
||||
};
|
||||
|
||||
use language::{Buffer, Capability, OffsetRangeExt, Point};
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ use fs::Fs;
|
|||
use gpui::{
|
||||
Action, Anchor, Animation, AnimationExt, AnyElement, App, AsyncWindowContext, ClipboardItem,
|
||||
Entity, EventEmitter, ExternalPaths, FocusHandle, Focusable, KeyContext, Pixels, Subscription,
|
||||
Task, UpdateGlobal, WeakEntity, prelude::*, pulsating_between,
|
||||
Task, TaskExt, UpdateGlobal, WeakEntity, prelude::*, pulsating_between,
|
||||
};
|
||||
use language::LanguageRegistry;
|
||||
use language_model::LanguageModelRegistry;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ use futures::FutureExt as _;
|
|||
use gpui::{
|
||||
Action, Animation, AnimationExt, AnyView, App, ClickEvent, ClipboardItem, CursorStyle,
|
||||
ElementId, Empty, Entity, EventEmitter, FocusHandle, Focusable, Hsla, ListOffset, ListState,
|
||||
ObjectFit, PlatformDisplay, ScrollHandle, SharedString, Subscription, Task, TextStyle,
|
||||
ObjectFit, PlatformDisplay, ScrollHandle, SharedString, Subscription, Task, TaskExt, TextStyle,
|
||||
WeakEntity, Window, WindowHandle, div, ease_in_out, img, linear_color_stop, linear_gradient,
|
||||
list, point, pulsating_between,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use feature_flags::AcpBetaFeatureFlag;
|
|||
use crate::message_editor::SharedSessionCapabilities;
|
||||
|
||||
use gpui::List;
|
||||
use gpui::TaskExt;
|
||||
use heapless::Vec as ArrayVec;
|
||||
use language_model::{LanguageModelEffortLevel, Speed};
|
||||
use settings::{SidebarSide, update_settings_file};
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ use editor::{
|
|||
use fs::Fs;
|
||||
use futures::{FutureExt, channel::mpsc};
|
||||
use gpui::{
|
||||
App, Context, Entity, Focusable, Global, HighlightStyle, Subscription, Task, UpdateGlobal,
|
||||
WeakEntity, Window, point,
|
||||
App, Context, Entity, Focusable, Global, HighlightStyle, Subscription, Task, TaskExt,
|
||||
UpdateGlobal, WeakEntity, Window, point,
|
||||
};
|
||||
use language::{Buffer, Point, Selection, TransactionId};
|
||||
use language_model::{ConfigurationError, ConfiguredModel, LanguageModelRegistry};
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ use editor::{
|
|||
use futures::{FutureExt as _, future::join_all};
|
||||
use gpui::{
|
||||
AppContext, ClipboardEntry, ClipboardItem, Context, Entity, EventEmitter, FocusHandle,
|
||||
Focusable, ImageFormat, KeyContext, SharedString, Subscription, Task, TextStyle, WeakEntity,
|
||||
Focusable, ImageFormat, KeyContext, SharedString, Subscription, Task, TaskExt, TextStyle,
|
||||
WeakEntity,
|
||||
};
|
||||
use language::{Buffer, language_settings::InlayHintKind};
|
||||
use parking_lot::RwLock;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use futures::FutureExt;
|
|||
use fuzzy::{StringMatchCandidate, match_strings};
|
||||
use gpui::{
|
||||
Action, AsyncWindowContext, BackgroundExecutor, DismissEvent, FocusHandle, Subscription, Task,
|
||||
WeakEntity,
|
||||
TaskExt, WeakEntity,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use ordered_float::OrderedFloat;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use fs::Fs;
|
|||
use futures::FutureExt as _;
|
||||
use gpui::{
|
||||
App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, MouseDownEvent,
|
||||
Render, SharedString, Task, WeakEntity, Window,
|
||||
Render, SharedString, Task, TaskExt, WeakEntity, Window,
|
||||
};
|
||||
use itertools::Itertools as _;
|
||||
use notifications::status_toast::StatusToast;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use db::{
|
|||
};
|
||||
use fs::Fs;
|
||||
use futures::{FutureExt, future::Shared};
|
||||
use gpui::{AppContext as _, Entity, Global, Subscription, Task};
|
||||
use gpui::{AppContext as _, Entity, Global, Subscription, Task, TaskExt};
|
||||
pub use project::WorktreePaths;
|
||||
use project::{AgentId, linked_worktree_short_name};
|
||||
use remote::{RemoteConnectionOptions, same_remote_connection_identity};
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ use fs::Fs;
|
|||
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||
use gpui::{
|
||||
AnyElement, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
ListState, Render, SharedString, Subscription, Task, WeakEntity, Window, list, prelude::*, px,
|
||||
ListState, Render, SharedString, Subscription, Task, TaskExt, WeakEntity, Window, list,
|
||||
prelude::*, px,
|
||||
};
|
||||
use itertools::Itertools as _;
|
||||
use menu::{Confirm, SelectFirst, SelectLast, SelectNext, SelectPrevious};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ use acp_thread::MentionUri;
|
|||
use agent_client_protocol::schema as acp;
|
||||
use editor::{Editor, SelectionEffects, scroll::Autoscroll};
|
||||
use gpui::{
|
||||
Animation, AnimationExt, AnyView, Context, IntoElement, WeakEntity, Window, pulsating_between,
|
||||
Animation, AnimationExt, AnyView, Context, IntoElement, TaskExt, WeakEntity, Window,
|
||||
pulsating_between,
|
||||
};
|
||||
use prompt_store::PromptId;
|
||||
use rope::Point;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub use young_account_banner::YoungAccountBanner;
|
|||
use std::sync::Arc;
|
||||
|
||||
use client::{Client, UserStore, zed_urls};
|
||||
use gpui::{AnyElement, Entity, IntoElement, ParentElement};
|
||||
use gpui::{AnyElement, Entity, IntoElement, ParentElement, TaskExt};
|
||||
use ui::{Divider, RegisterComponent, Tooltip, Vector, VectorName, prelude::*};
|
||||
|
||||
#[derive(PartialEq)]
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ use client::Client;
|
|||
use db::kvp::KeyValueStore;
|
||||
use futures_lite::StreamExt;
|
||||
use gpui::{
|
||||
App, AppContext as _, AsyncApp, BackgroundExecutor, Context, Entity, Global, Task, Window,
|
||||
actions,
|
||||
App, AppContext as _, AsyncApp, BackgroundExecutor, Context, Entity, Global, Task, TaskExt,
|
||||
Window, actions,
|
||||
};
|
||||
use http_client::{HttpClient, HttpClientWithUrl};
|
||||
use paths::remote_servers_dir;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ use db::kvp::Dismissable;
|
|||
use editor::{Editor, MultiBuffer};
|
||||
use fs::Fs;
|
||||
use gpui::{
|
||||
App, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Window, actions, prelude::*,
|
||||
App, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, TaskExt, Window, actions,
|
||||
prelude::*,
|
||||
};
|
||||
use markdown_preview::markdown_preview_view::{MarkdownPreviewMode, MarkdownPreviewView};
|
||||
use notifications::status_toast::StatusToast;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use collections::HashSet;
|
|||
use futures::{Future, FutureExt, channel::oneshot, future::Shared};
|
||||
use gpui::{
|
||||
AnyView, App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Subscription, Task,
|
||||
WeakEntity, Window,
|
||||
TaskExt, WeakEntity, Window,
|
||||
};
|
||||
use postage::watch;
|
||||
use project::Project;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use fs::Fs;
|
|||
use futures::StreamExt;
|
||||
use gpui::{
|
||||
App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, FutureExt as _,
|
||||
ScreenCaptureSource, ScreenCaptureStream, Task, Timeout, WeakEntity,
|
||||
ScreenCaptureSource, ScreenCaptureStream, Task, TaskExt, Timeout, WeakEntity,
|
||||
};
|
||||
use gpui_tokio::Tokio;
|
||||
use language::LanguageRegistry;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ use futures::{
|
|||
future::BoxFuture,
|
||||
stream::BoxStream,
|
||||
};
|
||||
use gpui::{App, AsyncApp, Entity, Global, Task, WeakEntity, actions};
|
||||
use gpui::{App, AsyncApp, Entity, Global, Task, TaskExt, WeakEntity, actions};
|
||||
use http_client::{HttpClient, HttpClientWithUrl, http, read_proxy_from_env};
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use postage::watch;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use cloud_api_types::websocket_protocol::MessageToClient;
|
|||
use cloud_llm_client::{EXPIRED_LLM_TOKEN_HEADER_NAME, OUTDATED_LLM_TOKEN_HEADER_NAME};
|
||||
use gpui::{
|
||||
App, AppContext as _, Context, Entity, EventEmitter, Global, ReadGlobal as _, Subscription,
|
||||
TaskExt,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ use derive_more::Deref;
|
|||
use feature_flags::FeatureFlagAppExt;
|
||||
use futures::{Future, StreamExt, channel::mpsc};
|
||||
use gpui::{
|
||||
App, AsyncApp, Context, Entity, EventEmitter, SharedString, SharedUri, Task, WeakEntity,
|
||||
App, AsyncApp, Context, Entity, EventEmitter, SharedString, SharedUri, Task, TaskExt,
|
||||
WeakEntity,
|
||||
};
|
||||
use http_client::http::{HeaderMap, HeaderValue};
|
||||
use postage::{sink::Sink, watch};
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use collections::{BTreeMap, HashMap};
|
|||
use editor::Bias;
|
||||
use fs::{FakeFs, Fs as _};
|
||||
use git::status::{FileStatus, StatusCode, TrackedStatus, UnmergedStatus, UnmergedStatusCode};
|
||||
use gpui::{BackgroundExecutor, Entity, TestAppContext};
|
||||
use gpui::{BackgroundExecutor, Entity, TaskExt, TestAppContext};
|
||||
use language::{
|
||||
FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, PointUtf16, range_to_lsp,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ use client::{
|
|||
use fuzzy::{StringMatchCandidate, match_strings};
|
||||
use gpui::{
|
||||
App, ClipboardItem, Context, DismissEvent, Entity, EventEmitter, Focusable, ParentElement,
|
||||
Render, Styled, Subscription, Task, WeakEntity, Window, actions, anchored, deferred, div,
|
||||
Render, Styled, Subscription, Task, TaskExt, WeakEntity, Window, actions, anchored, deferred,
|
||||
div,
|
||||
};
|
||||
use picker::{Picker, PickerDelegate};
|
||||
use std::sync::Arc;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::notification_window_options;
|
||||
use call::{ActiveCall, IncomingCall};
|
||||
use futures::StreamExt;
|
||||
use gpui::{App, WindowHandle, prelude::*};
|
||||
use gpui::{App, TaskExt, WindowHandle, prelude::*};
|
||||
|
||||
use std::sync::{Arc, Weak};
|
||||
use ui::{CollabNotification, prelude::*};
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use crate::notification_window_options;
|
|||
use call::{ActiveCall, room};
|
||||
use client::User;
|
||||
use collections::HashMap;
|
||||
use gpui::{App, Size};
|
||||
use gpui::{App, Size, TaskExt};
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
use ui::{CollabNotification, prelude::*};
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use command_palette_hooks::{
|
|||
use fuzzy_nucleo::{StringMatch, StringMatchCandidate};
|
||||
use gpui::{
|
||||
Action, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
ParentElement, Render, Styled, Task, WeakEntity, Window,
|
||||
ParentElement, Render, Styled, Task, TaskExt, WeakEntity, Window,
|
||||
};
|
||||
use persistence::CommandPaletteDB;
|
||||
use picker::Direction;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use edit_prediction_types::{
|
|||
EditPrediction, EditPredictionDelegate, EditPredictionDiscardReason, EditPredictionIconSet,
|
||||
interpolate_edits,
|
||||
};
|
||||
use gpui::{App, Context, Entity, Task};
|
||||
use gpui::{App, Context, Entity, Task, TaskExt};
|
||||
use icons::IconName;
|
||||
use language::{Anchor, Buffer, BufferSnapshot, EditPreview, OffsetRangeExt, ToPointUtf16};
|
||||
use std::{ops::Range, sync::Arc, time::Duration};
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use anyhow::{Result, anyhow};
|
|||
use collections::HashSet;
|
||||
use fs::Fs;
|
||||
use futures::{AsyncBufReadExt, AsyncReadExt, StreamExt, io::BufReader, stream::BoxStream};
|
||||
use gpui::TaskExt;
|
||||
use gpui::WeakEntity;
|
||||
use gpui::{App, AsyncApp, Global, prelude::*};
|
||||
use http_client::HttpRequestExt;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use copilot::{
|
|||
use gpui::{
|
||||
App, ClipboardItem, Context, DismissEvent, Element, Entity, EventEmitter, FocusHandle,
|
||||
Focusable, InteractiveElement, IntoElement, MouseDownEvent, ParentElement, Render, Styled,
|
||||
Subscription, Window, WindowBounds, WindowOptions, div, point,
|
||||
Subscription, TaskExt, Window, WindowBounds, WindowOptions, div, point,
|
||||
};
|
||||
use project::project_settings::ProjectSettings;
|
||||
use settings::Settings as _;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ use futures::{
|
|||
};
|
||||
use gpui::{
|
||||
App, AppContext, Context, Empty, Entity, EventEmitter, FocusHandle, Focusable, IntoElement,
|
||||
ParentElement, Render, SharedString, Styled, Subscription, WeakEntity, Window, actions, div,
|
||||
ParentElement, Render, SharedString, Styled, Subscription, TaskExt, WeakEntity, Window,
|
||||
actions, div,
|
||||
};
|
||||
use project::{
|
||||
Project,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use dap::{DapRegistry, DebugRequest};
|
||||
use futures::channel::oneshot;
|
||||
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||
use gpui::{AppContext, DismissEvent, Entity, EventEmitter, Focusable, Render, Task};
|
||||
use gpui::{AppContext, DismissEvent, Entity, EventEmitter, Focusable, Render, Task, TaskExt};
|
||||
use gpui::{Subscription, WeakEntity};
|
||||
use picker::{Picker, PickerDelegate};
|
||||
use project::Project;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use feature_flags::{FeatureFlag, FeatureFlagAppExt as _, PresenceFlag, register_
|
|||
use gpui::{
|
||||
Action, Anchor, App, AsyncWindowContext, ClipboardItem, Context, DismissEvent, Entity,
|
||||
EntityId, EventEmitter, FocusHandle, Focusable, MouseButton, MouseDownEvent, Point,
|
||||
Subscription, Task, WeakEntity, anchored, deferred,
|
||||
Subscription, Task, TaskExt, WeakEntity, anchored, deferred,
|
||||
};
|
||||
|
||||
use itertools::Itertools as _;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::any::TypeId;
|
|||
|
||||
use debugger_panel::DebugPanel;
|
||||
use editor::{Editor, MultiBufferOffsetUtf16};
|
||||
use gpui::{Action, App, DispatchPhase, EntityInputHandler, actions};
|
||||
use gpui::{Action, App, DispatchPhase, EntityInputHandler, TaskExt, actions};
|
||||
use new_process_modal::{NewProcessModal, NewProcessMode};
|
||||
use project::debugger::{self, breakpoint_store::SourceBreakpoint, session::ThreadStatus};
|
||||
use schemars::JsonSchema;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use editor::Editor;
|
|||
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||
use gpui::{
|
||||
Action, App, AppContext, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
KeyContext, Render, Subscription, Task, WeakEntity, actions,
|
||||
KeyContext, Render, Subscription, Task, TaskExt, WeakEntity, actions,
|
||||
};
|
||||
use itertools::Itertools as _;
|
||||
use picker::{Picker, PickerDelegate, highlighted_match_with_paths::HighlightedMatch};
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ use dap::{
|
|||
use futures::{SinkExt, channel::mpsc};
|
||||
use gpui::{
|
||||
Action as _, AnyView, AppContext, Axis, Entity, EntityId, EventEmitter, FocusHandle, Focusable,
|
||||
NoAction, Pixels, Point, Subscription, Task, WeakEntity,
|
||||
NoAction, Pixels, Point, Subscription, Task, TaskExt, WeakEntity,
|
||||
};
|
||||
use language::Buffer;
|
||||
use loaded_source_list::LoadedSourceList;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use dap::adapters::DebugAdapterName;
|
|||
use db::kvp::KeyValueStore;
|
||||
use gpui::{
|
||||
Action, AnyElement, Entity, EventEmitter, FocusHandle, Focusable, FontWeight, ListState,
|
||||
Subscription, Task, WeakEntity, list,
|
||||
Subscription, Task, TaskExt, WeakEntity, list,
|
||||
};
|
||||
use util::{
|
||||
debug_panic,
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@ use dap::{
|
|||
use editor::Editor;
|
||||
use gpui::{
|
||||
Action, AnyElement, ClickEvent, ClipboardItem, Context, DismissEvent, Empty, Entity,
|
||||
FocusHandle, Focusable, Hsla, MouseDownEvent, Point, Subscription, TextStyleRefinement,
|
||||
UniformListScrollHandle, WeakEntity, actions, anchored, deferred, uniform_list,
|
||||
FocusHandle, Focusable, Hsla, MouseDownEvent, Point, Subscription, TaskExt,
|
||||
TextStyleRefinement, UniformListScrollHandle, WeakEntity, actions, anchored, deferred,
|
||||
uniform_list,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use menu::{SelectFirst, SelectLast, SelectNext, SelectPrevious};
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use editor::{
|
|||
use gpui::{
|
||||
AnyElement, App, AppContext, Context, Entity, EntityId, EventEmitter, FocusHandle, Focusable,
|
||||
InteractiveElement, IntoElement, ParentElement, Render, SharedString, Styled, Subscription,
|
||||
Task, WeakEntity, Window, actions, div,
|
||||
Task, TaskExt, WeakEntity, Window, actions, div,
|
||||
};
|
||||
use language::{Buffer, Capability, DiagnosticEntry, DiagnosticEntryRef, Point};
|
||||
use project::{
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ use futures::{
|
|||
select_biased,
|
||||
};
|
||||
use gpui::BackgroundExecutor;
|
||||
use gpui::TaskExt;
|
||||
use gpui::http_client::Url;
|
||||
use gpui::{
|
||||
App, AsyncApp, Entity, EntityId, Global, SharedString, Task, WeakEntity, actions,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use cloud_llm_client::EditPredictionRejectReason;
|
|||
use credentials_provider::CredentialsProvider;
|
||||
use futures::AsyncReadExt as _;
|
||||
use gpui::{
|
||||
App, AppContext as _, Context, Entity, Global, SharedString, Task,
|
||||
App, AppContext as _, Context, Entity, Global, SharedString, Task, TaskExt,
|
||||
http_client::{self, AsyncBody, HttpClient, Method, StatusCode},
|
||||
};
|
||||
use language::{ToOffset, ToPoint as _};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::{Context as _, Result};
|
||||
use futures::AsyncReadExt as _;
|
||||
use gpui::{
|
||||
App, SharedString,
|
||||
App, SharedString, TaskExt,
|
||||
http_client::{self, HttpClient},
|
||||
};
|
||||
use language::language_settings::OpenAiCompatibleEditPredictionSettings;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use cloud_llm_client::{
|
|||
AcceptEditPredictionBody, EditPredictionRejectReason, predict_edits_v3::RawCompletionRequest,
|
||||
};
|
||||
use edit_prediction_types::PredictedCursorPosition;
|
||||
use gpui::{App, AppContext as _, Entity, Task, WeakEntity, prelude::*};
|
||||
use gpui::{App, AppContext as _, Entity, Task, TaskExt, WeakEntity, prelude::*};
|
||||
use language::{
|
||||
Buffer, BufferSnapshot, DiagnosticSeverity, OffsetRangeExt as _, ToOffset as _,
|
||||
language_settings::all_language_settings, text_diff,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ use crate::assemble_excerpts::assemble_excerpt_ranges;
|
|||
use anyhow::Result;
|
||||
use collections::HashMap;
|
||||
use futures::{FutureExt, StreamExt as _, channel::mpsc, future};
|
||||
use gpui::{App, AppContext, AsyncApp, Context, Entity, EntityId, EventEmitter, Task, WeakEntity};
|
||||
use gpui::{
|
||||
App, AppContext, AsyncApp, Context, Entity, EntityId, EventEmitter, Task, TaskExt, WeakEntity,
|
||||
};
|
||||
use language::{Anchor, Buffer, BufferSnapshot, OffsetRangeExt as _, Point, ToOffset as _};
|
||||
use project::{LocationLink, Project, ProjectPath};
|
||||
use smallvec::SmallVec;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use feature_flags::FeatureFlagAppExt;
|
|||
use fs::Fs;
|
||||
use gpui::{
|
||||
Action, Anchor, Animation, AnimationExt, App, AsyncWindowContext, Entity, FocusHandle,
|
||||
Focusable, IntoElement, ParentElement, Render, Subscription, WeakEntity, actions, div,
|
||||
Focusable, IntoElement, ParentElement, Render, Subscription, TaskExt, WeakEntity, actions, div,
|
||||
ease_in_out, pulsating_between,
|
||||
};
|
||||
use indoc::indoc;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use edit_prediction::{EditPredictionStore, ResetOnboarding, capture_example};
|
|||
use edit_prediction_context_view::EditPredictionContextView;
|
||||
use editor::Editor;
|
||||
use feature_flags::FeatureFlagAppExt as _;
|
||||
use gpui::TaskExt;
|
||||
use gpui::actions;
|
||||
use language::language_settings::AllLanguageSettings;
|
||||
use project::DisableAiSettings;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use anyhow::Context as _;
|
||||
use gpui::{App, Context, Entity, Window};
|
||||
use gpui::{App, Context, Entity, TaskExt, Window};
|
||||
use language::Language;
|
||||
use project::lsp_store::lsp_ext_command::SwitchSourceHeaderResult;
|
||||
use rpc::proto;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ use crate::scroll::ScrollAmount;
|
|||
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||
use gpui::{
|
||||
AnyElement, Entity, Focusable, FontWeight, ListSizingBehavior, ScrollHandle, ScrollStrategy,
|
||||
SharedString, Size, StrikethroughStyle, StyledText, Task, UniformListScrollHandle, div, px,
|
||||
uniform_list,
|
||||
SharedString, Size, StrikethroughStyle, StyledText, Task, TaskExt, UniformListScrollHandle,
|
||||
div, px, uniform_list,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use language::CodeLabel;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::sync::Arc;
|
|||
|
||||
use collections::{HashMap, HashSet};
|
||||
use futures::future::join_all;
|
||||
use gpui::{MouseButton, SharedString, Task, WeakEntity};
|
||||
use gpui::{MouseButton, SharedString, Task, TaskExt, WeakEntity};
|
||||
use itertools::Itertools;
|
||||
use language::{BufferId, ClientCommand};
|
||||
use multi_buffer::{Anchor, MultiBufferRow, MultiBufferSnapshot, ToPoint as _};
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ use buffer_diff::{BufferDiff, DiffHunkSecondaryStatus, DiffHunkStatus, DiffHunkS
|
|||
use collections::HashMap;
|
||||
use futures::{StreamExt, channel::oneshot};
|
||||
use gpui::{
|
||||
BackgroundExecutor, DismissEvent, Task, TestAppContext, UpdateGlobal, VisualTestContext,
|
||||
WindowBounds, WindowOptions, div,
|
||||
BackgroundExecutor, DismissEvent, Task, TaskExt, TestAppContext, UpdateGlobal,
|
||||
VisualTestContext, WindowBounds, WindowOptions, div,
|
||||
};
|
||||
use indoc::indoc;
|
||||
use language::{
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@ use gpui::{
|
|||
Modifiers, ModifiersChangedEvent, MouseButton, MouseClickEvent, MouseDownEvent, MouseMoveEvent,
|
||||
MousePressureEvent, MouseUpEvent, PaintQuad, ParentElement, Pixels, PressureStage, ScrollDelta,
|
||||
ScrollHandle, ScrollWheelEvent, ShapedLine, SharedString, Size, StatefulInteractiveElement,
|
||||
Style, Styled, StyledText, TextAlign, TextRun, TextStyleRefinement, WeakEntity, Window,
|
||||
anchored, deferred, div, fill, linear_color_stop, linear_gradient, outline, pattern_slash,
|
||||
point, px, quad, relative, size, solid_background, transparent_black,
|
||||
Style, Styled, StyledText, TaskExt, TextAlign, TextRun, TextStyleRefinement, WeakEntity,
|
||||
Window, anchored, deferred, div, fill, linear_color_stop, linear_gradient, outline,
|
||||
pattern_slash, point, px, quad, relative, size, solid_background, transparent_black,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use language::{
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ use anyhow::Context as _;
|
|||
use gpui::{
|
||||
AnyElement, App, AsyncWindowContext, Bounds, Context, Entity, Focusable as _, FontWeight, Hsla,
|
||||
InteractiveElement, IntoElement, MouseButton, ParentElement, Pixels, ScrollHandle, Size,
|
||||
StatefulInteractiveElement, StyleRefinement, Styled, Subscription, Task, TextStyleRefinement,
|
||||
Window, canvas, div, px,
|
||||
StatefulInteractiveElement, StyleRefinement, Styled, Subscription, Task, TaskExt,
|
||||
TextStyleRefinement, Window, canvas, div, px,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use language::{DiagnosticEntry, Language, LanguageRegistry};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::{fs, path::Path};
|
||||
|
||||
use anyhow::Context as _;
|
||||
use gpui::{App, AppContext as _, Context, Entity, Window};
|
||||
use gpui::{App, AppContext as _, Context, Entity, TaskExt, Window};
|
||||
use language::{Capability, Language, proto::serialize_anchor};
|
||||
use multi_buffer::MultiBuffer;
|
||||
use project::{
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ use futures::{
|
|||
select_biased,
|
||||
};
|
||||
use gpui::{
|
||||
App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, Task, UpdateGlobal as _,
|
||||
WeakEntity, actions,
|
||||
App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, Task, TaskExt,
|
||||
UpdateGlobal as _, WeakEntity, actions,
|
||||
};
|
||||
use http_client::{AsyncBody, HttpClient, HttpClientWithUrl};
|
||||
use language::{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use collections::{BTreeMap, HashSet};
|
|||
use extension::ExtensionHostProxy;
|
||||
use fs::{FakeFs, Fs, RealFs};
|
||||
use futures::{AsyncReadExt, FutureExt, StreamExt, io::BufReader};
|
||||
use gpui::{AppContext as _, BackgroundExecutor, TestAppContext};
|
||||
use gpui::{AppContext as _, BackgroundExecutor, TaskExt, TestAppContext};
|
||||
use http_client::{FakeHttpClient, Response};
|
||||
use language::{BinaryStatus, LanguageMatcher, LanguageName, LanguageRegistry};
|
||||
use language_extension::LspAccess;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use extension_host::{ExtensionManifest, ExtensionOperation, ExtensionStore};
|
|||
use fuzzy::{StringMatchCandidate, match_strings};
|
||||
use gpui::{
|
||||
Action, Anchor, App, ClipboardItem, Context, Entity, EventEmitter, Focusable,
|
||||
InteractiveElement, KeyContext, ParentElement, Point, Render, Styled, Task, TextStyle,
|
||||
InteractiveElement, KeyContext, ParentElement, Point, Render, Styled, Task, TaskExt, TextStyle,
|
||||
UniformListScrollHandle, WeakEntity, Window, actions, point, uniform_list,
|
||||
};
|
||||
use num_format::{Locale, ToFormattedString};
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use fuzzy_nucleo::{PathMatch, PathMatchCandidate};
|
|||
use gpui::{
|
||||
Action, AnyElement, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
KeyContext, Modifiers, ModifiersChangedEvent, ParentElement, Render,
|
||||
StatefulInteractiveElement, Styled, Task, WeakEntity, Window, actions, rems,
|
||||
StatefulInteractiveElement, Styled, Task, TaskExt, WeakEntity, Window, actions, rems,
|
||||
};
|
||||
use open_path_prompt::{
|
||||
OpenPathPrompt,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use gpui::http_client::Url;
|
|||
use gpui::{
|
||||
Action, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
InteractiveElement, IntoElement, Modifiers, ModifiersChangedEvent, ParentElement, Render,
|
||||
SharedString, Styled, Subscription, Task, WeakEntity, Window, actions, rems,
|
||||
SharedString, Styled, Subscription, Task, TaskExt, WeakEntity, Window, actions, rems,
|
||||
};
|
||||
use picker::{Picker, PickerDelegate, PickerEditorPosition};
|
||||
use project::git_store::{Repository, RepositoryEvent};
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ use git::{
|
|||
use gpui::{
|
||||
AbsoluteLength, Action, Anchor, AsyncApp, AsyncWindowContext, Bounds, ClickEvent, DismissEvent,
|
||||
Empty, Entity, EventEmitter, FocusHandle, Focusable, KeyContext, MouseButton, MouseDownEvent,
|
||||
Point, PromptLevel, ScrollStrategy, Subscription, Task, TextStyle, UniformListScrollHandle,
|
||||
WeakEntity, actions, anchored, deferred, point, size, uniform_list,
|
||||
Point, PromptLevel, ScrollStrategy, Subscription, Task, TaskExt, TextStyle,
|
||||
UniformListScrollHandle, WeakEntity, actions, anchored, deferred, point, size, uniform_list,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use language::{Buffer, File};
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use git::{
|
|||
};
|
||||
use gpui::{
|
||||
App, ClipboardItem, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
SharedString, Subscription, Task, Window,
|
||||
SharedString, Subscription, Task, TaskExt, Window,
|
||||
};
|
||||
use menu::{Cancel, Confirm};
|
||||
use project::git_store::Repository;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use git::stash::StashEntry;
|
|||
use gpui::{
|
||||
Action, AnyElement, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
InteractiveElement, IntoElement, Modifiers, ModifiersChangedEvent, ParentElement, Render,
|
||||
SharedString, Styled, Subscription, Task, WeakEntity, Window, actions, rems,
|
||||
SharedString, Styled, Subscription, Task, TaskExt, WeakEntity, Window, actions, rems,
|
||||
};
|
||||
use picker::{Picker, PickerDelegate};
|
||||
use project::git_store::{Repository, RepositoryEvent};
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ use fuzzy::StringMatchCandidate;
|
|||
use git::repository::Worktree as GitWorktree;
|
||||
use gpui::{
|
||||
Action, AnyElement, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
IntoElement, ParentElement, Render, SharedString, Styled, Subscription, Task, WeakEntity,
|
||||
Window, actions, rems,
|
||||
IntoElement, ParentElement, Render, SharedString, Styled, Subscription, Task, TaskExt,
|
||||
WeakEntity, Window, actions, rems,
|
||||
};
|
||||
use picker::{Picker, PickerDelegate, PickerEditorPosition};
|
||||
use project::Project;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use std::sync::Arc;
|
|||
use anyhow::anyhow;
|
||||
use collections::HashSet;
|
||||
use fs::Fs;
|
||||
use gpui::{AsyncWindowContext, Entity, SharedString, WeakEntity};
|
||||
use gpui::{AsyncWindowContext, Entity, SharedString, TaskExt, WeakEntity};
|
||||
use project::Project;
|
||||
use project::git_store::Repository;
|
||||
use project::project_settings::ProjectSettings;
|
||||
|
|
|
|||
|
|
@ -4,12 +4,11 @@ use futures::prelude::*;
|
|||
use gpui_util::{TryFutureExt, TryFutureExtBacktrace};
|
||||
use scheduler::Instant;
|
||||
use scheduler::Scheduler;
|
||||
use std::{
|
||||
fmt::Debug, future::Future, marker::PhantomData, mem, pin::Pin, rc::Rc, sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
use std::{future::Future, marker::PhantomData, mem, pin::Pin, rc::Rc, sync::Arc, time::Duration};
|
||||
|
||||
pub use scheduler::{FallibleTask, ForegroundExecutor as SchedulerForegroundExecutor, Priority};
|
||||
pub use scheduler::{
|
||||
FallibleTask, ForegroundExecutor as SchedulerForegroundExecutor, Priority, Task,
|
||||
};
|
||||
|
||||
/// A pointer to the executor that is currently running,
|
||||
/// for spawning background tasks.
|
||||
|
|
@ -28,83 +27,32 @@ pub struct ForegroundExecutor {
|
|||
not_send: PhantomData<Rc<()>>,
|
||||
}
|
||||
|
||||
/// Task is a primitive that allows work to happen in the background.
|
||||
/// Extension trait for `Task<Result<T, E>>` that adds `detach_and_log_err` with an `&App` context.
|
||||
///
|
||||
/// It implements [`Future`] so you can `.await` on it.
|
||||
///
|
||||
/// If you drop a task it will be cancelled immediately. Calling [`Task::detach`] allows
|
||||
/// the task to continue running, but with no way to return a value.
|
||||
#[must_use]
|
||||
#[derive(Debug)]
|
||||
pub struct Task<T>(scheduler::Task<T>);
|
||||
|
||||
impl<T> Task<T> {
|
||||
/// Creates a new task that will resolve with the value.
|
||||
pub fn ready(val: T) -> Self {
|
||||
Task(scheduler::Task::ready(val))
|
||||
}
|
||||
|
||||
/// Returns true if the task has completed or was created with `Task::ready`.
|
||||
pub fn is_ready(&self) -> bool {
|
||||
self.0.is_ready()
|
||||
}
|
||||
|
||||
/// Detaching a task runs it to completion in the background.
|
||||
pub fn detach(self) {
|
||||
self.0.detach()
|
||||
}
|
||||
|
||||
/// Wraps a scheduler::Task.
|
||||
pub fn from_scheduler(task: scheduler::Task<T>) -> Self {
|
||||
Task(task)
|
||||
}
|
||||
|
||||
/// Converts this task into a fallible task that returns `Option<T>`.
|
||||
///
|
||||
/// Unlike the standard `Task<T>`, a [`FallibleTask`] will return `None`
|
||||
/// if the task was cancelled.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```ignore
|
||||
/// // Background task that gracefully handles cancellation:
|
||||
/// cx.background_spawn(async move {
|
||||
/// let result = foreground_task.fallible().await;
|
||||
/// if let Some(value) = result {
|
||||
/// // Process the value
|
||||
/// }
|
||||
/// // If None, task was cancelled - just exit gracefully
|
||||
/// }).detach();
|
||||
/// ```
|
||||
pub fn fallible(self) -> FallibleTask<T> {
|
||||
self.0.fallible()
|
||||
}
|
||||
/// This trait is automatically implemented for all `Task<Result<T, E>>` types.
|
||||
pub trait TaskExt<T, E> {
|
||||
/// Run the task to completion in the background and log any errors that occur.
|
||||
fn detach_and_log_err(self, cx: &App);
|
||||
/// Like [`Self::detach_and_log_err`], but uses `{:?}` formatting on failure so `anyhow::Error`
|
||||
/// values emit their full backtrace. Prefer `detach_and_log_err` unless a backtrace is wanted.
|
||||
fn detach_and_log_err_with_backtrace(self, cx: &App);
|
||||
}
|
||||
|
||||
impl<T, E> Task<Result<T, E>>
|
||||
impl<T, E> TaskExt<T, E> for Task<Result<T, E>>
|
||||
where
|
||||
T: 'static,
|
||||
E: 'static + std::fmt::Display,
|
||||
E: 'static + std::fmt::Display + std::fmt::Debug,
|
||||
{
|
||||
/// Run the task to completion in the background and log any errors that occur.
|
||||
#[track_caller]
|
||||
pub fn detach_and_log_err(self, cx: &App) {
|
||||
fn detach_and_log_err(self, cx: &App) {
|
||||
let location = core::panic::Location::caller();
|
||||
cx.foreground_executor()
|
||||
.spawn(self.log_tracked_err(*location))
|
||||
.detach();
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, E> Task<Result<T, E>>
|
||||
where
|
||||
T: 'static,
|
||||
E: 'static + std::fmt::Debug,
|
||||
{
|
||||
/// Like [`Self::detach_and_log_err`], but uses `{:?}` formatting on failure so `anyhow::Error`
|
||||
/// values emit their full backtrace. Prefer `detach_and_log_err` unless a backtrace is wanted.
|
||||
#[track_caller]
|
||||
pub fn detach_and_log_err_with_backtrace(self, cx: &App) {
|
||||
fn detach_and_log_err_with_backtrace(self, cx: &App) {
|
||||
let location = *core::panic::Location::caller();
|
||||
cx.foreground_executor()
|
||||
.spawn(self.log_tracked_err_with_backtrace(location))
|
||||
|
|
@ -112,20 +60,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> std::future::Future for Task<T> {
|
||||
type Output = T;
|
||||
|
||||
fn poll(
|
||||
self: std::pin::Pin<&mut Self>,
|
||||
cx: &mut std::task::Context<'_>,
|
||||
) -> std::task::Poll<Self::Output> {
|
||||
// SAFETY: Task is a repr(transparent) wrapper around scheduler::Task,
|
||||
// and we're just projecting the pin through to the inner task.
|
||||
let inner = unsafe { self.map_unchecked_mut(|t| &mut t.0) };
|
||||
inner.poll(cx)
|
||||
}
|
||||
}
|
||||
|
||||
impl BackgroundExecutor {
|
||||
/// Creates a new BackgroundExecutor from the given PlatformDispatcher.
|
||||
pub fn new(dispatcher: Arc<dyn PlatformDispatcher>) -> Self {
|
||||
|
|
@ -175,9 +109,9 @@ impl BackgroundExecutor {
|
|||
R: Send + 'static,
|
||||
{
|
||||
if priority == Priority::RealtimeAudio {
|
||||
Task::from_scheduler(self.inner.spawn_realtime(future))
|
||||
self.inner.spawn_realtime(future)
|
||||
} else {
|
||||
Task::from_scheduler(self.inner.spawn_with_priority(priority, future))
|
||||
self.inner.spawn_with_priority(priority, future)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -426,7 +360,7 @@ impl ForegroundExecutor {
|
|||
where
|
||||
R: 'static,
|
||||
{
|
||||
Task::from_scheduler(self.inner.spawn(future.boxed_local()))
|
||||
self.inner.spawn(future.boxed_local())
|
||||
}
|
||||
|
||||
/// Enqueues the given Task to run on the main thread with the given priority.
|
||||
|
|
@ -440,7 +374,7 @@ impl ForegroundExecutor {
|
|||
R: 'static,
|
||||
{
|
||||
// Priority is ignored for foreground tasks - they run in order on the main thread
|
||||
Task::from_scheduler(self.inner.spawn(future))
|
||||
self.inner.spawn(future)
|
||||
}
|
||||
|
||||
/// Used by the test harness to run an async test in a synchronous fashion.
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@
|
|||
pub use crate::{
|
||||
AppContext as _, BorrowAppContext, Context, Element, InteractiveElement, IntoElement,
|
||||
ParentElement, Refineable, Render, RenderOnce, StatefulInteractiveElement, Styled, StyledImage,
|
||||
VisualContext, util::FluentBuilder,
|
||||
TaskExt as _, VisualContext, util::FluentBuilder,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use anyhow::{Context as _, anyhow};
|
||||
use gpui::{App, DivInspectorState, Inspector, InspectorElementId, IntoElement, Window};
|
||||
use gpui::{App, DivInspectorState, Inspector, InspectorElementId, IntoElement, TaskExt, Window};
|
||||
use std::{cell::OnceCell, path::Path, sync::Arc};
|
||||
use ui::{Label, Tooltip, prelude::*, utils::platform_title_bar_height};
|
||||
use util::{ResultExt as _, command::new_command};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use chrono::{Datelike, Local, NaiveTime, Timelike};
|
||||
use editor::scroll::Autoscroll;
|
||||
use editor::{Editor, SelectionEffects};
|
||||
use gpui::{App, AppContext as _, Context, Window, actions};
|
||||
use gpui::{App, AppContext as _, Context, TaskExt, Window, actions};
|
||||
pub use settings::HourFormat;
|
||||
use settings::{RegisterSetting, Settings};
|
||||
use std::{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use anyhow::Result;
|
|||
use collections::BTreeMap;
|
||||
use credentials_provider::CredentialsProvider;
|
||||
use futures::{FutureExt, StreamExt, future::BoxFuture, stream::BoxStream};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, Task};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, Task, TaskExt};
|
||||
use http_client::HttpClient;
|
||||
use language_model::{
|
||||
ANTHROPIC_PROVIDER_ID, ANTHROPIC_PROVIDER_NAME, ApiKeyState, AuthenticateError,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ use collections::{BTreeMap, HashMap};
|
|||
use credentials_provider::CredentialsProvider;
|
||||
use futures::{FutureExt, Stream, StreamExt, future::BoxFuture, stream::BoxStream};
|
||||
use gpui::{
|
||||
AnyView, App, AsyncApp, Context, Entity, FocusHandle, Subscription, Task, Window, actions,
|
||||
AnyView, App, AsyncApp, Context, Entity, FocusHandle, Subscription, Task, TaskExt, Window,
|
||||
actions,
|
||||
};
|
||||
use gpui_tokio::Tokio;
|
||||
use http_client::HttpClient;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use cloud_api_types::Plan;
|
|||
use futures::FutureExt;
|
||||
use futures::StreamExt;
|
||||
use futures::future::BoxFuture;
|
||||
use gpui::{AnyElement, AnyView, App, AppContext, Context, Entity, Subscription, Task};
|
||||
use gpui::{AnyElement, AnyView, App, AppContext, Context, Entity, Subscription, Task, TaskExt};
|
||||
use language_model::{
|
||||
AuthenticateError, IconOrSvg, LanguageModel, LanguageModelProvider, LanguageModelProviderId,
|
||||
LanguageModelProviderName, LanguageModelProviderState, ZED_CLOUD_PROVIDER_ID,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use deepseek::DEEPSEEK_API_URL;
|
|||
|
||||
use futures::Stream;
|
||||
use futures::{FutureExt, StreamExt, future::BoxFuture, stream::BoxStream};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, SharedString, Task, Window};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, SharedString, Task, TaskExt, Window};
|
||||
use http_client::HttpClient;
|
||||
use language_model::{
|
||||
ApiKeyState, AuthenticateError, EnvVar, IconOrSvg, LanguageModel, LanguageModelCompletionError,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use credentials_provider::CredentialsProvider;
|
|||
use futures::{FutureExt, StreamExt, future::BoxFuture};
|
||||
pub use google_ai::completion::{GoogleEventMapper, into_google};
|
||||
use google_ai::{GenerateContentResponse, GoogleModelMode};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, SharedString, Task, Window};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, SharedString, Task, TaskExt, Window};
|
||||
use http_client::HttpClient;
|
||||
use language_model::{
|
||||
AuthenticateError, ConfigurationViewTargetAgent, EnvVar, LanguageModelCompletionError,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use credentials_provider::CredentialsProvider;
|
|||
use fs::Fs;
|
||||
use futures::Stream;
|
||||
use futures::{FutureExt, StreamExt, future::BoxFuture, stream::BoxStream};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, CursorStyle, Entity, Subscription, Task};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, CursorStyle, Entity, Subscription, Task, TaskExt};
|
||||
use http_client::HttpClient;
|
||||
use language_model::{
|
||||
ApiKeyState, AuthenticateError, EnvVar, IconOrSvg, LanguageModel, LanguageModelCompletionError,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use collections::BTreeMap;
|
|||
use credentials_provider::CredentialsProvider;
|
||||
|
||||
use futures::{FutureExt, Stream, StreamExt, future::BoxFuture, stream::BoxStream};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, Global, SharedString, Task, Window};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, Global, SharedString, Task, TaskExt, Window};
|
||||
use http_client::HttpClient;
|
||||
use language_model::{
|
||||
ApiKeyState, AuthenticateError, EnvVar, IconOrSvg, LanguageModel, LanguageModelCompletionError,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use credentials_provider::CredentialsProvider;
|
|||
use fs::Fs;
|
||||
use futures::{FutureExt, StreamExt, future::BoxFuture, stream::BoxStream};
|
||||
use futures::{Stream, TryFutureExt, stream};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, CursorStyle, Entity, Task};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, CursorStyle, Entity, Task, TaskExt};
|
||||
use http_client::HttpClient;
|
||||
use language_model::{
|
||||
ApiKeyState, AuthenticateError, EnvVar, IconOrSvg, LanguageModel, LanguageModelCompletionError,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use collections::BTreeMap;
|
||||
use credentials_provider::CredentialsProvider;
|
||||
use futures::{FutureExt, StreamExt, future::BoxFuture};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, SharedString, Task, Window};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, SharedString, Task, TaskExt, Window};
|
||||
use http_client::HttpClient;
|
||||
use language_model::{
|
||||
ApiKeyState, AuthenticateError, EnvVar, IconOrSvg, LanguageModel, LanguageModelCompletionError,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use convert_case::{Case, Casing};
|
||||
use credentials_provider::CredentialsProvider;
|
||||
use futures::{FutureExt, StreamExt, future::BoxFuture};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, SharedString, Task, Window};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, SharedString, Task, TaskExt, Window};
|
||||
use http_client::HttpClient;
|
||||
use language_model::{
|
||||
ApiKeyState, AuthenticateError, EnvVar, IconOrSvg, LanguageModel, LanguageModelCompletionError,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use collections::HashMap;
|
||||
use credentials_provider::CredentialsProvider;
|
||||
use futures::{FutureExt, Stream, StreamExt, future::BoxFuture};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, SharedString, Task};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, SharedString, Task, TaskExt};
|
||||
use http_client::HttpClient;
|
||||
use language_model::{
|
||||
ApiKeyState, AuthenticateError, EnvVar, IconOrSvg, LanguageModel, LanguageModelCompletionError,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use collections::BTreeMap;
|
|||
use credentials_provider::CredentialsProvider;
|
||||
use fs::Fs;
|
||||
use futures::{FutureExt, StreamExt, future::BoxFuture};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, SharedString, Task, Window};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, SharedString, Task, TaskExt, Window};
|
||||
use http_client::{AsyncBody, HttpClient, http};
|
||||
use language_model::{
|
||||
ApiKeyState, AuthenticateError, EnvVar, IconOrSvg, LanguageModel, LanguageModelCompletionError,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use collections::BTreeMap;
|
||||
use credentials_provider::CredentialsProvider;
|
||||
use futures::{AsyncReadExt, FutureExt, StreamExt, future::BoxFuture};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, SharedString, Task, Window};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, SharedString, Task, TaskExt, Window};
|
||||
use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest, http};
|
||||
use language_model::{
|
||||
ApiKeyState, AuthenticateError, EnvVar, IconOrSvg, LanguageModel, LanguageModelCompletionError,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use collections::BTreeMap;
|
||||
use credentials_provider::CredentialsProvider;
|
||||
use futures::{FutureExt, StreamExt, future::BoxFuture};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, Task, Window};
|
||||
use gpui::{AnyView, App, AsyncApp, Context, Entity, Task, TaskExt, Window};
|
||||
use http_client::HttpClient;
|
||||
use language_model::{
|
||||
ApiKeyState, AuthenticateError, EnvVar, IconOrSvg, LanguageModel, LanguageModelCompletionError,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use editor::Editor;
|
|||
use fuzzy::{StringMatch, StringMatchCandidate, match_strings};
|
||||
use gpui::{
|
||||
App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, ParentElement,
|
||||
Render, Styled, WeakEntity, Window, actions,
|
||||
Render, Styled, TaskExt, WeakEntity, Window, actions,
|
||||
};
|
||||
use language::{Buffer, LanguageMatcher, LanguageName, LanguageRegistry};
|
||||
use open_path_prompt::file_finder_settings::FileFinderSettings;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use language::language_settings::{EditPredictionProvider, all_language_settings}
|
|||
use client::proto;
|
||||
use collections::HashSet;
|
||||
use editor::{Editor, EditorEvent};
|
||||
use gpui::{Anchor, Entity, Subscription, Task, WeakEntity, actions};
|
||||
use gpui::{Anchor, Entity, Subscription, Task, TaskExt, WeakEntity, actions};
|
||||
use language::{BinaryStatus, BufferId, ServerHealth};
|
||||
use lsp::{LanguageServerId, LanguageServerName, LanguageServerSelector};
|
||||
use project::{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use client::{Client, TelemetrySettings, UserStore, zed_urls};
|
|||
use cloud_api_types::Plan;
|
||||
use collections::HashMap;
|
||||
use fs::Fs;
|
||||
use gpui::{Action, Animation, AnimationExt, App, Entity, IntoElement, pulsating_between};
|
||||
use gpui::{Action, Animation, AnimationExt, App, Entity, IntoElement, TaskExt, pulsating_between};
|
||||
use project::agent_server_store::AllAgentServersSettings;
|
||||
use project::project_settings::ProjectSettings;
|
||||
use project::{AgentRegistryStore, RegistryAgent};
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use gpui::{
|
|||
DismissEvent, Div, ElementId, Entity, EventEmitter, FocusHandle, Focusable, HighlightStyle,
|
||||
InteractiveElement, IntoElement, KeyContext, ListHorizontalSizingBehavior, ListSizingBehavior,
|
||||
MouseButton, MouseDownEvent, ParentElement, Pixels, Point, Render, ScrollStrategy,
|
||||
SharedString, Stateful, StatefulInteractiveElement as _, Styled, Subscription, Task,
|
||||
SharedString, Stateful, StatefulInteractiveElement as _, Styled, Subscription, Task, TaskExt,
|
||||
UniformListScrollHandle, WeakEntity, Window, actions, anchored, deferred, div, point, px, size,
|
||||
uniform_list,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use anyhow::{Context as _, Result, bail};
|
|||
use collections::HashMap;
|
||||
use fs::Fs;
|
||||
use futures::AsyncReadExt;
|
||||
use gpui::{App, AppContext as _, Context, Entity, Global, SharedString, Task};
|
||||
use gpui::{App, AppContext as _, Context, Entity, Global, SharedString, Task, TaskExt};
|
||||
use http_client::{AsyncBody, HttpClient};
|
||||
use serde::Deserialize;
|
||||
use settings::Settings as _;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use std::{
|
|||
use anyhow::{Context as _, Result, bail};
|
||||
use collections::HashMap;
|
||||
use fs::Fs;
|
||||
use gpui::{AsyncApp, Context, Entity, EventEmitter, SharedString, Subscription, Task};
|
||||
use gpui::{AsyncApp, Context, Entity, EventEmitter, SharedString, Subscription, Task, TaskExt};
|
||||
use http_client::{HttpClient, github::AssetKind};
|
||||
use node_runtime::NodeRuntime;
|
||||
use percent_encoding::percent_decode_str;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ use client::Client;
|
|||
use collections::{HashMap, HashSet, hash_map};
|
||||
use futures::{Future, FutureExt as _, channel::oneshot, future::Shared};
|
||||
use gpui::{
|
||||
App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Subscription, Task, WeakEntity,
|
||||
App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Subscription, Task, TaskExt,
|
||||
WeakEntity,
|
||||
};
|
||||
use language::{
|
||||
Buffer, BufferEvent, Capability, DiskState, File as _, Language, LineEnding, Operation,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ use context_server::{ContextServer, ContextServerCommand, ContextServerId};
|
|||
use credentials_provider::CredentialsProvider;
|
||||
use futures::future::Either;
|
||||
use futures::{FutureExt as _, StreamExt as _, future::join_all};
|
||||
use gpui::{App, AsyncApp, Context, Entity, EventEmitter, Subscription, Task, WeakEntity, actions};
|
||||
use gpui::{
|
||||
App, AsyncApp, Context, Entity, EventEmitter, Subscription, Task, TaskExt, WeakEntity, actions,
|
||||
};
|
||||
use http_client::HttpClient;
|
||||
use itertools::Itertools;
|
||||
use rand::Rng as _;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ use futures::{
|
|||
channel::mpsc::{self, UnboundedSender},
|
||||
future::{Shared, join_all},
|
||||
};
|
||||
use gpui::{App, AppContext, AsyncApp, Context, Entity, EventEmitter, SharedString, Task};
|
||||
use gpui::{App, AppContext, AsyncApp, Context, Entity, EventEmitter, SharedString, Task, TaskExt};
|
||||
use http_client::HttpClient;
|
||||
use language::{Buffer, LanguageToolchainStore};
|
||||
use node_runtime::NodeRuntime;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ use futures::{AsyncBufReadExt as _, SinkExt, StreamExt, TryStreamExt};
|
|||
use futures::{FutureExt, future::Shared};
|
||||
use gpui::{
|
||||
App, AppContext, AsyncApp, BackgroundExecutor, Context, Entity, EventEmitter, SharedString,
|
||||
Task, WeakEntity,
|
||||
Task, TaskExt, WeakEntity,
|
||||
};
|
||||
use http_client::HttpClient;
|
||||
use node_runtime::NodeRuntime;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ use git::{
|
|||
};
|
||||
use gpui::{
|
||||
App, AppContext, AsyncApp, BackgroundExecutor, Context, Entity, EventEmitter, SharedString,
|
||||
Subscription, Task, WeakEntity,
|
||||
Subscription, Task, TaskExt, WeakEntity,
|
||||
};
|
||||
use language::{
|
||||
Buffer, BufferEvent, Language, LanguageRegistry,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use client::proto::{self, PeerId};
|
|||
use clock::Global;
|
||||
use collections::HashMap;
|
||||
use futures::future;
|
||||
use gpui::{App, AsyncApp, Entity, SharedString, Task, prelude::FluentBuilder};
|
||||
use gpui::{App, AsyncApp, Entity, SharedString, Task, TaskExt, prelude::FluentBuilder};
|
||||
use language::{
|
||||
Anchor, Bias, Buffer, BufferSnapshot, CachedLspAdapter, CharKind, CharScopeContext,
|
||||
OffsetRangeExt, PointUtf16, ToOffset, ToPointUtf16, Transaction, Unclipped,
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ use futures::{
|
|||
use globset::{Glob, GlobBuilder, GlobMatcher, GlobSet, GlobSetBuilder};
|
||||
use gpui::{
|
||||
App, AppContext, AsyncApp, Context, Entity, EventEmitter, PromptLevel, SharedString,
|
||||
Subscription, Task, WeakEntity,
|
||||
Subscription, Task, TaskExt, WeakEntity,
|
||||
};
|
||||
use http_client::HttpClient;
|
||||
use itertools::Itertools as _;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ use std::{collections::VecDeque, sync::Arc};
|
|||
|
||||
use collections::HashMap;
|
||||
use futures::{StreamExt, channel::mpsc};
|
||||
use gpui::{App, AppContext as _, Context, Entity, EventEmitter, Global, Subscription, WeakEntity};
|
||||
use gpui::{
|
||||
App, AppContext as _, Context, Entity, EventEmitter, Global, Subscription, TaskExt, WeakEntity,
|
||||
};
|
||||
use lsp::{
|
||||
IoKind, LanguageServer, LanguageServerId, LanguageServerName, LanguageServerSelector,
|
||||
MessageType, TraceValue,
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ use image_store::{ImageItemEvent, ImageStoreEvent};
|
|||
use ::git::{blame::Blame, status::FileStatus};
|
||||
use gpui::{
|
||||
App, AppContext, AsyncApp, BorrowAppContext, Context, Entity, EventEmitter, Hsla, SharedString,
|
||||
Task, WeakEntity, Window,
|
||||
Task, TaskExt, WeakEntity, Window,
|
||||
};
|
||||
use language::{
|
||||
Buffer, BufferEvent, Capability, CodeLabel, CursorShape, DiskState, Language, LanguageName,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use collections::HashMap;
|
|||
use fs::{Fs, copy_recursive};
|
||||
use futures::{FutureExt, future::Shared};
|
||||
use gpui::{
|
||||
App, AppContext as _, AsyncApp, Context, Entity, EntityId, EventEmitter, Global, Task,
|
||||
App, AppContext as _, AsyncApp, Context, Entity, EntityId, EventEmitter, Global, Task, TaskExt,
|
||||
WeakEntity,
|
||||
};
|
||||
use itertools::Either;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use clap::Parser;
|
|||
use client::{Client, UserStore};
|
||||
use futures::channel::oneshot;
|
||||
use gpui::AppContext as _;
|
||||
use gpui::TaskExt;
|
||||
use http_client::FakeHttpClient;
|
||||
use language::LanguageRegistry;
|
||||
use node_runtime::NodeRuntime;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use editor::{Bias, Editor, SelectionEffects, scroll::Autoscroll, styled_runs_for_code_label};
|
||||
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||
use gpui::{
|
||||
App, Context, DismissEvent, Entity, HighlightStyle, ParentElement, StyledText, Task, TextStyle,
|
||||
WeakEntity, Window, relative, rems,
|
||||
App, Context, DismissEvent, Entity, HighlightStyle, ParentElement, StyledText, Task, TaskExt,
|
||||
TextStyle, WeakEntity, Window, relative, rems,
|
||||
};
|
||||
use ordered_float::OrderedFloat;
|
||||
use picker::{Picker, PickerDelegate};
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue