chore: Bump Rust edition to 2024 (#27800)

Follow-up to https://github.com/zed-industries/zed/pull/27791

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-03-31 20:55:27 +02:00 committed by GitHub
parent d50905e000
commit dc64ec9cc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
802 changed files with 3775 additions and 3662 deletions

View file

@ -198,7 +198,7 @@ default-members = ["crates/zed"]
[workspace.package] [workspace.package]
publish = false publish = false
edition = "2021" edition = "2024"
[workspace.dependencies] [workspace.dependencies]

View file

@ -3,9 +3,9 @@ use editor::Editor;
use extension_host::ExtensionStore; use extension_host::ExtensionStore;
use futures::StreamExt; use futures::StreamExt;
use gpui::{ use gpui::{
actions, percentage, Animation, AnimationExt as _, App, Context, CursorStyle, Entity, Animation, AnimationExt as _, App, Context, CursorStyle, Entity, EventEmitter,
EventEmitter, InteractiveElement as _, ParentElement as _, Render, SharedString, InteractiveElement as _, ParentElement as _, Render, SharedString, StatefulInteractiveElement,
StatefulInteractiveElement, Styled, Transformation, Window, Styled, Transformation, Window, actions, percentage,
}; };
use language::{BinaryStatus, LanguageRegistry, LanguageServerId}; use language::{BinaryStatus, LanguageRegistry, LanguageServerId};
use project::{ use project::{
@ -14,9 +14,9 @@ use project::{
}; };
use smallvec::SmallVec; use smallvec::SmallVec;
use std::{cmp::Reverse, fmt::Write, sync::Arc, time::Duration}; use std::{cmp::Reverse, fmt::Write, sync::Arc, time::Duration};
use ui::{prelude::*, ButtonLike, ContextMenu, PopoverMenu, PopoverMenuHandle, Tooltip}; use ui::{ButtonLike, ContextMenu, PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*};
use util::truncate_and_trailoff; use util::truncate_and_trailoff;
use workspace::{item::ItemHandle, StatusItemView, Workspace}; use workspace::{StatusItemView, Workspace, item::ItemHandle};
actions!(activity_indicator, [ShowErrorMessage]); actions!(activity_indicator, [ShowErrorMessage]);

View file

@ -2,9 +2,9 @@ mod supported_countries;
use std::{pin::Pin, str::FromStr}; use std::{pin::Pin, str::FromStr};
use anyhow::{anyhow, Context as _, Result}; use anyhow::{Context as _, Result, anyhow};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use futures::{io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, Stream, StreamExt}; use futures::{AsyncBufReadExt, AsyncReadExt, Stream, StreamExt, io::BufReader, stream::BoxStream};
use http_client::http::{HeaderMap, HeaderValue}; use http_client::http::{HeaderMap, HeaderValue};
use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest}; use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View file

@ -5,9 +5,9 @@ use std::time::Duration;
use anyhow::Context as _; use anyhow::Context as _;
use futures::channel::{mpsc, oneshot}; use futures::channel::{mpsc, oneshot};
#[cfg(unix)] #[cfg(unix)]
use futures::{io::BufReader, AsyncBufReadExt as _}; use futures::{AsyncBufReadExt as _, io::BufReader};
#[cfg(unix)] #[cfg(unix)]
use futures::{select_biased, AsyncWriteExt as _, FutureExt as _}; use futures::{AsyncWriteExt as _, FutureExt as _, select_biased};
use futures::{SinkExt, StreamExt}; use futures::{SinkExt, StreamExt};
use gpui::{AsyncApp, BackgroundExecutor, Task}; use gpui::{AsyncApp, BackgroundExecutor, Task};
#[cfg(unix)] #[cfg(unix)]

View file

@ -57,10 +57,11 @@ impl Assets {
pub fn load_test_fonts(&self, cx: &App) { pub fn load_test_fonts(&self, cx: &App) {
cx.text_system() cx.text_system()
.add_fonts(vec![self .add_fonts(vec![
.load("fonts/plex-mono/ZedPlexMono-Regular.ttf") self.load("fonts/plex-mono/ZedPlexMono-Regular.ttf")
.unwrap() .unwrap()
.unwrap()]) .unwrap(),
])
.unwrap() .unwrap()
} }
} }

View file

@ -14,7 +14,7 @@ use client::Client;
use command_palette_hooks::CommandPaletteFilter; use command_palette_hooks::CommandPaletteFilter;
use feature_flags::FeatureFlagAppExt; use feature_flags::FeatureFlagAppExt;
use fs::Fs; use fs::Fs;
use gpui::{actions, App, Global, ReadGlobal, UpdateGlobal}; use gpui::{App, Global, ReadGlobal, UpdateGlobal, actions};
use language_model::{ use language_model::{
LanguageModelId, LanguageModelProviderId, LanguageModelRegistry, LanguageModelResponseMessage, LanguageModelId, LanguageModelProviderId, LanguageModelRegistry, LanguageModelResponseMessage,
}; };

View file

@ -1,9 +1,9 @@
use std::sync::Arc; use std::sync::Arc;
use collections::HashMap; use collections::HashMap;
use gpui::{canvas, AnyView, App, EventEmitter, FocusHandle, Focusable, Subscription}; use gpui::{AnyView, App, EventEmitter, FocusHandle, Focusable, Subscription, canvas};
use language_model::{LanguageModelProvider, LanguageModelProviderId, LanguageModelRegistry}; use language_model::{LanguageModelProvider, LanguageModelProviderId, LanguageModelRegistry};
use ui::{prelude::*, ElevationIndex}; use ui::{ElevationIndex, prelude::*};
use workspace::Item; use workspace::Item;
pub struct ConfigurationView { pub struct ConfigurationView {

View file

@ -1,43 +1,44 @@
use crate::assistant_configuration::{ConfigurationView, ConfigurationViewEvent};
use crate::Assistant; use crate::Assistant;
use crate::assistant_configuration::{ConfigurationView, ConfigurationViewEvent};
use crate::{ use crate::{
terminal_inline_assistant::TerminalInlineAssistant, DeployHistory, InlineAssistant, NewChat, DeployHistory, InlineAssistant, NewChat, terminal_inline_assistant::TerminalInlineAssistant,
}; };
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_context_editor::{ use assistant_context_editor::{
make_lsp_adapter_delegate, AssistantContext, AssistantPanelDelegate, ContextEditor, AssistantContext, AssistantPanelDelegate, ContextEditor, ContextEditorToolbarItem,
ContextEditorToolbarItem, ContextEditorToolbarItemEvent, ContextHistory, ContextId, ContextEditorToolbarItemEvent, ContextHistory, ContextId, ContextStore, ContextStoreEvent,
ContextStore, ContextStoreEvent, InsertDraggedFiles, SlashCommandCompletionProvider, DEFAULT_TAB_TITLE, InsertDraggedFiles, SlashCommandCompletionProvider,
DEFAULT_TAB_TITLE, make_lsp_adapter_delegate,
}; };
use assistant_settings::{AssistantDockPosition, AssistantSettings}; use assistant_settings::{AssistantDockPosition, AssistantSettings};
use assistant_slash_command::SlashCommandWorkingSet; use assistant_slash_command::SlashCommandWorkingSet;
use client::{proto, Client, Status}; use client::{Client, Status, proto};
use editor::{Editor, EditorEvent}; use editor::{Editor, EditorEvent};
use fs::Fs; use fs::Fs;
use gpui::{ use gpui::{
prelude::*, Action, App, AsyncWindowContext, Entity, EventEmitter, ExternalPaths, FocusHandle, Action, App, AsyncWindowContext, Entity, EventEmitter, ExternalPaths, FocusHandle, Focusable,
Focusable, InteractiveElement, IntoElement, ParentElement, Pixels, Render, Styled, InteractiveElement, IntoElement, ParentElement, Pixels, Render, Styled, Subscription, Task,
Subscription, Task, UpdateGlobal, WeakEntity, UpdateGlobal, WeakEntity, prelude::*,
}; };
use language::LanguageRegistry; use language::LanguageRegistry;
use language_model::{ use language_model::{
AuthenticateError, LanguageModelProviderId, LanguageModelRegistry, ZED_CLOUD_PROVIDER_ID, AuthenticateError, LanguageModelProviderId, LanguageModelRegistry, ZED_CLOUD_PROVIDER_ID,
}; };
use project::Project; use project::Project;
use prompt_library::{open_prompt_library, PromptLibrary}; use prompt_library::{PromptLibrary, open_prompt_library};
use prompt_store::PromptBuilder; use prompt_store::PromptBuilder;
use search::{buffer_search::DivRegistrar, BufferSearchBar}; use search::{BufferSearchBar, buffer_search::DivRegistrar};
use settings::{update_settings_file, Settings}; use settings::{Settings, update_settings_file};
use smol::stream::StreamExt; use smol::stream::StreamExt;
use std::{ops::ControlFlow, path::PathBuf, sync::Arc}; use std::{ops::ControlFlow, path::PathBuf, sync::Arc};
use terminal_view::{terminal_panel::TerminalPanel, TerminalView}; use terminal_view::{TerminalView, terminal_panel::TerminalPanel};
use ui::{prelude::*, ContextMenu, PopoverMenu, Tooltip}; use ui::{ContextMenu, PopoverMenu, Tooltip, prelude::*};
use util::{maybe, ResultExt}; use util::{ResultExt, maybe};
use workspace::DraggedTab; use workspace::DraggedTab;
use workspace::{ use workspace::{
DraggedSelection, Pane, ShowConfiguration, ToggleZoom, Workspace,
dock::{DockPosition, Panel, PanelEvent}, dock::{DockPosition, Panel, PanelEvent},
pane, DraggedSelection, Pane, ShowConfiguration, ToggleZoom, Workspace, pane,
}; };
use zed_actions::assistant::{InlineAssist, OpenPromptLibrary, ToggleFocus}; use zed_actions::assistant::{InlineAssist, OpenPromptLibrary, ToggleFocus};

View file

@ -2,39 +2,40 @@ use crate::{
Assistant, AssistantPanel, AssistantPanelEvent, CycleNextInlineAssist, Assistant, AssistantPanel, AssistantPanelEvent, CycleNextInlineAssist,
CyclePreviousInlineAssist, CyclePreviousInlineAssist,
}; };
use anyhow::{anyhow, Context as _, Result}; use anyhow::{Context as _, Result, anyhow};
use assistant_context_editor::{humanize_token_count, RequestType}; use assistant_context_editor::{RequestType, humanize_token_count};
use assistant_settings::AssistantSettings; use assistant_settings::AssistantSettings;
use client::{telemetry::Telemetry, ErrorExt}; use client::{ErrorExt, telemetry::Telemetry};
use collections::{hash_map, HashMap, HashSet, VecDeque}; use collections::{HashMap, HashSet, VecDeque, hash_map};
use editor::{ use editor::{
Anchor, AnchorRangeExt, CodeActionProvider, Editor, EditorElement, EditorEvent, EditorMode,
EditorStyle, ExcerptId, ExcerptRange, GutterDimensions, MultiBuffer, MultiBufferSnapshot,
ToOffset as _, ToPoint,
actions::{MoveDown, MoveUp, SelectAll}, actions::{MoveDown, MoveUp, SelectAll},
display_map::{ display_map::{
BlockContext, BlockPlacement, BlockProperties, BlockStyle, CustomBlockId, RenderBlock, BlockContext, BlockPlacement, BlockProperties, BlockStyle, CustomBlockId, RenderBlock,
ToDisplayPoint, ToDisplayPoint,
}, },
Anchor, AnchorRangeExt, CodeActionProvider, Editor, EditorElement, EditorEvent, EditorMode,
EditorStyle, ExcerptId, ExcerptRange, GutterDimensions, MultiBuffer, MultiBufferSnapshot,
ToOffset as _, ToPoint,
}; };
use feature_flags::{ use feature_flags::{
Assistant2FeatureFlag, FeatureFlagAppExt as _, FeatureFlagViewExt as _, ZedPro, Assistant2FeatureFlag, FeatureFlagAppExt as _, FeatureFlagViewExt as _, ZedPro,
}; };
use fs::Fs; use fs::Fs;
use futures::{ use futures::{
SinkExt, Stream, StreamExt,
channel::mpsc, channel::mpsc,
future::{BoxFuture, LocalBoxFuture}, future::{BoxFuture, LocalBoxFuture},
join, SinkExt, Stream, StreamExt, join,
}; };
use gpui::{ use gpui::{
anchored, deferred, point, AnyElement, App, ClickEvent, Context, CursorStyle, Entity, AnyElement, App, ClickEvent, Context, CursorStyle, Entity, EventEmitter, FocusHandle,
EventEmitter, FocusHandle, Focusable, FontWeight, Global, HighlightStyle, Subscription, Task, Focusable, FontWeight, Global, HighlightStyle, Subscription, Task, TextStyle, UpdateGlobal,
TextStyle, UpdateGlobal, WeakEntity, Window, WeakEntity, Window, anchored, deferred, point,
}; };
use language::{line_diff, Buffer, IndentKind, Point, Selection, TransactionId}; use language::{Buffer, IndentKind, Point, Selection, TransactionId, line_diff};
use language_model::{ use language_model::{
report_assistant_event, LanguageModel, LanguageModelRegistry, LanguageModelRequest, LanguageModel, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage,
LanguageModelRequestMessage, LanguageModelTextStream, Role, LanguageModelTextStream, Role, report_assistant_event,
}; };
use language_model_selector::{LanguageModelSelector, LanguageModelSelectorPopoverMenu}; use language_model_selector::{LanguageModelSelector, LanguageModelSelectorPopoverMenu};
use multi_buffer::MultiBufferRow; use multi_buffer::MultiBufferRow;
@ -42,7 +43,7 @@ use parking_lot::Mutex;
use project::{CodeAction, LspAction, ProjectTransaction}; use project::{CodeAction, LspAction, ProjectTransaction};
use prompt_store::PromptBuilder; use prompt_store::PromptBuilder;
use rope::Rope; use rope::Rope;
use settings::{update_settings_file, Settings, SettingsStore}; use settings::{Settings, SettingsStore, update_settings_file};
use smol::future::FutureExt; use smol::future::FutureExt;
use std::{ use std::{
cmp, cmp,
@ -61,10 +62,10 @@ use terminal_view::terminal_panel::TerminalPanel;
use text::{OffsetRangeExt, ToPoint as _}; use text::{OffsetRangeExt, ToPoint as _};
use theme::ThemeSettings; use theme::ThemeSettings;
use ui::{ use ui::{
prelude::*, text_for_action, CheckboxWithLabel, IconButtonShape, KeyBinding, Popover, Tooltip, CheckboxWithLabel, IconButtonShape, KeyBinding, Popover, Tooltip, prelude::*, text_for_action,
}; };
use util::{RangeExt, ResultExt}; use util::{RangeExt, ResultExt};
use workspace::{notifications::NotificationId, ItemHandle, Toast, Workspace}; use workspace::{ItemHandle, Toast, Workspace, notifications::NotificationId};
pub fn init( pub fn init(
fs: Arc<dyn Fs>, fs: Arc<dyn Fs>,
@ -3710,8 +3711,8 @@ mod tests {
use gpui::TestAppContext; use gpui::TestAppContext;
use indoc::indoc; use indoc::indoc;
use language::{ use language::{
language_settings, tree_sitter_rust, Buffer, Language, LanguageConfig, LanguageMatcher, Buffer, Language, LanguageConfig, LanguageMatcher, Point, language_settings,
Point, tree_sitter_rust,
}; };
use language_model::{LanguageModelRegistry, TokenUsage}; use language_model::{LanguageModelRegistry, TokenUsage};
use rand::prelude::*; use rand::prelude::*;

View file

@ -1,27 +1,27 @@
use crate::{AssistantPanel, AssistantPanelEvent, DEFAULT_CONTEXT_LINES}; use crate::{AssistantPanel, AssistantPanelEvent, DEFAULT_CONTEXT_LINES};
use anyhow::{Context as _, Result}; use anyhow::{Context as _, Result};
use assistant_context_editor::{humanize_token_count, RequestType}; use assistant_context_editor::{RequestType, humanize_token_count};
use assistant_settings::AssistantSettings; use assistant_settings::AssistantSettings;
use client::telemetry::Telemetry; use client::telemetry::Telemetry;
use collections::{HashMap, VecDeque}; use collections::{HashMap, VecDeque};
use editor::{ use editor::{
actions::{MoveDown, MoveUp, SelectAll},
Editor, EditorElement, EditorEvent, EditorMode, EditorStyle, MultiBuffer, Editor, EditorElement, EditorEvent, EditorMode, EditorStyle, MultiBuffer,
actions::{MoveDown, MoveUp, SelectAll},
}; };
use fs::Fs; use fs::Fs;
use futures::{channel::mpsc, SinkExt, StreamExt}; use futures::{SinkExt, StreamExt, channel::mpsc};
use gpui::{ use gpui::{
App, Context, Entity, EventEmitter, FocusHandle, Focusable, Global, Subscription, Task, App, Context, Entity, EventEmitter, FocusHandle, Focusable, Global, Subscription, Task,
TextStyle, UpdateGlobal, WeakEntity, TextStyle, UpdateGlobal, WeakEntity,
}; };
use language::Buffer; use language::Buffer;
use language_model::{ use language_model::{
report_assistant_event, LanguageModelRegistry, LanguageModelRequest, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, Role,
LanguageModelRequestMessage, Role, report_assistant_event,
}; };
use language_model_selector::{LanguageModelSelector, LanguageModelSelectorPopoverMenu}; use language_model_selector::{LanguageModelSelector, LanguageModelSelectorPopoverMenu};
use prompt_store::PromptBuilder; use prompt_store::PromptBuilder;
use settings::{update_settings_file, Settings}; use settings::{Settings, update_settings_file};
use std::{ use std::{
cmp, cmp,
sync::Arc, sync::Arc,
@ -31,9 +31,9 @@ use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase};
use terminal::Terminal; use terminal::Terminal;
use terminal_view::TerminalView; use terminal_view::TerminalView;
use theme::ThemeSettings; use theme::ThemeSettings;
use ui::{prelude::*, text_for_action, IconButtonShape, Tooltip}; use ui::{IconButtonShape, Tooltip, prelude::*, text_for_action};
use util::ResultExt; use util::ResultExt;
use workspace::{notifications::NotificationId, Toast, Workspace}; use workspace::{Toast, Workspace, notifications::NotificationId};
pub fn init( pub fn init(
fs: Arc<dyn Fs>, fs: Arc<dyn Fs>,

View file

@ -1,3 +1,4 @@
use crate::AssistantPanel;
use crate::context::{AssistantContext, ContextId}; use crate::context::{AssistantContext, ContextId};
use crate::thread::{ use crate::thread::{
LastRestoreCheckpoint, MessageId, MessageSegment, RequestKind, Thread, ThreadError, LastRestoreCheckpoint, MessageId, MessageSegment, RequestKind, Thread, ThreadError,
@ -6,16 +7,15 @@ use crate::thread::{
use crate::thread_store::ThreadStore; use crate::thread_store::ThreadStore;
use crate::tool_use::{PendingToolUseStatus, ToolUse, ToolUseStatus}; use crate::tool_use::{PendingToolUseStatus, ToolUse, ToolUseStatus};
use crate::ui::{AgentNotification, AgentNotificationEvent, ContextPill}; use crate::ui::{AgentNotification, AgentNotificationEvent, ContextPill};
use crate::AssistantPanel;
use assistant_settings::{AssistantSettings, NotifyWhenAgentWaiting}; use assistant_settings::{AssistantSettings, NotifyWhenAgentWaiting};
use collections::HashMap; use collections::HashMap;
use editor::{Editor, MultiBuffer}; use editor::{Editor, MultiBuffer};
use gpui::{ use gpui::{
linear_color_stop, linear_gradient, list, percentage, pulsating_between, AbsoluteLength, AbsoluteLength, Animation, AnimationExt, AnyElement, App, ClickEvent, DefiniteLength,
Animation, AnimationExt, AnyElement, App, ClickEvent, DefiniteLength, EdgesRefinement, Empty, EdgesRefinement, Empty, Entity, Focusable, Hsla, Length, ListAlignment, ListState, MouseButton,
Entity, Focusable, Hsla, Length, ListAlignment, ListState, MouseButton, PlatformDisplay, PlatformDisplay, ScrollHandle, Stateful, StyleRefinement, Subscription, Task,
ScrollHandle, Stateful, StyleRefinement, Subscription, Task, TextStyleRefinement, TextStyleRefinement, Transformation, UnderlineStyle, WeakEntity, WindowHandle,
Transformation, UnderlineStyle, WeakEntity, WindowHandle, linear_color_stop, linear_gradient, list, percentage, pulsating_between,
}; };
use language::{Buffer, LanguageRegistry}; use language::{Buffer, LanguageRegistry};
use language_model::{LanguageModelRegistry, LanguageModelToolUseId, Role}; use language_model::{LanguageModelRegistry, LanguageModelToolUseId, Role};
@ -27,11 +27,11 @@ use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
use text::ToPoint; use text::ToPoint;
use theme::ThemeSettings; use theme::ThemeSettings;
use ui::{prelude::*, Disclosure, IconButton, KeyBinding, Scrollbar, ScrollbarState, Tooltip}; use ui::{Disclosure, IconButton, KeyBinding, Scrollbar, ScrollbarState, Tooltip, prelude::*};
use util::ResultExt as _; use util::ResultExt as _;
use workspace::{OpenOptions, Workspace}; use workspace::{OpenOptions, Workspace};
use crate::context_store::{refresh_context_store_text, ContextStore}; use crate::context_store::{ContextStore, refresh_context_store_text};
pub struct ActiveThread { pub struct ActiveThread {
language_registry: Arc<LanguageRegistry>, language_registry: Arc<LanguageRegistry>,

View file

@ -28,7 +28,7 @@ use client::Client;
use command_palette_hooks::CommandPaletteFilter; use command_palette_hooks::CommandPaletteFilter;
use feature_flags::{Assistant2FeatureFlag, FeatureFlagAppExt}; use feature_flags::{Assistant2FeatureFlag, FeatureFlagAppExt};
use fs::Fs; use fs::Fs;
use gpui::{actions, impl_actions, App}; use gpui::{App, actions, impl_actions};
use prompt_store::PromptBuilder; use prompt_store::PromptBuilder;
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::Deserialize; use serde::Deserialize;

View file

@ -9,7 +9,7 @@ use collections::HashMap;
use context_server::manager::ContextServerManager; use context_server::manager::ContextServerManager;
use gpui::{Action, AnyView, App, Entity, EventEmitter, FocusHandle, Focusable, Subscription}; use gpui::{Action, AnyView, App, Entity, EventEmitter, FocusHandle, Focusable, Subscription};
use language_model::{LanguageModelProvider, LanguageModelProviderId, LanguageModelRegistry}; use language_model::{LanguageModelProvider, LanguageModelProviderId, LanguageModelRegistry};
use ui::{prelude::*, Disclosure, Divider, DividerColor, ElevationIndex, Indicator, Switch}; use ui::{Disclosure, Divider, DividerColor, ElevationIndex, Indicator, Switch, prelude::*};
use util::ResultExt as _; use util::ResultExt as _;
use zed_actions::ExtensionCategoryFilter; use zed_actions::ExtensionCategoryFilter;

View file

@ -1,9 +1,9 @@
use context_server::{ContextServerSettings, ServerCommand, ServerConfig}; use context_server::{ContextServerSettings, ServerCommand, ServerConfig};
use editor::Editor; use editor::Editor;
use gpui::{prelude::*, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, WeakEntity}; use gpui::{DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, WeakEntity, prelude::*};
use serde_json::json; use serde_json::json;
use settings::update_settings_file; use settings::update_settings_file;
use ui::{prelude::*, Modal, ModalFooter, ModalHeader, Section, Tooltip}; use ui::{Modal, ModalFooter, ModalHeader, Section, Tooltip, prelude::*};
use workspace::{ModalView, Workspace}; use workspace::{ModalView, Workspace};
use crate::AddContextServer; use crate::AddContextServer;

View file

@ -11,12 +11,12 @@ use convert_case::{Case, Casing as _};
use editor::Editor; use editor::Editor;
use fs::Fs; use fs::Fs;
use gpui::{ use gpui::{
prelude::*, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Subscription, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Subscription, WeakEntity,
WeakEntity, prelude::*,
}; };
use settings::{update_settings_file, Settings as _}; use settings::{Settings as _, update_settings_file};
use ui::{ use ui::{
prelude::*, KeyBinding, ListItem, ListItemSpacing, ListSeparator, Navigable, NavigableEntry, KeyBinding, ListItem, ListItemSpacing, ListSeparator, Navigable, NavigableEntry, prelude::*,
}; };
use workspace::{ModalView, Workspace}; use workspace::{ModalView, Workspace};

View file

@ -6,11 +6,11 @@ use assistant_settings::{
}; };
use assistant_tool::{ToolSource, ToolWorkingSet}; use assistant_tool::{ToolSource, ToolWorkingSet};
use fs::Fs; use fs::Fs;
use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; use fuzzy::{StringMatch, StringMatchCandidate, match_strings};
use gpui::{App, Context, DismissEvent, Entity, EventEmitter, Focusable, Task, WeakEntity, Window}; use gpui::{App, Context, DismissEvent, Entity, EventEmitter, Focusable, Task, WeakEntity, Window};
use picker::{Picker, PickerDelegate}; use picker::{Picker, PickerDelegate};
use settings::{update_settings_file, Settings as _}; use settings::{Settings as _, update_settings_file};
use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*};
use util::ResultExt as _; use util::ResultExt as _;
use crate::ThreadStore; use crate::ThreadStore;

View file

@ -3,12 +3,12 @@ use anyhow::Result;
use buffer_diff::DiffHunkStatus; use buffer_diff::DiffHunkStatus;
use collections::HashSet; use collections::HashSet;
use editor::{ use editor::{
actions::{GoToHunk, GoToPreviousHunk},
Direction, Editor, EditorEvent, MultiBuffer, ToPoint, Direction, Editor, EditorEvent, MultiBuffer, ToPoint,
actions::{GoToHunk, GoToPreviousHunk},
}; };
use gpui::{ use gpui::{
prelude::*, Action, AnyElement, AnyView, App, Entity, EventEmitter, FocusHandle, Focusable, Action, AnyElement, AnyView, App, Entity, EventEmitter, FocusHandle, Focusable, SharedString,
SharedString, Subscription, Task, WeakEntity, Window, Subscription, Task, WeakEntity, Window, prelude::*,
}; };
use language::{Capability, DiskState, OffsetRangeExt, Point}; use language::{Capability, DiskState, OffsetRangeExt, Point};
use multi_buffer::PathKey; use multi_buffer::PathKey;
@ -18,12 +18,12 @@ use std::{
ops::Range, ops::Range,
sync::Arc, sync::Arc,
}; };
use ui::{prelude::*, IconButtonShape, KeyBinding, Tooltip}; use ui::{IconButtonShape, KeyBinding, Tooltip, prelude::*};
use workspace::{ use workspace::{
item::{BreadcrumbText, ItemEvent, TabContentParams},
searchable::SearchableItemHandle,
Item, ItemHandle, ItemNavHistory, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Item, ItemHandle, ItemNavHistory, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView,
Workspace, Workspace,
item::{BreadcrumbText, ItemEvent, TabContentParams},
searchable::SearchableItemHandle,
}; };
pub struct AssistantDiff { pub struct AssistantDiff {
@ -566,25 +566,27 @@ fn render_diff_hunk_controls(
}), }),
] ]
} else { } else {
vec![Button::new(("review", row as u64), "Review") vec![
.key_binding(KeyBinding::for_action_in( Button::new(("review", row as u64), "Review")
&ToggleKeep, .key_binding(KeyBinding::for_action_in(
&editor.read(cx).focus_handle(cx), &ToggleKeep,
window, &editor.read(cx).focus_handle(cx),
cx, window,
)) cx,
.on_click({ ))
let assistant_diff = assistant_diff.clone(); .on_click({
move |_event, _window, cx| { let assistant_diff = assistant_diff.clone();
assistant_diff.update(cx, |diff, cx| { move |_event, _window, cx| {
diff.review_diff_hunks( assistant_diff.update(cx, |diff, cx| {
vec![hunk_range.start..hunk_range.start], diff.review_diff_hunks(
false, vec![hunk_range.start..hunk_range.start],
cx, false,
); cx,
}); );
} });
})] }
}),
]
}) })
.when( .when(
!editor.read(cx).buffer().read(cx).all_diff_hunks_expanded(), !editor.read(cx).buffer().read(cx).all_diff_hunks_expanded(),

View file

@ -7,7 +7,7 @@ use language_model_selector::{
}; };
use settings::update_settings_file; use settings::update_settings_file;
use std::sync::Arc; use std::sync::Arc;
use ui::{prelude::*, ButtonLike, PopoverMenuHandle, Tooltip}; use ui::{ButtonLike, PopoverMenuHandle, Tooltip, prelude::*};
pub struct AssistantModelSelector { pub struct AssistantModelSelector {
selector: Entity<LanguageModelSelector>, selector: Entity<LanguageModelSelector>,

View file

@ -1,10 +1,10 @@
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_context_editor::{ use assistant_context_editor::{
make_lsp_adapter_delegate, render_remaining_tokens, AssistantPanelDelegate, ConfigurationError, AssistantPanelDelegate, ConfigurationError, ContextEditor, SlashCommandCompletionProvider,
ContextEditor, SlashCommandCompletionProvider, make_lsp_adapter_delegate, render_remaining_tokens,
}; };
use assistant_settings::{AssistantDockPosition, AssistantSettings}; use assistant_settings::{AssistantDockPosition, AssistantSettings};
use assistant_slash_command::SlashCommandWorkingSet; use assistant_slash_command::SlashCommandWorkingSet;
@ -14,21 +14,21 @@ use client::zed_urls;
use editor::{Editor, MultiBuffer}; use editor::{Editor, MultiBuffer};
use fs::Fs; use fs::Fs;
use gpui::{ use gpui::{
action_with_deprecated_aliases, prelude::*, Action, AnyElement, App, AsyncWindowContext, Action, AnyElement, App, AsyncWindowContext, Corner, Entity, EventEmitter, FocusHandle,
Corner, Entity, EventEmitter, FocusHandle, Focusable, FontWeight, KeyContext, Pixels, Focusable, FontWeight, KeyContext, Pixels, Subscription, Task, UpdateGlobal, WeakEntity,
Subscription, Task, UpdateGlobal, WeakEntity, action_with_deprecated_aliases, prelude::*,
}; };
use language::LanguageRegistry; use language::LanguageRegistry;
use language_model::{LanguageModelProviderTosView, LanguageModelRegistry}; use language_model::{LanguageModelProviderTosView, LanguageModelRegistry};
use project::Project; use project::Project;
use prompt_library::{open_prompt_library, PromptLibrary}; use prompt_library::{PromptLibrary, open_prompt_library};
use prompt_store::PromptBuilder; use prompt_store::PromptBuilder;
use settings::{update_settings_file, Settings}; use settings::{Settings, update_settings_file};
use time::UtcOffset; use time::UtcOffset;
use ui::{prelude::*, ContextMenu, KeyBinding, PopoverMenu, PopoverMenuHandle, Tab, Tooltip}; use ui::{ContextMenu, KeyBinding, PopoverMenu, PopoverMenuHandle, Tab, Tooltip, prelude::*};
use util::ResultExt as _; use util::ResultExt as _;
use workspace::dock::{DockPosition, Panel, PanelEvent};
use workspace::Workspace; use workspace::Workspace;
use workspace::dock::{DockPosition, Panel, PanelEvent};
use zed_actions::assistant::ToggleFocus; use zed_actions::assistant::ToggleFocus;
use crate::active_thread::ActiveThread; use crate::active_thread::ActiveThread;

View file

@ -5,12 +5,12 @@ use anyhow::{Context as _, Result};
use client::telemetry::Telemetry; use client::telemetry::Telemetry;
use collections::HashSet; use collections::HashSet;
use editor::{Anchor, AnchorRangeExt, MultiBuffer, MultiBufferSnapshot, ToOffset as _, ToPoint}; use editor::{Anchor, AnchorRangeExt, MultiBuffer, MultiBufferSnapshot, ToOffset as _, ToPoint};
use futures::{channel::mpsc, future::LocalBoxFuture, join, SinkExt, Stream, StreamExt}; use futures::{SinkExt, Stream, StreamExt, channel::mpsc, future::LocalBoxFuture, join};
use gpui::{App, AppContext as _, Context, Entity, EventEmitter, Subscription, Task}; use gpui::{App, AppContext as _, Context, Entity, EventEmitter, Subscription, Task};
use language::{line_diff, Buffer, IndentKind, Point, TransactionId}; use language::{Buffer, IndentKind, Point, TransactionId, line_diff};
use language_model::{ use language_model::{
report_assistant_event, LanguageModel, LanguageModelRegistry, LanguageModelRequest, LanguageModel, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage,
LanguageModelRequestMessage, LanguageModelTextStream, Role, LanguageModelTextStream, Role, report_assistant_event,
}; };
use multi_buffer::MultiBufferRow; use multi_buffer::MultiBufferRow;
use parking_lot::Mutex; use parking_lot::Mutex;
@ -1028,14 +1028,14 @@ impl Diff {
mod tests { mod tests {
use super::*; use super::*;
use futures::{ use futures::{
stream::{self},
Stream, Stream,
stream::{self},
}; };
use gpui::TestAppContext; use gpui::TestAppContext;
use indoc::indoc; use indoc::indoc;
use language::{ use language::{
language_settings, tree_sitter_rust, Buffer, Language, LanguageConfig, LanguageMatcher, Buffer, Language, LanguageConfig, LanguageMatcher, Point, language_settings,
Point, tree_sitter_rust,
}; };
use language_model::{LanguageModelRegistry, TokenUsage}; use language_model::{LanguageModelRegistry, TokenUsage};
use rand::prelude::*; use rand::prelude::*;

View file

@ -8,7 +8,7 @@ use std::ops::Range;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use editor::display_map::{Crease, FoldId}; use editor::display_map::{Crease, FoldId};
use editor::{Anchor, AnchorRangeExt as _, Editor, ExcerptId, FoldPlaceholder, ToOffset}; use editor::{Anchor, AnchorRangeExt as _, Editor, ExcerptId, FoldPlaceholder, ToOffset};
use file_context_picker::render_file_context_entry; use file_context_picker::render_file_context_entry;
@ -18,19 +18,19 @@ use gpui::{
use multi_buffer::MultiBufferRow; use multi_buffer::MultiBufferRow;
use project::ProjectPath; use project::ProjectPath;
use symbol_context_picker::SymbolContextPicker; use symbol_context_picker::SymbolContextPicker;
use thread_context_picker::{render_thread_context_entry, ThreadContextEntry}; use thread_context_picker::{ThreadContextEntry, render_thread_context_entry};
use ui::{ use ui::{
prelude::*, ButtonLike, ContextMenu, ContextMenuEntry, ContextMenuItem, Disclosure, TintColor, ButtonLike, ContextMenu, ContextMenuEntry, ContextMenuItem, Disclosure, TintColor, prelude::*,
}; };
use workspace::{notifications::NotifyResultExt, Workspace}; use workspace::{Workspace, notifications::NotifyResultExt};
use crate::AssistantPanel;
pub use crate::context_picker::completion_provider::ContextPickerCompletionProvider; pub use crate::context_picker::completion_provider::ContextPickerCompletionProvider;
use crate::context_picker::fetch_context_picker::FetchContextPicker; use crate::context_picker::fetch_context_picker::FetchContextPicker;
use crate::context_picker::file_context_picker::FileContextPicker; use crate::context_picker::file_context_picker::FileContextPicker;
use crate::context_picker::thread_context_picker::ThreadContextPicker; use crate::context_picker::thread_context_picker::ThreadContextPicker;
use crate::context_store::ContextStore; use crate::context_store::ContextStore;
use crate::thread_store::ThreadStore; use crate::thread_store::ThreadStore;
use crate::AssistantPanel;
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub enum ConfirmBehavior { pub enum ConfirmBehavior {

View file

@ -2,8 +2,8 @@ use std::cell::RefCell;
use std::ops::Range; use std::ops::Range;
use std::path::Path; use std::path::Path;
use std::rc::Rc; use std::rc::Rc;
use std::sync::atomic::AtomicBool;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use anyhow::Result; use anyhow::Result;
use editor::{CompletionProvider, Editor, ExcerptId}; use editor::{CompletionProvider, Editor, ExcerptId};
@ -24,7 +24,7 @@ use crate::thread_store::ThreadStore;
use super::fetch_context_picker::fetch_url_content; use super::fetch_context_picker::fetch_url_content;
use super::thread_context_picker::ThreadContextEntry; use super::thread_context_picker::ThreadContextEntry;
use super::{recent_context_picker_entries, supported_context_picker_modes, ContextPickerMode}; use super::{ContextPickerMode, recent_context_picker_entries, supported_context_picker_modes};
pub struct ContextPickerCompletionProvider { pub struct ContextPickerCompletionProvider {
workspace: WeakEntity<Workspace>, workspace: WeakEntity<Workspace>,

View file

@ -2,13 +2,13 @@ use std::cell::RefCell;
use std::rc::Rc; use std::rc::Rc;
use std::sync::Arc; use std::sync::Arc;
use anyhow::{bail, Context as _, Result}; use anyhow::{Context as _, Result, bail};
use futures::AsyncReadExt as _; use futures::AsyncReadExt as _;
use gpui::{App, DismissEvent, Entity, FocusHandle, Focusable, Task, WeakEntity}; use gpui::{App, DismissEvent, Entity, FocusHandle, Focusable, Task, WeakEntity};
use html_to_markdown::{convert_html_to_markdown, markdown, TagHandler}; use html_to_markdown::{TagHandler, convert_html_to_markdown, markdown};
use http_client::{AsyncBody, HttpClientWithUrl}; use http_client::{AsyncBody, HttpClientWithUrl};
use picker::{Picker, PickerDelegate}; use picker::{Picker, PickerDelegate};
use ui::{prelude::*, Context, ListItem, Window}; use ui::{Context, ListItem, Window, prelude::*};
use workspace::Workspace; use workspace::Workspace;
use crate::context_picker::{ConfirmBehavior, ContextPicker}; use crate::context_picker::{ConfirmBehavior, ContextPicker};
@ -163,11 +163,7 @@ impl PickerDelegate for FetchContextPickerDelegate {
type ListItem = ListItem; type ListItem = ListItem;
fn match_count(&self) -> usize { fn match_count(&self) -> usize {
if self.url.is_empty() { if self.url.is_empty() { 0 } else { 1 }
0
} else {
1
}
} }
fn no_matches_text(&self, _window: &mut Window, _cx: &mut App) -> Option<SharedString> { fn no_matches_text(&self, _window: &mut Window, _cx: &mut App) -> Option<SharedString> {

View file

@ -1,6 +1,6 @@
use std::path::Path; use std::path::Path;
use std::sync::atomic::AtomicBool;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use file_icons::FileIcons; use file_icons::FileIcons;
use fuzzy::PathMatch; use fuzzy::PathMatch;
@ -9,9 +9,9 @@ use gpui::{
}; };
use picker::{Picker, PickerDelegate}; use picker::{Picker, PickerDelegate};
use project::{PathMatchCandidateSet, ProjectPath, WorktreeId}; use project::{PathMatchCandidateSet, ProjectPath, WorktreeId};
use ui::{prelude::*, ListItem, Tooltip}; use ui::{ListItem, Tooltip, prelude::*};
use util::ResultExt as _; use util::ResultExt as _;
use workspace::{notifications::NotifyResultExt, Workspace}; use workspace::{Workspace, notifications::NotifyResultExt};
use crate::context_picker::{ConfirmBehavior, ContextPicker}; use crate::context_picker::{ConfirmBehavior, ContextPicker};
use crate::context_store::{ContextStore, FileInclusion}; use crate::context_store::{ContextStore, FileInclusion};

View file

@ -1,6 +1,6 @@
use std::cmp::Reverse; use std::cmp::Reverse;
use std::sync::atomic::AtomicBool;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use anyhow::{Context as _, Result}; use anyhow::{Context as _, Result};
use fuzzy::{StringMatch, StringMatchCandidate}; use fuzzy::{StringMatch, StringMatchCandidate};
@ -11,7 +11,7 @@ use ordered_float::OrderedFloat;
use picker::{Picker, PickerDelegate}; use picker::{Picker, PickerDelegate};
use project::{DocumentSymbol, Symbol}; use project::{DocumentSymbol, Symbol};
use text::OffsetRangeExt; use text::OffsetRangeExt;
use ui::{prelude::*, ListItem}; use ui::{ListItem, prelude::*};
use util::ResultExt as _; use util::ResultExt as _;
use workspace::Workspace; use workspace::Workspace;

View file

@ -3,7 +3,7 @@ use std::sync::Arc;
use fuzzy::StringMatchCandidate; use fuzzy::StringMatchCandidate;
use gpui::{App, DismissEvent, Entity, FocusHandle, Focusable, Task, WeakEntity}; use gpui::{App, DismissEvent, Entity, FocusHandle, Focusable, Task, WeakEntity};
use picker::{Picker, PickerDelegate}; use picker::{Picker, PickerDelegate};
use ui::{prelude::*, ListItem}; use ui::{ListItem, prelude::*};
use crate::context_picker::{ConfirmBehavior, ContextPicker}; use crate::context_picker::{ConfirmBehavior, ContextPicker};
use crate::context_store::{self, ContextStore}; use crate::context_store::{self, ContextStore};

View file

@ -2,9 +2,9 @@ use std::ops::Range;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::sync::Arc; use std::sync::Arc;
use anyhow::{anyhow, bail, Result}; use anyhow::{Result, anyhow, bail};
use collections::{BTreeMap, HashMap, HashSet}; use collections::{BTreeMap, HashMap, HashSet};
use futures::{self, future, Future, FutureExt}; use futures::{self, Future, FutureExt, future};
use gpui::{App, AppContext as _, AsyncApp, Context, Entity, SharedString, Task, WeakEntity}; use gpui::{App, AppContext as _, AsyncApp, Context, Entity, SharedString, Task, WeakEntity};
use language::Buffer; use language::Buffer;
use project::{ProjectItem, ProjectPath, Worktree}; use project::{ProjectItem, ProjectPath, Worktree};

View file

@ -9,8 +9,8 @@ use gpui::{
}; };
use itertools::Itertools; use itertools::Itertools;
use language::Buffer; use language::Buffer;
use ui::{prelude::*, KeyBinding, PopoverMenu, PopoverMenuHandle, Tooltip}; use ui::{KeyBinding, PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*};
use workspace::{notifications::NotifyResultExt, Workspace}; use workspace::{Workspace, notifications::NotifyResultExt};
use crate::context::{ContextId, ContextKind}; use crate::context::{ContextId, ContextKind};
use crate::context_picker::{ConfirmBehavior, ContextPicker}; use crate::context_picker::{ConfirmBehavior, ContextPicker};
@ -239,11 +239,7 @@ impl ContextStrip {
let eraser = if bounds.len() < 3 { 0 } else { 1 }; let eraser = if bounds.len() < 3 { 0 } else { 1 };
let pills = &bounds[1..bounds.len() - eraser]; let pills = &bounds[1..bounds.len() - eraser];
if pills.is_empty() { if pills.is_empty() { None } else { Some(pills) }
None
} else {
Some(pills)
}
} }
fn last_pill_index(&self) -> Option<usize> { fn last_pill_index(&self) -> Option<usize> {

View file

@ -1,6 +1,6 @@
use assistant_context_editor::SavedContextMetadata; use assistant_context_editor::SavedContextMetadata;
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use gpui::{prelude::*, Entity}; use gpui::{Entity, prelude::*};
use crate::thread_store::{SerializedThreadMetadata, ThreadStore}; use crate::thread_store::{SerializedThreadMetadata, ThreadStore};

View file

@ -7,24 +7,24 @@ use std::sync::Arc;
use anyhow::{Context as _, Result}; use anyhow::{Context as _, Result};
use assistant_settings::AssistantSettings; use assistant_settings::AssistantSettings;
use client::telemetry::Telemetry; use client::telemetry::Telemetry;
use collections::{hash_map, HashMap, HashSet, VecDeque}; use collections::{HashMap, HashSet, VecDeque, hash_map};
use editor::{ use editor::{
Anchor, AnchorRangeExt, CodeActionProvider, Editor, EditorEvent, ExcerptId, ExcerptRange,
GutterDimensions, MultiBuffer, MultiBufferSnapshot, ToOffset as _, ToPoint,
actions::SelectAll, actions::SelectAll,
display_map::{ display_map::{
BlockContext, BlockPlacement, BlockProperties, BlockStyle, CustomBlockId, RenderBlock, BlockContext, BlockPlacement, BlockProperties, BlockStyle, CustomBlockId, RenderBlock,
ToDisplayPoint, ToDisplayPoint,
}, },
Anchor, AnchorRangeExt, CodeActionProvider, Editor, EditorEvent, ExcerptId, ExcerptRange,
GutterDimensions, MultiBuffer, MultiBufferSnapshot, ToOffset as _, ToPoint,
}; };
use feature_flags::{Assistant2FeatureFlag, FeatureFlagViewExt as _}; use feature_flags::{Assistant2FeatureFlag, FeatureFlagViewExt as _};
use fs::Fs; use fs::Fs;
use gpui::{ use gpui::{
point, App, Context, Entity, Focusable, Global, HighlightStyle, Subscription, Task, App, Context, Entity, Focusable, Global, HighlightStyle, Subscription, Task, UpdateGlobal,
UpdateGlobal, WeakEntity, Window, WeakEntity, Window, point,
}; };
use language::{Buffer, Point, Selection, TransactionId}; use language::{Buffer, Point, Selection, TransactionId};
use language_model::{report_assistant_event, LanguageModelRegistry}; use language_model::{LanguageModelRegistry, report_assistant_event};
use multi_buffer::MultiBufferRow; use multi_buffer::MultiBufferRow;
use parking_lot::Mutex; use parking_lot::Mutex;
use project::LspAction; use project::LspAction;
@ -32,20 +32,20 @@ use project::{CodeAction, ProjectTransaction};
use prompt_store::PromptBuilder; use prompt_store::PromptBuilder;
use settings::{Settings, SettingsStore}; use settings::{Settings, SettingsStore};
use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase}; use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase};
use terminal_view::{terminal_panel::TerminalPanel, TerminalView}; use terminal_view::{TerminalView, terminal_panel::TerminalPanel};
use text::{OffsetRangeExt, ToPoint as _}; use text::{OffsetRangeExt, ToPoint as _};
use ui::prelude::*; use ui::prelude::*;
use util::RangeExt; use util::RangeExt;
use util::ResultExt; use util::ResultExt;
use workspace::{dock::Panel, ShowConfiguration}; use workspace::{ItemHandle, Toast, Workspace, notifications::NotificationId};
use workspace::{notifications::NotificationId, ItemHandle, Toast, Workspace}; use workspace::{ShowConfiguration, dock::Panel};
use crate::AssistantPanel;
use crate::buffer_codegen::{BufferCodegen, CodegenAlternative, CodegenEvent}; use crate::buffer_codegen::{BufferCodegen, CodegenAlternative, CodegenEvent};
use crate::context_store::ContextStore; use crate::context_store::ContextStore;
use crate::inline_prompt_editor::{CodegenStatus, InlineAssistId, PromptEditor, PromptEditorEvent}; use crate::inline_prompt_editor::{CodegenStatus, InlineAssistId, PromptEditor, PromptEditorEvent};
use crate::terminal_inline_assistant::TerminalInlineAssistant; use crate::terminal_inline_assistant::TerminalInlineAssistant;
use crate::thread_store::ThreadStore; use crate::thread_store::ThreadStore;
use crate::AssistantPanel;
pub fn init( pub fn init(
fs: Arc<dyn Fs>, fs: Arc<dyn Fs>,

View file

@ -10,14 +10,14 @@ use crate::{RemoveAllContext, ToggleContextPicker};
use client::ErrorExt; use client::ErrorExt;
use collections::VecDeque; use collections::VecDeque;
use editor::{ use editor::{
actions::{MoveDown, MoveUp},
Editor, EditorElement, EditorEvent, EditorMode, EditorStyle, GutterDimensions, MultiBuffer, Editor, EditorElement, EditorEvent, EditorMode, EditorStyle, GutterDimensions, MultiBuffer,
actions::{MoveDown, MoveUp},
}; };
use feature_flags::{FeatureFlagAppExt as _, ZedPro}; use feature_flags::{FeatureFlagAppExt as _, ZedPro};
use fs::Fs; use fs::Fs;
use gpui::{ use gpui::{
anchored, deferred, point, AnyElement, App, ClickEvent, Context, CursorStyle, Entity, AnyElement, App, ClickEvent, Context, CursorStyle, Entity, EventEmitter, FocusHandle,
EventEmitter, FocusHandle, Focusable, FontWeight, Subscription, TextStyle, WeakEntity, Window, Focusable, FontWeight, Subscription, TextStyle, WeakEntity, Window, anchored, deferred, point,
}; };
use language_model::{LanguageModel, LanguageModelRegistry}; use language_model::{LanguageModel, LanguageModelRegistry};
use language_model_selector::ToggleModelSelector; use language_model_selector::ToggleModelSelector;
@ -28,7 +28,7 @@ use std::sync::Arc;
use theme::ThemeSettings; use theme::ThemeSettings;
use ui::utils::WithRemSize; use ui::utils::WithRemSize;
use ui::{ use ui::{
prelude::*, CheckboxWithLabel, IconButtonShape, KeyBinding, Popover, PopoverMenuHandle, Tooltip, CheckboxWithLabel, IconButtonShape, KeyBinding, Popover, PopoverMenuHandle, Tooltip, prelude::*,
}; };
use util::ResultExt; use util::ResultExt;
use workspace::Workspace; use workspace::Workspace;
@ -455,47 +455,55 @@ impl<T: 'static> PromptEditor<T> {
match codegen_status { match codegen_status {
CodegenStatus::Idle => { CodegenStatus::Idle => {
vec![Button::new("start", mode.start_label()) vec![
.label_size(LabelSize::Small) Button::new("start", mode.start_label())
.icon(IconName::Return) .label_size(LabelSize::Small)
.icon_size(IconSize::XSmall) .icon(IconName::Return)
.icon_color(Color::Muted) .icon_size(IconSize::XSmall)
.on_click(cx.listener(|_, _, _, cx| cx.emit(PromptEditorEvent::StartRequested))) .icon_color(Color::Muted)
.into_any_element()] .on_click(
cx.listener(|_, _, _, cx| cx.emit(PromptEditorEvent::StartRequested)),
)
.into_any_element(),
]
} }
CodegenStatus::Pending => vec![IconButton::new("stop", IconName::Stop) CodegenStatus::Pending => vec![
.icon_color(Color::Error) IconButton::new("stop", IconName::Stop)
.shape(IconButtonShape::Square) .icon_color(Color::Error)
.tooltip(move |window, cx| { .shape(IconButtonShape::Square)
Tooltip::with_meta( .tooltip(move |window, cx| {
mode.tooltip_interrupt(), Tooltip::with_meta(
Some(&menu::Cancel), mode.tooltip_interrupt(),
"Changes won't be discarded", Some(&menu::Cancel),
window, "Changes won't be discarded",
cx, window,
) cx,
}) )
.on_click(cx.listener(|_, _, _, cx| cx.emit(PromptEditorEvent::StopRequested))) })
.into_any_element()], .on_click(cx.listener(|_, _, _, cx| cx.emit(PromptEditorEvent::StopRequested)))
.into_any_element(),
],
CodegenStatus::Done | CodegenStatus::Error(_) => { CodegenStatus::Done | CodegenStatus::Error(_) => {
let has_error = matches!(codegen_status, CodegenStatus::Error(_)); let has_error = matches!(codegen_status, CodegenStatus::Error(_));
if has_error || self.edited_since_done { if has_error || self.edited_since_done {
vec![IconButton::new("restart", IconName::RotateCw) vec![
.icon_color(Color::Info) IconButton::new("restart", IconName::RotateCw)
.shape(IconButtonShape::Square) .icon_color(Color::Info)
.tooltip(move |window, cx| { .shape(IconButtonShape::Square)
Tooltip::with_meta( .tooltip(move |window, cx| {
mode.tooltip_restart(), Tooltip::with_meta(
Some(&menu::Confirm), mode.tooltip_restart(),
"Changes will be discarded", Some(&menu::Confirm),
window, "Changes will be discarded",
cx, window,
) cx,
}) )
.on_click(cx.listener(|_, _, _, cx| { })
cx.emit(PromptEditorEvent::StartRequested); .on_click(cx.listener(|_, _, _, cx| {
})) cx.emit(PromptEditorEvent::StartRequested);
.into_any_element()] }))
.into_any_element(),
]
} else { } else {
let accept = IconButton::new("accept", IconName::Check) let accept = IconButton::new("accept", IconName::Check)
.icon_color(Color::Info) .icon_color(Color::Info)

View file

@ -6,8 +6,8 @@ use editor::{ContextMenuOptions, ContextMenuPlacement, Editor, EditorElement, Ed
use file_icons::FileIcons; use file_icons::FileIcons;
use fs::Fs; use fs::Fs;
use gpui::{ use gpui::{
linear_color_stop, linear_gradient, point, Animation, AnimationExt, App, DismissEvent, Entity, Animation, AnimationExt, App, DismissEvent, Entity, Focusable, Subscription, TextStyle,
Focusable, Subscription, TextStyle, WeakEntity, WeakEntity, linear_color_stop, linear_gradient, point,
}; };
use language_model::LanguageModelRegistry; use language_model::LanguageModelRegistry;
use language_model_selector::ToggleModelSelector; use language_model_selector::ToggleModelSelector;
@ -16,8 +16,8 @@ use settings::Settings;
use std::time::Duration; use std::time::Duration;
use theme::ThemeSettings; use theme::ThemeSettings;
use ui::{ use ui::{
prelude::*, ButtonLike, Disclosure, KeyBinding, PlatformStyle, PopoverMenu, PopoverMenuHandle, ButtonLike, Disclosure, KeyBinding, PlatformStyle, PopoverMenu, PopoverMenuHandle, Tooltip,
Tooltip, prelude::*,
}; };
use util::ResultExt; use util::ResultExt;
use vim_mode_setting::VimModeSetting; use vim_mode_setting::VimModeSetting;
@ -25,7 +25,7 @@ use workspace::Workspace;
use crate::assistant_model_selector::AssistantModelSelector; use crate::assistant_model_selector::AssistantModelSelector;
use crate::context_picker::{ConfirmBehavior, ContextPicker, ContextPickerCompletionProvider}; use crate::context_picker::{ConfirmBehavior, ContextPicker, ContextPickerCompletionProvider};
use crate::context_store::{refresh_context_store_text, ContextStore}; use crate::context_store::{ContextStore, refresh_context_store_text};
use crate::context_strip::{ContextStrip, ContextStripEvent, SuggestContextKind}; use crate::context_strip::{ContextStrip, ContextStripEvent, SuggestContextKind};
use crate::profile_selector::ProfileSelector; use crate::profile_selector::ProfileSelector;
use crate::thread::{RequestKind, Thread}; use crate::thread::{RequestKind, Thread};

View file

@ -2,12 +2,12 @@ use std::sync::Arc;
use assistant_settings::{AgentProfile, AssistantSettings}; use assistant_settings::{AgentProfile, AssistantSettings};
use fs::Fs; use fs::Fs;
use gpui::{prelude::*, Action, Entity, FocusHandle, Subscription, WeakEntity}; use gpui::{Action, Entity, FocusHandle, Subscription, WeakEntity, prelude::*};
use indexmap::IndexMap; use indexmap::IndexMap;
use settings::{update_settings_file, Settings as _, SettingsStore}; use settings::{Settings as _, SettingsStore, update_settings_file};
use ui::{ use ui::{
prelude::*, ButtonLike, ContextMenu, ContextMenuEntry, KeyBinding, PopoverMenu, ButtonLike, ContextMenu, ContextMenuEntry, KeyBinding, PopoverMenu, PopoverMenuHandle,
PopoverMenuHandle, prelude::*,
}; };
use util::ResultExt as _; use util::ResultExt as _;

View file

@ -1,8 +1,8 @@
use crate::inline_prompt_editor::CodegenStatus; use crate::inline_prompt_editor::CodegenStatus;
use client::telemetry::Telemetry; use client::telemetry::Telemetry;
use futures::{channel::mpsc, SinkExt, StreamExt}; use futures::{SinkExt, StreamExt, channel::mpsc};
use gpui::{App, AppContext as _, Context, Entity, EventEmitter, Task}; use gpui::{App, AppContext as _, Context, Entity, EventEmitter, Task};
use language_model::{report_assistant_event, LanguageModelRegistry, LanguageModelRequest}; use language_model::{LanguageModelRegistry, LanguageModelRequest, report_assistant_event};
use std::{sync::Arc, time::Instant}; use std::{sync::Arc, time::Instant};
use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase}; use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase};
use terminal::Terminal; use terminal::Terminal;

View file

@ -3,18 +3,18 @@ use crate::context_store::ContextStore;
use crate::inline_prompt_editor::{ use crate::inline_prompt_editor::{
CodegenStatus, PromptEditor, PromptEditorEvent, TerminalInlineAssistId, CodegenStatus, PromptEditor, PromptEditorEvent, TerminalInlineAssistId,
}; };
use crate::terminal_codegen::{CodegenEvent, TerminalCodegen, CLEAR_INPUT}; use crate::terminal_codegen::{CLEAR_INPUT, CodegenEvent, TerminalCodegen};
use crate::thread_store::ThreadStore; use crate::thread_store::ThreadStore;
use anyhow::{Context as _, Result}; use anyhow::{Context as _, Result};
use client::telemetry::Telemetry; use client::telemetry::Telemetry;
use collections::{HashMap, VecDeque}; use collections::{HashMap, VecDeque};
use editor::{actions::SelectAll, MultiBuffer}; use editor::{MultiBuffer, actions::SelectAll};
use fs::Fs; use fs::Fs;
use gpui::{App, Entity, Focusable, Global, Subscription, UpdateGlobal, WeakEntity}; use gpui::{App, Entity, Focusable, Global, Subscription, UpdateGlobal, WeakEntity};
use language::Buffer; use language::Buffer;
use language_model::{ use language_model::{
report_assistant_event, LanguageModelRegistry, LanguageModelRequest, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, Role,
LanguageModelRequestMessage, Role, report_assistant_event,
}; };
use prompt_store::PromptBuilder; use prompt_store::PromptBuilder;
use std::sync::Arc; use std::sync::Arc;
@ -22,7 +22,7 @@ use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase};
use terminal_view::TerminalView; use terminal_view::TerminalView;
use ui::prelude::*; use ui::prelude::*;
use util::ResultExt; use util::ResultExt;
use workspace::{notifications::NotificationId, Toast, Workspace}; use workspace::{Toast, Workspace, notifications::NotificationId};
pub fn init( pub fn init(
fs: Arc<dyn Fs>, fs: Arc<dyn Fs>,

View file

@ -26,10 +26,10 @@ use prompt_store::{
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use settings::Settings; use settings::Settings;
use util::{maybe, post_inc, ResultExt as _, TryFutureExt as _}; use util::{ResultExt as _, TryFutureExt as _, maybe, post_inc};
use uuid::Uuid; use uuid::Uuid;
use crate::context::{attach_context_to_message, ContextId, ContextSnapshot}; use crate::context::{ContextId, ContextSnapshot, attach_context_to_message};
use crate::thread_store::{ use crate::thread_store::{
SerializedMessage, SerializedMessageSegment, SerializedThread, SerializedToolResult, SerializedMessage, SerializedMessageSegment, SerializedThread, SerializedToolResult,
SerializedToolUse, SerializedToolUse,

View file

@ -1,10 +1,10 @@
use assistant_context_editor::SavedContextMetadata; use assistant_context_editor::SavedContextMetadata;
use gpui::{ use gpui::{
uniform_list, App, Entity, FocusHandle, Focusable, ScrollStrategy, UniformListScrollHandle, App, Entity, FocusHandle, Focusable, ScrollStrategy, UniformListScrollHandle, WeakEntity,
WeakEntity, uniform_list,
}; };
use time::{OffsetDateTime, UtcOffset}; use time::{OffsetDateTime, UtcOffset};
use ui::{prelude::*, IconButtonShape, ListItem, ListItemSpacing, Tooltip}; use ui::{IconButtonShape, ListItem, ListItemSpacing, Tooltip, prelude::*};
use crate::history_store::{HistoryEntry, HistoryStore}; use crate::history_store::{HistoryEntry, HistoryStore};
use crate::thread_store::SerializedThreadMetadata; use crate::thread_store::SerializedThreadMetadata;

View file

@ -2,20 +2,20 @@ use std::borrow::Cow;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_settings::{AgentProfile, AssistantSettings}; use assistant_settings::{AgentProfile, AssistantSettings};
use assistant_tool::{ToolId, ToolSource, ToolWorkingSet}; use assistant_tool::{ToolId, ToolSource, ToolWorkingSet};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use collections::HashMap; use collections::HashMap;
use context_server::manager::ContextServerManager; use context_server::manager::ContextServerManager;
use context_server::{ContextServerFactoryRegistry, ContextServerTool}; use context_server::{ContextServerFactoryRegistry, ContextServerTool};
use futures::future::{self, BoxFuture, Shared};
use futures::FutureExt as _; use futures::FutureExt as _;
use futures::future::{self, BoxFuture, Shared};
use gpui::{ use gpui::{
prelude::*, App, BackgroundExecutor, Context, Entity, Global, ReadGlobal, SharedString, Task, App, BackgroundExecutor, Context, Entity, Global, ReadGlobal, SharedString, Task, prelude::*,
}; };
use heed::types::SerdeBincode;
use heed::Database; use heed::Database;
use heed::types::SerdeBincode;
use language_model::{LanguageModelToolUseId, Role, TokenUsage}; use language_model::{LanguageModelToolUseId, Role, TokenUsage};
use project::Project; use project::Project;
use prompt_store::PromptBuilder; use prompt_store::PromptBuilder;

View file

@ -3,8 +3,8 @@ use std::sync::Arc;
use anyhow::Result; use anyhow::Result;
use assistant_tool::{Tool, ToolWorkingSet}; use assistant_tool::{Tool, ToolWorkingSet};
use collections::HashMap; use collections::HashMap;
use futures::future::Shared;
use futures::FutureExt as _; use futures::FutureExt as _;
use futures::future::Shared;
use gpui::{App, SharedString, Task}; use gpui::{App, SharedString, Task};
use language_model::{ use language_model::{
LanguageModelRequestMessage, LanguageModelToolResult, LanguageModelToolUse, LanguageModelRequestMessage, LanguageModelToolResult, LanguageModelToolUse,

View file

@ -1,12 +1,12 @@
use gpui::{ use gpui::{
linear_color_stop, linear_gradient, point, App, Context, EventEmitter, IntoElement, App, Context, EventEmitter, IntoElement, PlatformDisplay, Size, Window,
PlatformDisplay, Size, Window, WindowBackgroundAppearance, WindowBounds, WindowDecorations, WindowBackgroundAppearance, WindowBounds, WindowDecorations, WindowKind, WindowOptions,
WindowKind, WindowOptions, linear_color_stop, linear_gradient, point,
}; };
use release_channel::ReleaseChannel; use release_channel::ReleaseChannel;
use std::rc::Rc; use std::rc::Rc;
use theme; use theme;
use ui::{prelude::*, Render}; use ui::{Render, prelude::*};
pub struct AgentNotification { pub struct AgentNotification {
title: SharedString, title: SharedString,

View file

@ -1,7 +1,7 @@
use std::rc::Rc; use std::rc::Rc;
use gpui::ClickEvent; use gpui::ClickEvent;
use ui::{prelude::*, IconButtonShape, Tooltip}; use ui::{IconButtonShape, Tooltip, prelude::*};
use crate::context::{ContextKind, ContextSnapshot}; use crate::context::{ContextKind, ContextSnapshot};

View file

@ -2,7 +2,7 @@
mod context_tests; mod context_tests;
use crate::patch::{AssistantEdit, AssistantPatch, AssistantPatchStatus}; use crate::patch::{AssistantEdit, AssistantPatch, AssistantPatchStatus};
use anyhow::{anyhow, Context as _, Result}; use anyhow::{Context as _, Result, anyhow};
use assistant_slash_command::{ use assistant_slash_command::{
SlashCommandContent, SlashCommandEvent, SlashCommandLine, SlashCommandOutputSection, SlashCommandContent, SlashCommandEvent, SlashCommandLine, SlashCommandOutputSection,
SlashCommandResult, SlashCommandWorkingSet, SlashCommandResult, SlashCommandWorkingSet,
@ -12,17 +12,17 @@ use client::{self, proto, telemetry::Telemetry};
use clock::ReplicaId; use clock::ReplicaId;
use collections::{HashMap, HashSet}; use collections::{HashMap, HashSet};
use fs::{Fs, RemoveOptions}; use fs::{Fs, RemoveOptions};
use futures::{future::Shared, FutureExt, StreamExt}; use futures::{FutureExt, StreamExt, future::Shared};
use gpui::{ use gpui::{
App, AppContext as _, Context, Entity, EventEmitter, RenderImage, SharedString, Subscription, App, AppContext as _, Context, Entity, EventEmitter, RenderImage, SharedString, Subscription,
Task, Task,
}; };
use language::{AnchorRangeExt, Bias, Buffer, LanguageRegistry, OffsetRangeExt, Point, ToOffset}; use language::{AnchorRangeExt, Bias, Buffer, LanguageRegistry, OffsetRangeExt, Point, ToOffset};
use language_model::{ use language_model::{
report_assistant_event, LanguageModel, LanguageModelCacheConfiguration, LanguageModel, LanguageModelCacheConfiguration, LanguageModelCompletionEvent,
LanguageModelCompletionEvent, LanguageModelImage, LanguageModelRegistry, LanguageModelRequest, LanguageModelImage, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage,
LanguageModelRequestMessage, LanguageModelToolUseId, MaxMonthlySpendReachedError, LanguageModelToolUseId, MaxMonthlySpendReachedError, MessageContent, PaymentRequiredError,
MessageContent, PaymentRequiredError, Role, StopReason, Role, StopReason, report_assistant_event,
}; };
use open_ai::Model as OpenAiModel; use open_ai::Model as OpenAiModel;
use paths::contexts_dir; use paths::contexts_dir;
@ -31,7 +31,7 @@ use prompt_store::PromptBuilder;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use smallvec::SmallVec; use smallvec::SmallVec;
use std::{ use std::{
cmp::{max, Ordering}, cmp::{Ordering, max},
fmt::Debug, fmt::Debug,
iter, mem, iter, mem,
ops::Range, ops::Range,
@ -43,7 +43,7 @@ use std::{
use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase}; use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase};
use text::{BufferSnapshot, ToPoint}; use text::{BufferSnapshot, ToPoint};
use ui::IconName; use ui::IconName;
use util::{post_inc, ResultExt, TryFutureExt}; use util::{ResultExt, TryFutureExt, post_inc};
use uuid::Uuid; use uuid::Uuid;
#[derive(Clone, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)] #[derive(Clone, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)]

View file

@ -14,7 +14,7 @@ use futures::{
channel::mpsc, channel::mpsc,
stream::{self, StreamExt}, stream::{self, StreamExt},
}; };
use gpui::{prelude::*, App, Entity, SharedString, Task, TestAppContext, WeakEntity}; use gpui::{App, Entity, SharedString, Task, TestAppContext, WeakEntity, prelude::*};
use language::{Buffer, BufferSnapshot, LanguageRegistry, LspAdapterDelegate}; use language::{Buffer, BufferSnapshot, LanguageRegistry, LspAdapterDelegate};
use language_model::{LanguageModelCacheConfiguration, LanguageModelRegistry, Role}; use language_model::{LanguageModelCacheConfiguration, LanguageModelRegistry, Role};
use parking_lot::Mutex; use parking_lot::Mutex;
@ -30,14 +30,14 @@ use std::{
ops::Range, ops::Range,
path::Path, path::Path,
rc::Rc, rc::Rc,
sync::{atomic::AtomicBool, Arc}, sync::{Arc, atomic::AtomicBool},
}; };
use text::{network::Network, OffsetRangeExt as _, ReplicaId, ToOffset}; use text::{OffsetRangeExt as _, ReplicaId, ToOffset, network::Network};
use ui::{IconName, Window}; use ui::{IconName, Window};
use unindent::Unindent; use unindent::Unindent;
use util::{ use util::{
test::{generate_marked_text, marked_text_ranges},
RandomCharIter, RandomCharIter,
test::{generate_marked_text, marked_text_ranges},
}; };
use workspace::Workspace; use workspace::Workspace;

View file

@ -2,36 +2,36 @@ use anyhow::Result;
use assistant_settings::AssistantSettings; use assistant_settings::AssistantSettings;
use assistant_slash_command::{SlashCommand, SlashCommandOutputSection, SlashCommandWorkingSet}; use assistant_slash_command::{SlashCommand, SlashCommandOutputSection, SlashCommandWorkingSet};
use assistant_slash_commands::{ use assistant_slash_commands::{
selections_creases, DefaultSlashCommand, DocsSlashCommand, DocsSlashCommandArgs, DefaultSlashCommand, DocsSlashCommand, DocsSlashCommandArgs, FileSlashCommand,
FileSlashCommand, selections_creases,
}; };
use client::{proto, zed_urls}; use client::{proto, zed_urls};
use collections::{hash_map, BTreeSet, HashMap, HashSet}; use collections::{BTreeSet, HashMap, HashSet, hash_map};
use editor::{ use editor::{
Anchor, Editor, EditorEvent, MenuInlineCompletionsPolicy, ProposedChangeLocation,
ProposedChangesEditor, RowExt, ToOffset as _, ToPoint,
actions::{FoldAt, MoveToEndOfLine, Newline, ShowCompletions, UnfoldAt}, actions::{FoldAt, MoveToEndOfLine, Newline, ShowCompletions, UnfoldAt},
display_map::{ display_map::{
BlockContext, BlockId, BlockPlacement, BlockProperties, BlockStyle, Crease, CreaseMetadata, BlockContext, BlockId, BlockPlacement, BlockProperties, BlockStyle, Crease, CreaseMetadata,
CustomBlockId, FoldId, RenderBlock, ToDisplayPoint, CustomBlockId, FoldId, RenderBlock, ToDisplayPoint,
}, },
scroll::Autoscroll, scroll::Autoscroll,
Anchor, Editor, EditorEvent, MenuInlineCompletionsPolicy, ProposedChangeLocation,
ProposedChangesEditor, RowExt, ToOffset as _, ToPoint,
}; };
use editor::{display_map::CreaseId, FoldPlaceholder}; use editor::{FoldPlaceholder, display_map::CreaseId};
use fs::Fs; use fs::Fs;
use futures::FutureExt; use futures::FutureExt;
use gpui::{ use gpui::{
actions, div, img, impl_internal_actions, percentage, point, prelude::*, pulsating_between, Animation, AnimationExt, AnyElement, AnyView, App, AsyncWindowContext, ClipboardEntry,
size, Animation, AnimationExt, AnyElement, AnyView, App, AsyncWindowContext, ClipboardEntry,
ClipboardItem, CursorStyle, Empty, Entity, EventEmitter, FocusHandle, Focusable, FontWeight, ClipboardItem, CursorStyle, Empty, Entity, EventEmitter, FocusHandle, Focusable, FontWeight,
Global, InteractiveElement, IntoElement, ParentElement, Pixels, Render, RenderImage, Global, InteractiveElement, IntoElement, ParentElement, Pixels, Render, RenderImage,
SharedString, Size, StatefulInteractiveElement, Styled, Subscription, Task, Transformation, SharedString, Size, StatefulInteractiveElement, Styled, Subscription, Task, Transformation,
WeakEntity, WeakEntity, actions, div, img, impl_internal_actions, percentage, point, prelude::*,
pulsating_between, size,
}; };
use indexed_docs::IndexedDocsStore; use indexed_docs::IndexedDocsStore;
use language::{ use language::{
language_settings::{all_language_settings, SoftWrap},
BufferSnapshot, LspAdapterDelegate, ToOffset, BufferSnapshot, LspAdapterDelegate, ToOffset,
language_settings::{SoftWrap, all_language_settings},
}; };
use language_model::{ use language_model::{
LanguageModelImage, LanguageModelProvider, LanguageModelProviderTosView, LanguageModelRegistry, LanguageModelImage, LanguageModelProvider, LanguageModelProviderTosView, LanguageModelRegistry,
@ -46,33 +46,33 @@ use project::lsp_store::LocalLspAdapterDelegate;
use project::{Project, Worktree}; use project::{Project, Worktree};
use rope::Point; use rope::Point;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use settings::{update_settings_file, Settings, SettingsStore}; use settings::{Settings, SettingsStore, update_settings_file};
use std::{any::TypeId, borrow::Cow, cmp, ops::Range, path::PathBuf, sync::Arc, time::Duration}; use std::{any::TypeId, borrow::Cow, cmp, ops::Range, path::PathBuf, sync::Arc, time::Duration};
use text::SelectionGoal; use text::SelectionGoal;
use ui::{ use ui::{
prelude::*, ButtonLike, Disclosure, ElevationIndex, KeyBinding, PopoverMenuHandle, TintColor, ButtonLike, Disclosure, ElevationIndex, KeyBinding, PopoverMenuHandle, TintColor, Tooltip,
Tooltip, prelude::*,
}; };
use util::{maybe, ResultExt}; use util::{ResultExt, maybe};
use workspace::searchable::{Direction, SearchableItemHandle}; use workspace::searchable::{Direction, SearchableItemHandle};
use workspace::{ use workspace::{
Save, ShowConfiguration, Toast, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView,
Workspace,
item::{self, FollowableItem, Item, ItemHandle}, item::{self, FollowableItem, Item, ItemHandle},
notifications::NotificationId, notifications::NotificationId,
pane::{self, SaveIntent}, pane::{self, SaveIntent},
searchable::{SearchEvent, SearchableItem}, searchable::{SearchEvent, SearchableItem},
Save, ShowConfiguration, Toast, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView,
Workspace,
}; };
use crate::{
slash_command::SlashCommandCompletionProvider, slash_command_picker,
ThoughtProcessOutputSection,
};
use crate::{ use crate::{
AssistantContext, AssistantPatch, AssistantPatchStatus, CacheStatus, Content, ContextEvent, AssistantContext, AssistantPatch, AssistantPatchStatus, CacheStatus, Content, ContextEvent,
ContextId, InvokedSlashCommandId, InvokedSlashCommandStatus, Message, MessageId, ContextId, InvokedSlashCommandId, InvokedSlashCommandStatus, Message, MessageId,
MessageMetadata, MessageStatus, ParsedSlashCommand, PendingSlashCommandStatus, RequestType, MessageMetadata, MessageStatus, ParsedSlashCommand, PendingSlashCommandStatus, RequestType,
}; };
use crate::{
ThoughtProcessOutputSection, slash_command::SlashCommandCompletionProvider,
slash_command_picker,
};
actions!( actions!(
assistant, assistant,

View file

@ -3,13 +3,13 @@ use std::sync::Arc;
use gpui::{App, Entity, EventEmitter, FocusHandle, Focusable, Subscription, Task, WeakEntity}; use gpui::{App, Entity, EventEmitter, FocusHandle, Focusable, Subscription, Task, WeakEntity};
use picker::{Picker, PickerDelegate}; use picker::{Picker, PickerDelegate};
use project::Project; use project::Project;
use ui::utils::{format_distance_from_now, DateTimeType}; use ui::utils::{DateTimeType, format_distance_from_now};
use ui::{prelude::*, Avatar, ListItem, ListItemSpacing}; use ui::{Avatar, ListItem, ListItemSpacing, prelude::*};
use workspace::{Item, Workspace}; use workspace::{Item, Workspace};
use crate::{ use crate::{
AssistantPanelDelegate, ContextStore, RemoteContextMetadata, SavedContextMetadata, AssistantPanelDelegate, ContextStore, DEFAULT_TAB_TITLE, RemoteContextMetadata,
DEFAULT_TAB_TITLE, SavedContextMetadata,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -229,10 +229,12 @@ impl PickerDelegate for SavedContextPickerDelegate {
.into_any_element(), .into_any_element(),
] ]
} else { } else {
vec![Label::new("Shared by host") vec![
.color(Color::Muted) Label::new("Shared by host")
.size(LabelSize::Small) .color(Color::Muted)
.into_any_element()] .size(LabelSize::Small)
.into_any_element(),
]
}), }),
) )
} }

View file

@ -2,13 +2,13 @@ use crate::{
AssistantContext, ContextEvent, ContextId, ContextOperation, ContextVersion, SavedContext, AssistantContext, ContextEvent, ContextId, ContextOperation, ContextVersion, SavedContext,
SavedContextMetadata, SavedContextMetadata,
}; };
use anyhow::{anyhow, Context as _, Result}; use anyhow::{Context as _, Result, anyhow};
use assistant_slash_command::{SlashCommandId, SlashCommandWorkingSet}; use assistant_slash_command::{SlashCommandId, SlashCommandWorkingSet};
use client::{proto, telemetry::Telemetry, Client, TypedEnvelope}; use client::{Client, TypedEnvelope, proto, telemetry::Telemetry};
use clock::ReplicaId; use clock::ReplicaId;
use collections::HashMap; use collections::HashMap;
use context_server::manager::ContextServerManager;
use context_server::ContextServerFactoryRegistry; use context_server::ContextServerFactoryRegistry;
use context_server::manager::ContextServerManager;
use fs::{Fs, RemoveOptions}; use fs::{Fs, RemoveOptions};
use futures::StreamExt; use futures::StreamExt;
use fuzzy::StringMatchCandidate; use fuzzy::StringMatchCandidate;
@ -104,52 +104,47 @@ impl ContextStore {
const CONTEXT_WATCH_DURATION: Duration = Duration::from_millis(100); const CONTEXT_WATCH_DURATION: Duration = Duration::from_millis(100);
let (mut events, _) = fs.watch(contexts_dir(), CONTEXT_WATCH_DURATION).await; let (mut events, _) = fs.watch(contexts_dir(), CONTEXT_WATCH_DURATION).await;
let this = let this = cx.new(|cx: &mut Context<Self>| {
cx.new(|cx: &mut Context<Self>| { let context_server_factory_registry =
let context_server_factory_registry = ContextServerFactoryRegistry::default_global(cx);
ContextServerFactoryRegistry::default_global(cx); let context_server_manager = cx.new(|cx| {
let context_server_manager = cx.new(|cx| { ContextServerManager::new(context_server_factory_registry, project.clone(), cx)
ContextServerManager::new( });
context_server_factory_registry, let mut this = Self {
project.clone(), contexts: Vec::new(),
cx, contexts_metadata: Vec::new(),
) context_server_manager,
}); context_server_slash_command_ids: HashMap::default(),
let mut this = Self { host_contexts: Vec::new(),
contexts: Vec::new(), fs,
contexts_metadata: Vec::new(), languages,
context_server_manager, slash_commands,
context_server_slash_command_ids: HashMap::default(), telemetry,
host_contexts: Vec::new(), _watch_updates: cx.spawn(async move |this, cx| {
fs, async move {
languages, while events.next().await.is_some() {
slash_commands, this.update(cx, |this, cx| this.reload(cx))?.await.log_err();
telemetry,
_watch_updates: cx.spawn(async move |this, cx| {
async move {
while events.next().await.is_some() {
this.update(cx, |this, cx| this.reload(cx))?.await.log_err();
}
anyhow::Ok(())
} }
.log_err() anyhow::Ok(())
.await }
}), .log_err()
client_subscription: None, .await
_project_subscriptions: vec![ }),
cx.subscribe(&project, Self::handle_project_event) client_subscription: None,
], _project_subscriptions: vec![
project_is_shared: false, cx.subscribe(&project, Self::handle_project_event),
client: project.read(cx).client(), ],
project: project.clone(), project_is_shared: false,
prompt_builder, client: project.read(cx).client(),
}; project: project.clone(),
this.handle_project_shared(project.clone(), cx); prompt_builder,
this.synchronize_contexts(cx); };
this.register_context_server_handlers(cx); this.handle_project_shared(project.clone(), cx);
this.reload(cx).detach_and_log_err(cx); this.synchronize_contexts(cx);
this this.register_context_server_handlers(cx);
})?; this.reload(cx).detach_and_log_err(cx);
this
})?;
Ok(this) Ok(this)
}) })

View file

@ -1,7 +1,7 @@
use anyhow::{anyhow, Context as _, Result}; use anyhow::{Context as _, Result, anyhow};
use collections::HashMap; use collections::HashMap;
use editor::ProposedChangesEditor; use editor::ProposedChangesEditor;
use futures::{future, TryFutureExt as _}; use futures::{TryFutureExt as _, future};
use gpui::{App, AppContext as _, AsyncApp, Entity, SharedString}; use gpui::{App, AppContext as _, AsyncApp, Entity, SharedString};
use language::{AutoindentMode, Buffer, BufferSnapshot}; use language::{AutoindentMode, Buffer, BufferSnapshot};
use project::{Project, ProjectPath}; use project::{Project, ProjectPath};
@ -548,7 +548,7 @@ mod tests {
use super::*; use super::*;
use gpui::App; use gpui::App;
use language::{ use language::{
language_settings::AllLanguageSettings, Language, LanguageConfig, LanguageMatcher, Language, LanguageConfig, LanguageMatcher, language_settings::AllLanguageSettings,
}; };
use settings::SettingsStore; use settings::SettingsStore;
use ui::BorrowAppContext; use ui::BorrowAppContext;

View file

@ -3,19 +3,19 @@ use anyhow::Result;
pub use assistant_slash_command::SlashCommand; pub use assistant_slash_command::SlashCommand;
use assistant_slash_command::{AfterCompletion, SlashCommandLine, SlashCommandWorkingSet}; use assistant_slash_command::{AfterCompletion, SlashCommandLine, SlashCommandWorkingSet};
use editor::{CompletionProvider, Editor, ExcerptId}; use editor::{CompletionProvider, Editor, ExcerptId};
use fuzzy::{match_strings, StringMatchCandidate}; use fuzzy::{StringMatchCandidate, match_strings};
use gpui::{App, AppContext as _, Context, Entity, Task, WeakEntity, Window}; use gpui::{App, AppContext as _, Context, Entity, Task, WeakEntity, Window};
use language::{Anchor, Buffer, ToPoint}; use language::{Anchor, Buffer, ToPoint};
use parking_lot::Mutex; use parking_lot::Mutex;
use project::{lsp_store::CompletionDocumentation, CompletionIntent, CompletionSource}; use project::{CompletionIntent, CompletionSource, lsp_store::CompletionDocumentation};
use rope::Point; use rope::Point;
use std::{ use std::{
cell::RefCell, cell::RefCell,
ops::Range, ops::Range,
rc::Rc, rc::Rc,
sync::{ sync::{
atomic::{AtomicBool, Ordering::SeqCst},
Arc, Arc,
atomic::{AtomicBool, Ordering::SeqCst},
}, },
}; };
use workspace::Workspace; use workspace::Workspace;

View file

@ -3,7 +3,7 @@ use std::sync::Arc;
use assistant_slash_command::SlashCommandWorkingSet; use assistant_slash_command::SlashCommandWorkingSet;
use gpui::{AnyElement, AnyView, DismissEvent, SharedString, Task, WeakEntity}; use gpui::{AnyElement, AnyView, DismissEvent, SharedString, Task, WeakEntity};
use picker::{Picker, PickerDelegate, PickerEditorPosition}; use picker::{Picker, PickerDelegate, PickerEditorPosition};
use ui::{prelude::*, ListItem, ListItemSpacing, PopoverMenu, PopoverTrigger, Tooltip}; use ui::{ListItem, ListItemSpacing, PopoverMenu, PopoverTrigger, Tooltip, prelude::*};
use crate::context_editor::ContextEditor; use crate::context_editor::ContextEditor;

View file

@ -1,11 +1,11 @@
use anyhow::anyhow; use anyhow::anyhow;
use assistant2::{RequestKind, Thread, ThreadEvent, ThreadStore};
use assistant_tool::ToolWorkingSet; use assistant_tool::ToolWorkingSet;
use assistant2::{RequestKind, Thread, ThreadEvent, ThreadStore};
use client::{Client, UserStore}; use client::{Client, UserStore};
use collections::HashMap; use collections::HashMap;
use dap::DapRegistry; use dap::DapRegistry;
use futures::StreamExt; use futures::StreamExt;
use gpui::{prelude::*, App, AsyncApp, Entity, SemanticVersion, Subscription, Task}; use gpui::{App, AsyncApp, Entity, SemanticVersion, Subscription, Task, prelude::*};
use language::LanguageRegistry; use language::LanguageRegistry;
use language_model::{ use language_model::{
AuthenticateError, LanguageModel, LanguageModelProviderId, LanguageModelRegistry, AuthenticateError, LanguageModel, LanguageModelProviderId, LanguageModelRegistry,

View file

@ -6,7 +6,7 @@ use clap::Parser;
use eval::{Eval, EvalOutput}; use eval::{Eval, EvalOutput};
use futures::future; use futures::future;
use gpui::{Application, AsyncApp}; use gpui::{Application, AsyncApp};
use headless_assistant::{authenticate_model_provider, find_model, HeadlessAppState}; use headless_assistant::{HeadlessAppState, authenticate_model_provider, find_model};
use itertools::Itertools; use itertools::Itertools;
use judge::Judge; use judge::Judge;
use language_model::{LanguageModel, LanguageModelRegistry}; use language_model::{LanguageModel, LanguageModelRegistry};

View file

@ -11,7 +11,7 @@ use indexmap::IndexMap;
use language_model::{CloudModel, LanguageModel}; use language_model::{CloudModel, LanguageModel};
use lmstudio::Model as LmStudioModel; use lmstudio::Model as LmStudioModel;
use ollama::Model as OllamaModel; use ollama::Model as OllamaModel;
use schemars::{schema::Schema, JsonSchema}; use schemars::{JsonSchema, schema::Schema};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use settings::{Settings, SettingsSources}; use settings::{Settings, SettingsSources};

View file

@ -6,17 +6,17 @@ pub use crate::extension_slash_command::*;
pub use crate::slash_command_registry::*; pub use crate::slash_command_registry::*;
pub use crate::slash_command_working_set::*; pub use crate::slash_command_working_set::*;
use anyhow::Result; use anyhow::Result;
use futures::stream::{self, BoxStream};
use futures::StreamExt; use futures::StreamExt;
use futures::stream::{self, BoxStream};
use gpui::{App, SharedString, Task, WeakEntity, Window}; use gpui::{App, SharedString, Task, WeakEntity, Window};
use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate, OffsetRangeExt}; use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate, OffsetRangeExt};
pub use language_model::Role; pub use language_model::Role;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{ use std::{
ops::Range, ops::Range,
sync::{atomic::AtomicBool, Arc}, sync::{Arc, atomic::AtomicBool},
}; };
use workspace::{ui::IconName, Workspace}; use workspace::{Workspace, ui::IconName};
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
SlashCommandRegistry::default_global(cx); SlashCommandRegistry::default_global(cx);

View file

@ -1,5 +1,5 @@
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::{atomic::AtomicBool, Arc}; use std::sync::{Arc, atomic::AtomicBool};
use anyhow::Result; use anyhow::Result;
use async_trait::async_trait; use async_trait::async_trait;

View file

@ -1,4 +1,4 @@
use anyhow::{anyhow, Context as _, Result}; use anyhow::{Context as _, Result, anyhow};
use assistant_slash_command::{ use assistant_slash_command::{
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
SlashCommandResult, SlashCommandResult,
@ -10,7 +10,7 @@ use project::{Project, ProjectPath};
use std::{ use std::{
fmt::Write, fmt::Write,
path::Path, path::Path,
sync::{atomic::AtomicBool, Arc}, sync::{Arc, atomic::AtomicBool},
}; };
use ui::prelude::*; use ui::prelude::*;
use workspace::Workspace; use workspace::Workspace;

View file

@ -1,4 +1,4 @@
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_slash_command::{ use assistant_slash_command::{
AfterCompletion, ArgumentCompletion, SlashCommand, SlashCommandOutput, AfterCompletion, ArgumentCompletion, SlashCommand, SlashCommandOutput,
SlashCommandOutputSection, SlashCommandResult, SlashCommandOutputSection, SlashCommandResult,
@ -10,8 +10,8 @@ use context_server::{
}; };
use gpui::{App, Entity, Task, WeakEntity, Window}; use gpui::{App, Entity, Task, WeakEntity, Window};
use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate}; use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate};
use std::sync::atomic::AtomicBool;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use text::LineEnding; use text::LineEnding;
use ui::{IconName, SharedString}; use ui::{IconName, SharedString};
use workspace::Workspace; use workspace::Workspace;

View file

@ -1,4 +1,4 @@
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_slash_command::{ use assistant_slash_command::{
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
SlashCommandResult, SlashCommandResult,
@ -8,7 +8,7 @@ use language::{BufferSnapshot, LspAdapterDelegate};
use prompt_store::PromptStore; use prompt_store::PromptStore;
use std::{ use std::{
fmt::Write, fmt::Write,
sync::{atomic::AtomicBool, Arc}, sync::{Arc, atomic::AtomicBool},
}; };
use ui::prelude::*; use ui::prelude::*;
use workspace::Workspace; use workspace::Workspace;

View file

@ -1,5 +1,5 @@
use crate::file_command::{FileCommandMetadata, FileSlashCommand}; use crate::file_command::{FileCommandMetadata, FileSlashCommand};
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_slash_command::{ use assistant_slash_command::{
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
SlashCommandResult, SlashCommandResult,
@ -8,7 +8,7 @@ use collections::HashSet;
use futures::future; use futures::future;
use gpui::{App, Task, WeakEntity, Window}; use gpui::{App, Task, WeakEntity, Window};
use language::{BufferSnapshot, LspAdapterDelegate}; use language::{BufferSnapshot, LspAdapterDelegate};
use std::sync::{atomic::AtomicBool, Arc}; use std::sync::{Arc, atomic::AtomicBool};
use text::OffsetRangeExt; use text::OffsetRangeExt;
use ui::prelude::*; use ui::prelude::*;
use workspace::Workspace; use workspace::Workspace;

View file

@ -1,4 +1,4 @@
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_slash_command::{ use assistant_slash_command::{
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
SlashCommandResult, SlashCommandResult,
@ -14,11 +14,11 @@ use rope::Point;
use std::{ use std::{
fmt::Write, fmt::Write,
path::{Path, PathBuf}, path::{Path, PathBuf},
sync::{atomic::AtomicBool, Arc}, sync::{Arc, atomic::AtomicBool},
}; };
use ui::prelude::*; use ui::prelude::*;
use util::paths::PathMatcher;
use util::ResultExt; use util::ResultExt;
use util::paths::PathMatcher;
use workspace::Workspace; use workspace::Workspace;
use crate::create_label_for_command; use crate::create_label_for_command;

View file

@ -1,9 +1,9 @@
use std::path::Path; use std::path::Path;
use std::sync::atomic::AtomicBool;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use std::time::Duration; use std::time::Duration;
use anyhow::{anyhow, bail, Result}; use anyhow::{Result, anyhow, bail};
use assistant_slash_command::{ use assistant_slash_command::{
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
SlashCommandResult, SlashCommandResult,
@ -16,7 +16,7 @@ use indexed_docs::{
use language::{BufferSnapshot, LspAdapterDelegate}; use language::{BufferSnapshot, LspAdapterDelegate};
use project::{Project, ProjectPath}; use project::{Project, ProjectPath};
use ui::prelude::*; use ui::prelude::*;
use util::{maybe, ResultExt}; use util::{ResultExt, maybe};
use workspace::Workspace; use workspace::Workspace;
pub struct DocsSlashCommand; pub struct DocsSlashCommand;

View file

@ -1,16 +1,16 @@
use std::cell::RefCell; use std::cell::RefCell;
use std::rc::Rc; use std::rc::Rc;
use std::sync::atomic::AtomicBool;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use anyhow::{anyhow, bail, Context, Result}; use anyhow::{Context, Result, anyhow, bail};
use assistant_slash_command::{ use assistant_slash_command::{
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
SlashCommandResult, SlashCommandResult,
}; };
use futures::AsyncReadExt; use futures::AsyncReadExt;
use gpui::{Task, WeakEntity}; use gpui::{Task, WeakEntity};
use html_to_markdown::{convert_html_to_markdown, markdown, TagHandler}; use html_to_markdown::{TagHandler, convert_html_to_markdown, markdown};
use http_client::{AsyncBody, HttpClient, HttpClientWithUrl}; use http_client::{AsyncBody, HttpClient, HttpClientWithUrl};
use language::{BufferSnapshot, LspAdapterDelegate}; use language::{BufferSnapshot, LspAdapterDelegate};
use ui::prelude::*; use ui::prelude::*;

View file

@ -1,10 +1,10 @@
use anyhow::{anyhow, Context as _, Result}; use anyhow::{Context as _, Result, anyhow};
use assistant_slash_command::{ use assistant_slash_command::{
AfterCompletion, ArgumentCompletion, SlashCommand, SlashCommandContent, SlashCommandEvent, AfterCompletion, ArgumentCompletion, SlashCommand, SlashCommandContent, SlashCommandEvent,
SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult,
}; };
use futures::channel::mpsc;
use futures::Stream; use futures::Stream;
use futures::channel::mpsc;
use fuzzy::PathMatch; use fuzzy::PathMatch;
use gpui::{App, Entity, Task, WeakEntity}; use gpui::{App, Entity, Task, WeakEntity};
use language::{BufferSnapshot, CodeLabel, HighlightId, LineEnding, LspAdapterDelegate}; use language::{BufferSnapshot, CodeLabel, HighlightId, LineEnding, LspAdapterDelegate};
@ -15,7 +15,7 @@ use std::{
fmt::Write, fmt::Write,
ops::{Range, RangeInclusive}, ops::{Range, RangeInclusive},
path::{Path, PathBuf}, path::{Path, PathBuf},
sync::{atomic::AtomicBool, Arc}, sync::{Arc, atomic::AtomicBool},
}; };
use ui::prelude::*; use ui::prelude::*;
use util::ResultExt; use util::ResultExt;
@ -694,15 +694,21 @@ mod test {
assert_eq!(result.sections.len(), 7); assert_eq!(result.sections.len(), 7);
// Ensure that full file paths are included in the real output // Ensure that full file paths are included in the real output
assert!(result assert!(
.text result
.contains(separator!("zed/assets/themes/andromeda/LICENSE"))); .text
assert!(result .contains(separator!("zed/assets/themes/andromeda/LICENSE"))
.text );
.contains(separator!("zed/assets/themes/ayu/LICENSE"))); assert!(
assert!(result result
.text .text
.contains(separator!("zed/assets/themes/summercamp/LICENSE"))); .contains(separator!("zed/assets/themes/ayu/LICENSE"))
);
assert!(
result
.text
.contains(separator!("zed/assets/themes/summercamp/LICENSE"))
);
assert_eq!(result.sections[5].label, "summercamp"); assert_eq!(result.sections[5].label, "summercamp");

View file

@ -1,5 +1,5 @@
use std::sync::atomic::AtomicBool;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use anyhow::Result; use anyhow::Result;
use assistant_slash_command::{ use assistant_slash_command::{

View file

@ -1,4 +1,4 @@
use anyhow::{anyhow, Context as _, Result}; use anyhow::{Context as _, Result, anyhow};
use assistant_slash_command::{ use assistant_slash_command::{
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
SlashCommandResult, SlashCommandResult,
@ -6,7 +6,7 @@ use assistant_slash_command::{
use gpui::{Task, WeakEntity}; use gpui::{Task, WeakEntity};
use language::{BufferSnapshot, LspAdapterDelegate}; use language::{BufferSnapshot, LspAdapterDelegate};
use prompt_store::PromptStore; use prompt_store::PromptStore;
use std::sync::{atomic::AtomicBool, Arc}; use std::sync::{Arc, atomic::AtomicBool};
use ui::prelude::*; use ui::prelude::*;
use workspace::Workspace; use workspace::Workspace;

View file

@ -1,4 +1,4 @@
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_slash_command::{ use assistant_slash_command::{
ArgumentCompletion, SlashCommand, SlashCommandContent, SlashCommandEvent, ArgumentCompletion, SlashCommand, SlashCommandContent, SlashCommandEvent,
SlashCommandOutputSection, SlashCommandResult, SlashCommandOutputSection, SlashCommandResult,
@ -7,8 +7,8 @@ use editor::Editor;
use futures::StreamExt; use futures::StreamExt;
use gpui::{App, Context, SharedString, Task, WeakEntity, Window}; use gpui::{App, Context, SharedString, Task, WeakEntity, Window};
use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate}; use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate};
use std::sync::atomic::AtomicBool;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use ui::IconName; use ui::IconName;
use workspace::Workspace; use workspace::Workspace;

View file

@ -1,5 +1,5 @@
use std::sync::atomic::AtomicBool;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use std::time::Duration; use std::time::Duration;
use anyhow::Result; use anyhow::Result;
@ -11,8 +11,8 @@ use feature_flags::FeatureFlag;
use futures::channel::mpsc; use futures::channel::mpsc;
use gpui::{Task, WeakEntity}; use gpui::{Task, WeakEntity};
use language::{BufferSnapshot, LspAdapterDelegate}; use language::{BufferSnapshot, LspAdapterDelegate};
use smol::stream::StreamExt;
use smol::Timer; use smol::Timer;
use smol::stream::StreamExt;
use ui::prelude::*; use ui::prelude::*;
use workspace::Workspace; use workspace::Workspace;

View file

@ -1,4 +1,4 @@
use anyhow::{anyhow, Context as _, Result}; use anyhow::{Context as _, Result, anyhow};
use assistant_slash_command::{ use assistant_slash_command::{
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
SlashCommandResult, SlashCommandResult,

View file

@ -10,9 +10,9 @@ use gpui::{Task, WeakEntity};
use language::{BufferSnapshot, CodeLabel, HighlightId, LspAdapterDelegate}; use language::{BufferSnapshot, CodeLabel, HighlightId, LspAdapterDelegate};
use std::{ use std::{
path::PathBuf, path::PathBuf,
sync::{atomic::AtomicBool, Arc}, sync::{Arc, atomic::AtomicBool},
}; };
use ui::{prelude::*, ActiveTheme, App, Window}; use ui::{ActiveTheme, App, Window, prelude::*};
use util::ResultExt; use util::ResultExt;
use workspace::Workspace; use workspace::Workspace;

View file

@ -1,5 +1,5 @@
use std::sync::atomic::AtomicBool;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use anyhow::Result; use anyhow::Result;
use assistant_slash_command::{ use assistant_slash_command::{
@ -8,9 +8,9 @@ use assistant_slash_command::{
}; };
use gpui::{App, Entity, Task, WeakEntity}; use gpui::{App, Entity, Task, WeakEntity};
use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate}; use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate};
use terminal_view::{terminal_panel::TerminalPanel, TerminalView}; use terminal_view::{TerminalView, terminal_panel::TerminalPanel};
use ui::prelude::*; use ui::prelude::*;
use workspace::{dock::Panel, Workspace}; use workspace::{Workspace, dock::Panel};
use super::create_label_for_command; use super::create_label_for_command;

View file

@ -1,5 +1,5 @@
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Context as _, Result}; use anyhow::{Context as _, Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use gpui::{App, Entity, Task}; use gpui::{App, Entity, Task};
use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat};

View file

@ -1,5 +1,5 @@
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool, ToolWorkingSet}; use assistant_tool::{ActionLog, Tool, ToolWorkingSet};
use futures::future::join_all; use futures::future::join_all;
use gpui::{App, AppContext, Entity, Task}; use gpui::{App, AppContext, Entity, Task};

View file

@ -2,7 +2,7 @@ use std::fmt::{self, Write};
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use collections::IndexMap; use collections::IndexMap;
use gpui::{App, AsyncApp, Entity, Task}; use gpui::{App, AsyncApp, Entity, Task};

View file

@ -1,5 +1,5 @@
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use gpui::{App, AppContext, Entity, Task}; use gpui::{App, AppContext, Entity, Task};
use language_model::LanguageModelRequestMessage; use language_model::LanguageModelRequestMessage;

View file

@ -1,5 +1,5 @@
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use gpui::{App, Entity, Task}; use gpui::{App, Entity, Task};
use language_model::LanguageModelRequestMessage; use language_model::LanguageModelRequestMessage;

View file

@ -1,5 +1,5 @@
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use gpui::{App, Entity, Task}; use gpui::{App, Entity, Task};
use language_model::LanguageModelRequestMessage; use language_model::LanguageModelRequestMessage;

View file

@ -1,7 +1,7 @@
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use futures::{channel::mpsc, SinkExt, StreamExt}; use futures::{SinkExt, StreamExt, channel::mpsc};
use gpui::{App, AppContext, Entity, Task}; use gpui::{App, AppContext, Entity, Task};
use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat};
use project::{Project, ProjectPath}; use project::{Project, ProjectPath};

View file

@ -1,5 +1,5 @@
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use gpui::{App, Entity, Task}; use gpui::{App, Entity, Task};
use language::{DiagnosticSeverity, OffsetRangeExt}; use language::{DiagnosticSeverity, OffsetRangeExt};

View file

@ -3,11 +3,11 @@ pub mod log;
use crate::replace::{replace_exact, replace_with_flexible_indent}; use crate::replace::{replace_exact, replace_with_flexible_indent};
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Context, Result}; use anyhow::{Context, Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use collections::HashSet; use collections::HashSet;
use edit_action::{edit_model_prompt, EditAction, EditActionParser}; use edit_action::{EditAction, EditActionParser, edit_model_prompt};
use futures::{channel::mpsc, SinkExt, StreamExt}; use futures::{SinkExt, StreamExt, channel::mpsc};
use gpui::{App, AppContext, AsyncApp, Entity, Task}; use gpui::{App, AppContext, AsyncApp, Entity, Task};
use language_model::LanguageModelToolSchemaFormat; use language_model::LanguageModelToolSchemaFormat;
use language_model::{ use language_model::{

View file

@ -3,13 +3,13 @@ use std::path::Path;
use collections::HashSet; use collections::HashSet;
use feature_flags::FeatureFlagAppExt; use feature_flags::FeatureFlagAppExt;
use gpui::{ use gpui::{
actions, list, prelude::*, App, Empty, Entity, EventEmitter, FocusHandle, Focusable, Global, App, Empty, Entity, EventEmitter, FocusHandle, Focusable, Global, ListAlignment, ListState,
ListAlignment, ListState, SharedString, Subscription, Window, SharedString, Subscription, Window, actions, list, prelude::*,
}; };
use release_channel::ReleaseChannel; use release_channel::ReleaseChannel;
use settings::Settings; use settings::Settings;
use ui::prelude::*; use ui::prelude::*;
use workspace::{item::ItemEvent, Item, Workspace, WorkspaceId}; use workspace::{Item, Workspace, WorkspaceId, item::ItemEvent};
use super::edit_action::EditAction; use super::edit_action::EditAction;

View file

@ -3,11 +3,11 @@ use std::rc::Rc;
use std::sync::Arc; use std::sync::Arc;
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, bail, Context as _, Result}; use anyhow::{Context as _, Result, anyhow, bail};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use futures::AsyncReadExt as _; use futures::AsyncReadExt as _;
use gpui::{App, AppContext as _, Entity, Task}; use gpui::{App, AppContext as _, Entity, Task};
use html_to_markdown::{convert_html_to_markdown, markdown, TagHandler}; use html_to_markdown::{TagHandler, convert_html_to_markdown, markdown};
use http_client::{AsyncBody, HttpClientWithUrl}; use http_client::{AsyncBody, HttpClientWithUrl};
use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat};
use project::Project; use project::Project;

View file

@ -1,5 +1,5 @@
use crate::{replace::replace_with_flexible_indent, schema::json_schema_for}; use crate::{replace::replace_with_flexible_indent, schema::json_schema_for};
use anyhow::{anyhow, Context as _, Result}; use anyhow::{Context as _, Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use gpui::{App, AppContext, Entity, Task}; use gpui::{App, AppContext, Entity, Task};
use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat};

View file

@ -1,5 +1,5 @@
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use gpui::{App, Entity, Task}; use gpui::{App, Entity, Task};
use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat};

View file

@ -1,5 +1,5 @@
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use gpui::{App, AppContext, Entity, Task}; use gpui::{App, AppContext, Entity, Task};
use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat};

View file

@ -1,7 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use chrono::{Local, Utc}; use chrono::{Local, Utc};
use gpui::{App, Entity, Task}; use gpui::{App, Entity, Task};

View file

@ -1,5 +1,5 @@
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Context as _, Result}; use anyhow::{Context as _, Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use gpui::{App, AppContext, Entity, Task}; use gpui::{App, AppContext, Entity, Task};
use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat};

View file

@ -1,5 +1,5 @@
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use gpui::{App, AppContext, Entity, Task}; use gpui::{App, AppContext, Entity, Task};
use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat};

View file

@ -2,7 +2,7 @@ use std::path::Path;
use std::sync::Arc; use std::sync::Arc;
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use gpui::{App, Entity, Task}; use gpui::{App, Entity, Task};
use itertools::Itertools; use itertools::Itertools;

View file

@ -1,13 +1,13 @@
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use futures::StreamExt; use futures::StreamExt;
use gpui::{App, Entity, Task}; use gpui::{App, Entity, Task};
use language::OffsetRangeExt; use language::OffsetRangeExt;
use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat};
use project::{ use project::{
search::{SearchQuery, SearchResult},
Project, Project,
search::{SearchQuery, SearchResult},
}; };
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View file

@ -1,7 +1,7 @@
use language::{BufferSnapshot, Diff, Point, ToOffset}; use language::{BufferSnapshot, Diff, Point, ToOffset};
use project::search::SearchQuery; use project::search::SearchQuery;
use std::iter; use std::iter;
use util::{paths::PathMatcher, ResultExt as _}; use util::{ResultExt as _, paths::PathMatcher};
/// Performs an exact string replacement in a buffer, requiring precise character-for-character matching. /// Performs an exact string replacement in a buffer, requiring precise character-for-character matching.
/// Uses the search functionality to locate the first occurrence of the exact string. /// Uses the search functionality to locate the first occurrence of the exact string.
@ -151,8 +151,8 @@ fn lines_with_min_indent(input: &str) -> (Vec<&str>, usize) {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use gpui::prelude::*;
use gpui::TestAppContext; use gpui::TestAppContext;
use gpui::prelude::*;
use unindent::Unindent; use unindent::Unindent;
#[gpui::test] #[gpui::test]

View file

@ -1,8 +1,8 @@
use anyhow::Result; use anyhow::Result;
use language_model::LanguageModelToolSchemaFormat; use language_model::LanguageModelToolSchemaFormat;
use schemars::{ use schemars::{
schema::{RootSchema, Schema, SchemaObject},
JsonSchema, JsonSchema,
schema::{RootSchema, Schema, SchemaObject},
}; };
pub fn json_schema_for<T: JsonSchema>(format: LanguageModelToolSchemaFormat) -> serde_json::Value { pub fn json_schema_for<T: JsonSchema>(format: LanguageModelToolSchemaFormat) -> serde_json::Value {

View file

@ -1,4 +1,4 @@
use anyhow::{anyhow, Context as _, Result}; use anyhow::{Context as _, Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use gpui::{App, AsyncApp, Entity, Task}; use gpui::{App, AsyncApp, Entity, Task};
use language::{self, Anchor, Buffer, BufferSnapshot, Location, Point, ToPoint, ToPointUtf16}; use language::{self, Anchor, Buffer, BufferSnapshot, Location, Point, ToPoint, ToPointUtf16};

View file

@ -1,7 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use crate::schema::json_schema_for; use crate::schema::json_schema_for;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool}; use assistant_tool::{ActionLog, Tool};
use gpui::{App, Entity, Task}; use gpui::{App, Entity, Task};
use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat};

View file

@ -4,8 +4,8 @@ use anyhow::Result;
use collections::HashMap; use collections::HashMap;
use gpui::{App, AssetSource, Global}; use gpui::{App, AssetSource, Global};
use rodio::{ use rodio::{
source::{Buffered, SamplesConverter},
Decoder, Source, Decoder, Source,
source::{Buffered, SamplesConverter},
}; };
type Sound = Buffered<SamplesConverter<Decoder<Cursor<Vec<u8>>>, f32>>; type Sound = Buffered<SamplesConverter<Decoder<Cursor<Vec<u8>>>, f32>>;

View file

@ -1,9 +1,9 @@
use anyhow::{anyhow, Context as _, Result}; use anyhow::{Context as _, Result, anyhow};
use client::{Client, TelemetrySettings}; use client::{Client, TelemetrySettings};
use db::kvp::KEY_VALUE_STORE;
use db::RELEASE_CHANNEL; use db::RELEASE_CHANNEL;
use db::kvp::KEY_VALUE_STORE;
use gpui::{ use gpui::{
actions, App, AppContext as _, AsyncApp, Context, Entity, Global, SemanticVersion, Task, Window, App, AppContext as _, AsyncApp, Context, Entity, Global, SemanticVersion, Task, Window, actions,
}; };
use http_client::{AsyncBody, HttpClient, HttpClientWithUrl}; use http_client::{AsyncBody, HttpClient, HttpClientWithUrl};
use paths::remote_servers_dir; use paths::remote_servers_dir;
@ -252,9 +252,11 @@ impl AutoUpdater {
} }
pub fn start_polling(&self, cx: &mut Context<Self>) -> Task<Result<()>> { pub fn start_polling(&self, cx: &mut Context<Self>) -> Task<Result<()>> {
cx.spawn(async move |this, cx| loop { cx.spawn(async move |this, cx| {
this.update(cx, |this, cx| this.poll(cx))?; loop {
cx.background_executor().timer(POLL_INTERVAL).await; this.update(cx, |this, cx| this.poll(cx))?;
cx.background_executor().timer(POLL_INTERVAL).await;
}
}) })
} }

View file

@ -1,16 +1,16 @@
use auto_update::AutoUpdater; use auto_update::AutoUpdater;
use client::proto::UpdateNotification; use client::proto::UpdateNotification;
use editor::{Editor, MultiBuffer}; use editor::{Editor, MultiBuffer};
use gpui::{actions, prelude::*, App, Context, DismissEvent, Entity, SharedString, Window}; use gpui::{App, Context, DismissEvent, Entity, SharedString, Window, actions, prelude::*};
use http_client::HttpClient; use http_client::HttpClient;
use markdown_preview::markdown_preview_view::{MarkdownPreviewMode, MarkdownPreviewView}; use markdown_preview::markdown_preview_view::{MarkdownPreviewMode, MarkdownPreviewView};
use release_channel::{AppVersion, ReleaseChannel}; use release_channel::{AppVersion, ReleaseChannel};
use serde::Deserialize; use serde::Deserialize;
use smol::io::AsyncReadExt; use smol::io::AsyncReadExt;
use util::ResultExt as _; use util::ResultExt as _;
use workspace::notifications::simple_message_notification::MessageNotification;
use workspace::notifications::{show_app_notification, NotificationId};
use workspace::Workspace; use workspace::Workspace;
use workspace::notifications::simple_message_notification::MessageNotification;
use workspace::notifications::{NotificationId, show_app_notification};
actions!(auto_update, [ViewReleaseNotesLocally]); actions!(auto_update, [ViewReleaseNotesLocally]);

View file

@ -2,7 +2,7 @@ mod models;
use std::pin::Pin; use std::pin::Pin;
use anyhow::{anyhow, Context, Error, Result}; use anyhow::{Context, Error, Result, anyhow};
use aws_sdk_bedrockruntime as bedrock; use aws_sdk_bedrockruntime as bedrock;
pub use aws_sdk_bedrockruntime as bedrock_client; pub use aws_sdk_bedrockruntime as bedrock_client;
pub use aws_sdk_bedrockruntime::types::{ pub use aws_sdk_bedrockruntime::types::{

View file

@ -6,10 +6,10 @@ use gpui::{
use itertools::Itertools; use itertools::Itertools;
use std::cmp; use std::cmp;
use theme::ActiveTheme; use theme::ActiveTheme;
use ui::{prelude::*, ButtonLike, ButtonStyle, Label, Tooltip}; use ui::{ButtonLike, ButtonStyle, Label, Tooltip, prelude::*};
use workspace::{ use workspace::{
item::{BreadcrumbText, ItemEvent, ItemHandle},
ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView,
item::{BreadcrumbText, ItemEvent, ItemHandle},
}; };
pub struct Breadcrumbs { pub struct Breadcrumbs {

View file

@ -1296,7 +1296,7 @@ mod tests {
use super::*; use super::*;
use gpui::TestAppContext; use gpui::TestAppContext;
use pretty_assertions::{assert_eq, assert_ne}; use pretty_assertions::{assert_eq, assert_ne};
use rand::{rngs::StdRng, Rng as _}; use rand::{Rng as _, rngs::StdRng};
use text::{Buffer, BufferId, Rope}; use text::{Buffer, BufferId, Rope};
use unindent::Unindent as _; use unindent::Unindent as _;
use util::test::marked_text_ranges; use util::test::marked_text_ranges;

View file

@ -2,11 +2,11 @@ pub mod participant;
pub mod room; pub mod room;
use crate::call_settings::CallSettings; use crate::call_settings::CallSettings;
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use audio::Audio; use audio::Audio;
use client::{proto, ChannelId, Client, TypedEnvelope, User, UserStore, ZED_ALWAYS_ACTIVE}; use client::{ChannelId, Client, TypedEnvelope, User, UserStore, ZED_ALWAYS_ACTIVE, proto};
use collections::HashSet; use collections::HashSet;
use futures::{channel::oneshot, future::Shared, Future, FutureExt}; use futures::{Future, FutureExt, channel::oneshot, future::Shared};
use gpui::{ use gpui::{
App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, Subscription, Task, App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, Subscription, Task,
WeakEntity, WeakEntity,

View file

@ -1,5 +1,5 @@
use anyhow::{anyhow, Result}; use anyhow::{Result, anyhow};
use client::{proto, ParticipantIndex, User}; use client::{ParticipantIndex, User, proto};
use collections::HashMap; use collections::HashMap;
use gpui::WeakEntity; use gpui::WeakEntity;
use livekit_client::AudioStream; use livekit_client::AudioStream;

Some files were not shown because too many files have changed in this diff Show more