diff --git a/Cargo.toml b/Cargo.toml index 5535c89196..bbec1874f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -198,7 +198,7 @@ default-members = ["crates/zed"] [workspace.package] publish = false -edition = "2021" +edition = "2024" [workspace.dependencies] diff --git a/crates/activity_indicator/src/activity_indicator.rs b/crates/activity_indicator/src/activity_indicator.rs index dbe3596a43..8a0df784a8 100644 --- a/crates/activity_indicator/src/activity_indicator.rs +++ b/crates/activity_indicator/src/activity_indicator.rs @@ -3,9 +3,9 @@ use editor::Editor; use extension_host::ExtensionStore; use futures::StreamExt; use gpui::{ - actions, percentage, Animation, AnimationExt as _, App, Context, CursorStyle, Entity, - EventEmitter, InteractiveElement as _, ParentElement as _, Render, SharedString, - StatefulInteractiveElement, Styled, Transformation, Window, + Animation, AnimationExt as _, App, Context, CursorStyle, Entity, EventEmitter, + InteractiveElement as _, ParentElement as _, Render, SharedString, StatefulInteractiveElement, + Styled, Transformation, Window, actions, percentage, }; use language::{BinaryStatus, LanguageRegistry, LanguageServerId}; use project::{ @@ -14,9 +14,9 @@ use project::{ }; use smallvec::SmallVec; 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 workspace::{item::ItemHandle, StatusItemView, Workspace}; +use workspace::{StatusItemView, Workspace, item::ItemHandle}; actions!(activity_indicator, [ShowErrorMessage]); diff --git a/crates/anthropic/src/anthropic.rs b/crates/anthropic/src/anthropic.rs index b4dd343d07..3345765643 100644 --- a/crates/anthropic/src/anthropic.rs +++ b/crates/anthropic/src/anthropic.rs @@ -2,9 +2,9 @@ mod supported_countries; use std::{pin::Pin, str::FromStr}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; 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::{AsyncBody, HttpClient, Method, Request as HttpRequest}; use serde::{Deserialize, Serialize}; diff --git a/crates/askpass/src/askpass.rs b/crates/askpass/src/askpass.rs index cc2d235c03..ee7dd9bc0e 100644 --- a/crates/askpass/src/askpass.rs +++ b/crates/askpass/src/askpass.rs @@ -5,9 +5,9 @@ use std::time::Duration; use anyhow::Context as _; use futures::channel::{mpsc, oneshot}; #[cfg(unix)] -use futures::{io::BufReader, AsyncBufReadExt as _}; +use futures::{AsyncBufReadExt as _, io::BufReader}; #[cfg(unix)] -use futures::{select_biased, AsyncWriteExt as _, FutureExt as _}; +use futures::{AsyncWriteExt as _, FutureExt as _, select_biased}; use futures::{SinkExt, StreamExt}; use gpui::{AsyncApp, BackgroundExecutor, Task}; #[cfg(unix)] diff --git a/crates/assets/src/assets.rs b/crates/assets/src/assets.rs index 8f8831269b..5ad0cb7954 100644 --- a/crates/assets/src/assets.rs +++ b/crates/assets/src/assets.rs @@ -57,10 +57,11 @@ impl Assets { pub fn load_test_fonts(&self, cx: &App) { cx.text_system() - .add_fonts(vec![self - .load("fonts/plex-mono/ZedPlexMono-Regular.ttf") - .unwrap() - .unwrap()]) + .add_fonts(vec![ + self.load("fonts/plex-mono/ZedPlexMono-Regular.ttf") + .unwrap() + .unwrap(), + ]) .unwrap() } } diff --git a/crates/assistant/src/assistant.rs b/crates/assistant/src/assistant.rs index a236d1ff72..093713d2e7 100644 --- a/crates/assistant/src/assistant.rs +++ b/crates/assistant/src/assistant.rs @@ -14,7 +14,7 @@ use client::Client; use command_palette_hooks::CommandPaletteFilter; use feature_flags::FeatureFlagAppExt; use fs::Fs; -use gpui::{actions, App, Global, ReadGlobal, UpdateGlobal}; +use gpui::{App, Global, ReadGlobal, UpdateGlobal, actions}; use language_model::{ LanguageModelId, LanguageModelProviderId, LanguageModelRegistry, LanguageModelResponseMessage, }; diff --git a/crates/assistant/src/assistant_configuration.rs b/crates/assistant/src/assistant_configuration.rs index 711f4d98b8..cb3d268a63 100644 --- a/crates/assistant/src/assistant_configuration.rs +++ b/crates/assistant/src/assistant_configuration.rs @@ -1,9 +1,9 @@ use std::sync::Arc; 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 ui::{prelude::*, ElevationIndex}; +use ui::{ElevationIndex, prelude::*}; use workspace::Item; pub struct ConfigurationView { diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rs index 520d6f850a..1bb1ac0896 100644 --- a/crates/assistant/src/assistant_panel.rs +++ b/crates/assistant/src/assistant_panel.rs @@ -1,43 +1,44 @@ -use crate::assistant_configuration::{ConfigurationView, ConfigurationViewEvent}; use crate::Assistant; +use crate::assistant_configuration::{ConfigurationView, ConfigurationViewEvent}; 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::{ - make_lsp_adapter_delegate, AssistantContext, AssistantPanelDelegate, ContextEditor, - ContextEditorToolbarItem, ContextEditorToolbarItemEvent, ContextHistory, ContextId, - ContextStore, ContextStoreEvent, InsertDraggedFiles, SlashCommandCompletionProvider, - DEFAULT_TAB_TITLE, + AssistantContext, AssistantPanelDelegate, ContextEditor, ContextEditorToolbarItem, + ContextEditorToolbarItemEvent, ContextHistory, ContextId, ContextStore, ContextStoreEvent, + DEFAULT_TAB_TITLE, InsertDraggedFiles, SlashCommandCompletionProvider, + make_lsp_adapter_delegate, }; use assistant_settings::{AssistantDockPosition, AssistantSettings}; use assistant_slash_command::SlashCommandWorkingSet; -use client::{proto, Client, Status}; +use client::{Client, Status, proto}; use editor::{Editor, EditorEvent}; use fs::Fs; use gpui::{ - prelude::*, Action, App, AsyncWindowContext, Entity, EventEmitter, ExternalPaths, FocusHandle, - Focusable, InteractiveElement, IntoElement, ParentElement, Pixels, Render, Styled, - Subscription, Task, UpdateGlobal, WeakEntity, + Action, App, AsyncWindowContext, Entity, EventEmitter, ExternalPaths, FocusHandle, Focusable, + InteractiveElement, IntoElement, ParentElement, Pixels, Render, Styled, Subscription, Task, + UpdateGlobal, WeakEntity, prelude::*, }; use language::LanguageRegistry; use language_model::{ AuthenticateError, LanguageModelProviderId, LanguageModelRegistry, ZED_CLOUD_PROVIDER_ID, }; use project::Project; -use prompt_library::{open_prompt_library, PromptLibrary}; +use prompt_library::{PromptLibrary, open_prompt_library}; use prompt_store::PromptBuilder; -use search::{buffer_search::DivRegistrar, BufferSearchBar}; -use settings::{update_settings_file, Settings}; +use search::{BufferSearchBar, buffer_search::DivRegistrar}; +use settings::{Settings, update_settings_file}; use smol::stream::StreamExt; use std::{ops::ControlFlow, path::PathBuf, sync::Arc}; -use terminal_view::{terminal_panel::TerminalPanel, TerminalView}; -use ui::{prelude::*, ContextMenu, PopoverMenu, Tooltip}; -use util::{maybe, ResultExt}; +use terminal_view::{TerminalView, terminal_panel::TerminalPanel}; +use ui::{ContextMenu, PopoverMenu, Tooltip, prelude::*}; +use util::{ResultExt, maybe}; use workspace::DraggedTab; use workspace::{ + DraggedSelection, Pane, ShowConfiguration, ToggleZoom, Workspace, dock::{DockPosition, Panel, PanelEvent}, - pane, DraggedSelection, Pane, ShowConfiguration, ToggleZoom, Workspace, + pane, }; use zed_actions::assistant::{InlineAssist, OpenPromptLibrary, ToggleFocus}; diff --git a/crates/assistant/src/inline_assistant.rs b/crates/assistant/src/inline_assistant.rs index da6fd986cd..45f426b3bb 100644 --- a/crates/assistant/src/inline_assistant.rs +++ b/crates/assistant/src/inline_assistant.rs @@ -2,39 +2,40 @@ use crate::{ Assistant, AssistantPanel, AssistantPanelEvent, CycleNextInlineAssist, CyclePreviousInlineAssist, }; -use anyhow::{anyhow, Context as _, Result}; -use assistant_context_editor::{humanize_token_count, RequestType}; +use anyhow::{Context as _, Result, anyhow}; +use assistant_context_editor::{RequestType, humanize_token_count}; use assistant_settings::AssistantSettings; -use client::{telemetry::Telemetry, ErrorExt}; -use collections::{hash_map, HashMap, HashSet, VecDeque}; +use client::{ErrorExt, telemetry::Telemetry}; +use collections::{HashMap, HashSet, VecDeque, hash_map}; use editor::{ + Anchor, AnchorRangeExt, CodeActionProvider, Editor, EditorElement, EditorEvent, EditorMode, + EditorStyle, ExcerptId, ExcerptRange, GutterDimensions, MultiBuffer, MultiBufferSnapshot, + ToOffset as _, ToPoint, actions::{MoveDown, MoveUp, SelectAll}, display_map::{ BlockContext, BlockPlacement, BlockProperties, BlockStyle, CustomBlockId, RenderBlock, ToDisplayPoint, }, - Anchor, AnchorRangeExt, CodeActionProvider, Editor, EditorElement, EditorEvent, EditorMode, - EditorStyle, ExcerptId, ExcerptRange, GutterDimensions, MultiBuffer, MultiBufferSnapshot, - ToOffset as _, ToPoint, }; use feature_flags::{ Assistant2FeatureFlag, FeatureFlagAppExt as _, FeatureFlagViewExt as _, ZedPro, }; use fs::Fs; use futures::{ + SinkExt, Stream, StreamExt, channel::mpsc, future::{BoxFuture, LocalBoxFuture}, - join, SinkExt, Stream, StreamExt, + join, }; use gpui::{ - anchored, deferred, point, AnyElement, App, ClickEvent, Context, CursorStyle, Entity, - EventEmitter, FocusHandle, Focusable, FontWeight, Global, HighlightStyle, Subscription, Task, - TextStyle, UpdateGlobal, WeakEntity, Window, + AnyElement, App, ClickEvent, Context, CursorStyle, Entity, EventEmitter, FocusHandle, + Focusable, FontWeight, Global, HighlightStyle, Subscription, Task, TextStyle, UpdateGlobal, + 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::{ - report_assistant_event, LanguageModel, LanguageModelRegistry, LanguageModelRequest, - LanguageModelRequestMessage, LanguageModelTextStream, Role, + LanguageModel, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, + LanguageModelTextStream, Role, report_assistant_event, }; use language_model_selector::{LanguageModelSelector, LanguageModelSelectorPopoverMenu}; use multi_buffer::MultiBufferRow; @@ -42,7 +43,7 @@ use parking_lot::Mutex; use project::{CodeAction, LspAction, ProjectTransaction}; use prompt_store::PromptBuilder; use rope::Rope; -use settings::{update_settings_file, Settings, SettingsStore}; +use settings::{Settings, SettingsStore, update_settings_file}; use smol::future::FutureExt; use std::{ cmp, @@ -61,10 +62,10 @@ use terminal_view::terminal_panel::TerminalPanel; use text::{OffsetRangeExt, ToPoint as _}; use theme::ThemeSettings; 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 workspace::{notifications::NotificationId, ItemHandle, Toast, Workspace}; +use workspace::{ItemHandle, Toast, Workspace, notifications::NotificationId}; pub fn init( fs: Arc, @@ -3710,8 +3711,8 @@ mod tests { use gpui::TestAppContext; use indoc::indoc; use language::{ - language_settings, tree_sitter_rust, Buffer, Language, LanguageConfig, LanguageMatcher, - Point, + Buffer, Language, LanguageConfig, LanguageMatcher, Point, language_settings, + tree_sitter_rust, }; use language_model::{LanguageModelRegistry, TokenUsage}; use rand::prelude::*; diff --git a/crates/assistant/src/terminal_inline_assistant.rs b/crates/assistant/src/terminal_inline_assistant.rs index b3132d44f2..3c561cf1d8 100644 --- a/crates/assistant/src/terminal_inline_assistant.rs +++ b/crates/assistant/src/terminal_inline_assistant.rs @@ -1,27 +1,27 @@ use crate::{AssistantPanel, AssistantPanelEvent, DEFAULT_CONTEXT_LINES}; 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 client::telemetry::Telemetry; use collections::{HashMap, VecDeque}; use editor::{ - actions::{MoveDown, MoveUp, SelectAll}, Editor, EditorElement, EditorEvent, EditorMode, EditorStyle, MultiBuffer, + actions::{MoveDown, MoveUp, SelectAll}, }; use fs::Fs; -use futures::{channel::mpsc, SinkExt, StreamExt}; +use futures::{SinkExt, StreamExt, channel::mpsc}; use gpui::{ App, Context, Entity, EventEmitter, FocusHandle, Focusable, Global, Subscription, Task, TextStyle, UpdateGlobal, WeakEntity, }; use language::Buffer; use language_model::{ - report_assistant_event, LanguageModelRegistry, LanguageModelRequest, - LanguageModelRequestMessage, Role, + LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, Role, + report_assistant_event, }; use language_model_selector::{LanguageModelSelector, LanguageModelSelectorPopoverMenu}; use prompt_store::PromptBuilder; -use settings::{update_settings_file, Settings}; +use settings::{Settings, update_settings_file}; use std::{ cmp, sync::Arc, @@ -31,9 +31,9 @@ use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase}; use terminal::Terminal; use terminal_view::TerminalView; use theme::ThemeSettings; -use ui::{prelude::*, text_for_action, IconButtonShape, Tooltip}; +use ui::{IconButtonShape, Tooltip, prelude::*, text_for_action}; use util::ResultExt; -use workspace::{notifications::NotificationId, Toast, Workspace}; +use workspace::{Toast, Workspace, notifications::NotificationId}; pub fn init( fs: Arc, diff --git a/crates/assistant2/src/active_thread.rs b/crates/assistant2/src/active_thread.rs index 1ded4c9615..58db8f307f 100644 --- a/crates/assistant2/src/active_thread.rs +++ b/crates/assistant2/src/active_thread.rs @@ -1,3 +1,4 @@ +use crate::AssistantPanel; use crate::context::{AssistantContext, ContextId}; use crate::thread::{ LastRestoreCheckpoint, MessageId, MessageSegment, RequestKind, Thread, ThreadError, @@ -6,16 +7,15 @@ use crate::thread::{ use crate::thread_store::ThreadStore; use crate::tool_use::{PendingToolUseStatus, ToolUse, ToolUseStatus}; use crate::ui::{AgentNotification, AgentNotificationEvent, ContextPill}; -use crate::AssistantPanel; use assistant_settings::{AssistantSettings, NotifyWhenAgentWaiting}; use collections::HashMap; use editor::{Editor, MultiBuffer}; use gpui::{ - linear_color_stop, linear_gradient, list, percentage, pulsating_between, AbsoluteLength, - Animation, AnimationExt, AnyElement, App, ClickEvent, DefiniteLength, EdgesRefinement, Empty, - Entity, Focusable, Hsla, Length, ListAlignment, ListState, MouseButton, PlatformDisplay, - ScrollHandle, Stateful, StyleRefinement, Subscription, Task, TextStyleRefinement, - Transformation, UnderlineStyle, WeakEntity, WindowHandle, + AbsoluteLength, Animation, AnimationExt, AnyElement, App, ClickEvent, DefiniteLength, + EdgesRefinement, Empty, Entity, Focusable, Hsla, Length, ListAlignment, ListState, MouseButton, + PlatformDisplay, ScrollHandle, Stateful, StyleRefinement, Subscription, Task, + TextStyleRefinement, Transformation, UnderlineStyle, WeakEntity, WindowHandle, + linear_color_stop, linear_gradient, list, percentage, pulsating_between, }; use language::{Buffer, LanguageRegistry}; use language_model::{LanguageModelRegistry, LanguageModelToolUseId, Role}; @@ -27,11 +27,11 @@ use std::sync::Arc; use std::time::Duration; use text::ToPoint; 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 workspace::{OpenOptions, Workspace}; -use crate::context_store::{refresh_context_store_text, ContextStore}; +use crate::context_store::{ContextStore, refresh_context_store_text}; pub struct ActiveThread { language_registry: Arc, diff --git a/crates/assistant2/src/assistant.rs b/crates/assistant2/src/assistant.rs index ff17faa465..4e8be9f881 100644 --- a/crates/assistant2/src/assistant.rs +++ b/crates/assistant2/src/assistant.rs @@ -28,7 +28,7 @@ use client::Client; use command_palette_hooks::CommandPaletteFilter; use feature_flags::{Assistant2FeatureFlag, FeatureFlagAppExt}; use fs::Fs; -use gpui::{actions, impl_actions, App}; +use gpui::{App, actions, impl_actions}; use prompt_store::PromptBuilder; use schemars::JsonSchema; use serde::Deserialize; diff --git a/crates/assistant2/src/assistant_configuration.rs b/crates/assistant2/src/assistant_configuration.rs index 8fca785606..1b6b096ee4 100644 --- a/crates/assistant2/src/assistant_configuration.rs +++ b/crates/assistant2/src/assistant_configuration.rs @@ -9,7 +9,7 @@ use collections::HashMap; use context_server::manager::ContextServerManager; use gpui::{Action, AnyView, App, Entity, EventEmitter, FocusHandle, Focusable, Subscription}; 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 zed_actions::ExtensionCategoryFilter; diff --git a/crates/assistant2/src/assistant_configuration/add_context_server_modal.rs b/crates/assistant2/src/assistant_configuration/add_context_server_modal.rs index 1cfb97f4be..cc1f97a643 100644 --- a/crates/assistant2/src/assistant_configuration/add_context_server_modal.rs +++ b/crates/assistant2/src/assistant_configuration/add_context_server_modal.rs @@ -1,9 +1,9 @@ use context_server::{ContextServerSettings, ServerCommand, ServerConfig}; 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 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 crate::AddContextServer; diff --git a/crates/assistant2/src/assistant_configuration/manage_profiles_modal.rs b/crates/assistant2/src/assistant_configuration/manage_profiles_modal.rs index e45af2d37e..434f44d97d 100644 --- a/crates/assistant2/src/assistant_configuration/manage_profiles_modal.rs +++ b/crates/assistant2/src/assistant_configuration/manage_profiles_modal.rs @@ -11,12 +11,12 @@ use convert_case::{Case, Casing as _}; use editor::Editor; use fs::Fs; use gpui::{ - prelude::*, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Subscription, - WeakEntity, + DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Subscription, WeakEntity, + prelude::*, }; -use settings::{update_settings_file, Settings as _}; +use settings::{Settings as _, update_settings_file}; use ui::{ - prelude::*, KeyBinding, ListItem, ListItemSpacing, ListSeparator, Navigable, NavigableEntry, + KeyBinding, ListItem, ListItemSpacing, ListSeparator, Navigable, NavigableEntry, prelude::*, }; use workspace::{ModalView, Workspace}; diff --git a/crates/assistant2/src/assistant_configuration/tool_picker.rs b/crates/assistant2/src/assistant_configuration/tool_picker.rs index 210c8cf8c6..5c1ca4bed5 100644 --- a/crates/assistant2/src/assistant_configuration/tool_picker.rs +++ b/crates/assistant2/src/assistant_configuration/tool_picker.rs @@ -6,11 +6,11 @@ use assistant_settings::{ }; use assistant_tool::{ToolSource, ToolWorkingSet}; 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 picker::{Picker, PickerDelegate}; -use settings::{update_settings_file, Settings as _}; -use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; +use settings::{Settings as _, update_settings_file}; +use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt as _; use crate::ThreadStore; diff --git a/crates/assistant2/src/assistant_diff.rs b/crates/assistant2/src/assistant_diff.rs index 5d4f4dc515..3227866339 100644 --- a/crates/assistant2/src/assistant_diff.rs +++ b/crates/assistant2/src/assistant_diff.rs @@ -3,12 +3,12 @@ use anyhow::Result; use buffer_diff::DiffHunkStatus; use collections::HashSet; use editor::{ - actions::{GoToHunk, GoToPreviousHunk}, Direction, Editor, EditorEvent, MultiBuffer, ToPoint, + actions::{GoToHunk, GoToPreviousHunk}, }; use gpui::{ - prelude::*, Action, AnyElement, AnyView, App, Entity, EventEmitter, FocusHandle, Focusable, - SharedString, Subscription, Task, WeakEntity, Window, + Action, AnyElement, AnyView, App, Entity, EventEmitter, FocusHandle, Focusable, SharedString, + Subscription, Task, WeakEntity, Window, prelude::*, }; use language::{Capability, DiskState, OffsetRangeExt, Point}; use multi_buffer::PathKey; @@ -18,12 +18,12 @@ use std::{ ops::Range, sync::Arc, }; -use ui::{prelude::*, IconButtonShape, KeyBinding, Tooltip}; +use ui::{IconButtonShape, KeyBinding, Tooltip, prelude::*}; use workspace::{ - item::{BreadcrumbText, ItemEvent, TabContentParams}, - searchable::SearchableItemHandle, Item, ItemHandle, ItemNavHistory, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, + item::{BreadcrumbText, ItemEvent, TabContentParams}, + searchable::SearchableItemHandle, }; pub struct AssistantDiff { @@ -566,25 +566,27 @@ fn render_diff_hunk_controls( }), ] } else { - vec![Button::new(("review", row as u64), "Review") - .key_binding(KeyBinding::for_action_in( - &ToggleKeep, - &editor.read(cx).focus_handle(cx), - window, - cx, - )) - .on_click({ - let assistant_diff = assistant_diff.clone(); - move |_event, _window, cx| { - assistant_diff.update(cx, |diff, cx| { - diff.review_diff_hunks( - vec![hunk_range.start..hunk_range.start], - false, - cx, - ); - }); - } - })] + vec![ + Button::new(("review", row as u64), "Review") + .key_binding(KeyBinding::for_action_in( + &ToggleKeep, + &editor.read(cx).focus_handle(cx), + window, + cx, + )) + .on_click({ + let assistant_diff = assistant_diff.clone(); + move |_event, _window, cx| { + assistant_diff.update(cx, |diff, cx| { + diff.review_diff_hunks( + vec![hunk_range.start..hunk_range.start], + false, + cx, + ); + }); + } + }), + ] }) .when( !editor.read(cx).buffer().read(cx).all_diff_hunks_expanded(), diff --git a/crates/assistant2/src/assistant_model_selector.rs b/crates/assistant2/src/assistant_model_selector.rs index 90c88cb547..a8da7ca16e 100644 --- a/crates/assistant2/src/assistant_model_selector.rs +++ b/crates/assistant2/src/assistant_model_selector.rs @@ -7,7 +7,7 @@ use language_model_selector::{ }; use settings::update_settings_file; use std::sync::Arc; -use ui::{prelude::*, ButtonLike, PopoverMenuHandle, Tooltip}; +use ui::{ButtonLike, PopoverMenuHandle, Tooltip, prelude::*}; pub struct AssistantModelSelector { selector: Entity, diff --git a/crates/assistant2/src/assistant_panel.rs b/crates/assistant2/src/assistant_panel.rs index 40d0cd1f05..c4f9bf7478 100644 --- a/crates/assistant2/src/assistant_panel.rs +++ b/crates/assistant2/src/assistant_panel.rs @@ -1,10 +1,10 @@ use std::path::PathBuf; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_context_editor::{ - make_lsp_adapter_delegate, render_remaining_tokens, AssistantPanelDelegate, ConfigurationError, - ContextEditor, SlashCommandCompletionProvider, + AssistantPanelDelegate, ConfigurationError, ContextEditor, SlashCommandCompletionProvider, + make_lsp_adapter_delegate, render_remaining_tokens, }; use assistant_settings::{AssistantDockPosition, AssistantSettings}; use assistant_slash_command::SlashCommandWorkingSet; @@ -14,21 +14,21 @@ use client::zed_urls; use editor::{Editor, MultiBuffer}; use fs::Fs; use gpui::{ - action_with_deprecated_aliases, prelude::*, Action, AnyElement, App, AsyncWindowContext, - Corner, Entity, EventEmitter, FocusHandle, Focusable, FontWeight, KeyContext, Pixels, - Subscription, Task, UpdateGlobal, WeakEntity, + Action, AnyElement, App, AsyncWindowContext, Corner, Entity, EventEmitter, FocusHandle, + Focusable, FontWeight, KeyContext, Pixels, Subscription, Task, UpdateGlobal, WeakEntity, + action_with_deprecated_aliases, prelude::*, }; use language::LanguageRegistry; use language_model::{LanguageModelProviderTosView, LanguageModelRegistry}; use project::Project; -use prompt_library::{open_prompt_library, PromptLibrary}; +use prompt_library::{PromptLibrary, open_prompt_library}; use prompt_store::PromptBuilder; -use settings::{update_settings_file, Settings}; +use settings::{Settings, update_settings_file}; 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 workspace::dock::{DockPosition, Panel, PanelEvent}; use workspace::Workspace; +use workspace::dock::{DockPosition, Panel, PanelEvent}; use zed_actions::assistant::ToggleFocus; use crate::active_thread::ActiveThread; diff --git a/crates/assistant2/src/buffer_codegen.rs b/crates/assistant2/src/buffer_codegen.rs index d13c31829b..5ba3e3d05e 100644 --- a/crates/assistant2/src/buffer_codegen.rs +++ b/crates/assistant2/src/buffer_codegen.rs @@ -5,12 +5,12 @@ use anyhow::{Context as _, Result}; use client::telemetry::Telemetry; use collections::HashSet; 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 language::{line_diff, Buffer, IndentKind, Point, TransactionId}; +use language::{Buffer, IndentKind, Point, TransactionId, line_diff}; use language_model::{ - report_assistant_event, LanguageModel, LanguageModelRegistry, LanguageModelRequest, - LanguageModelRequestMessage, LanguageModelTextStream, Role, + LanguageModel, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, + LanguageModelTextStream, Role, report_assistant_event, }; use multi_buffer::MultiBufferRow; use parking_lot::Mutex; @@ -1028,14 +1028,14 @@ impl Diff { mod tests { use super::*; use futures::{ - stream::{self}, Stream, + stream::{self}, }; use gpui::TestAppContext; use indoc::indoc; use language::{ - language_settings, tree_sitter_rust, Buffer, Language, LanguageConfig, LanguageMatcher, - Point, + Buffer, Language, LanguageConfig, LanguageMatcher, Point, language_settings, + tree_sitter_rust, }; use language_model::{LanguageModelRegistry, TokenUsage}; use rand::prelude::*; diff --git a/crates/assistant2/src/context_picker.rs b/crates/assistant2/src/context_picker.rs index 7e5537145a..bfbda8f1d7 100644 --- a/crates/assistant2/src/context_picker.rs +++ b/crates/assistant2/src/context_picker.rs @@ -8,7 +8,7 @@ use std::ops::Range; use std::path::PathBuf; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use editor::display_map::{Crease, FoldId}; use editor::{Anchor, AnchorRangeExt as _, Editor, ExcerptId, FoldPlaceholder, ToOffset}; use file_context_picker::render_file_context_entry; @@ -18,19 +18,19 @@ use gpui::{ use multi_buffer::MultiBufferRow; use project::ProjectPath; 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::{ - 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; use crate::context_picker::fetch_context_picker::FetchContextPicker; use crate::context_picker::file_context_picker::FileContextPicker; use crate::context_picker::thread_context_picker::ThreadContextPicker; use crate::context_store::ContextStore; use crate::thread_store::ThreadStore; -use crate::AssistantPanel; #[derive(Debug, Clone, Copy)] pub enum ConfirmBehavior { diff --git a/crates/assistant2/src/context_picker/completion_provider.rs b/crates/assistant2/src/context_picker/completion_provider.rs index 6105f294e5..0e54352619 100644 --- a/crates/assistant2/src/context_picker/completion_provider.rs +++ b/crates/assistant2/src/context_picker/completion_provider.rs @@ -2,8 +2,8 @@ use std::cell::RefCell; use std::ops::Range; use std::path::Path; use std::rc::Rc; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use anyhow::Result; use editor::{CompletionProvider, Editor, ExcerptId}; @@ -24,7 +24,7 @@ use crate::thread_store::ThreadStore; use super::fetch_context_picker::fetch_url_content; 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 { workspace: WeakEntity, diff --git a/crates/assistant2/src/context_picker/fetch_context_picker.rs b/crates/assistant2/src/context_picker/fetch_context_picker.rs index 1a4b943946..9cab02f4ae 100644 --- a/crates/assistant2/src/context_picker/fetch_context_picker.rs +++ b/crates/assistant2/src/context_picker/fetch_context_picker.rs @@ -2,13 +2,13 @@ use std::cell::RefCell; use std::rc::Rc; use std::sync::Arc; -use anyhow::{bail, Context as _, Result}; +use anyhow::{Context as _, Result, bail}; use futures::AsyncReadExt as _; 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 picker::{Picker, PickerDelegate}; -use ui::{prelude::*, Context, ListItem, Window}; +use ui::{Context, ListItem, Window, prelude::*}; use workspace::Workspace; use crate::context_picker::{ConfirmBehavior, ContextPicker}; @@ -163,11 +163,7 @@ impl PickerDelegate for FetchContextPickerDelegate { type ListItem = ListItem; fn match_count(&self) -> usize { - if self.url.is_empty() { - 0 - } else { - 1 - } + if self.url.is_empty() { 0 } else { 1 } } fn no_matches_text(&self, _window: &mut Window, _cx: &mut App) -> Option { diff --git a/crates/assistant2/src/context_picker/file_context_picker.rs b/crates/assistant2/src/context_picker/file_context_picker.rs index 388fdcbc9f..a96d0f986c 100644 --- a/crates/assistant2/src/context_picker/file_context_picker.rs +++ b/crates/assistant2/src/context_picker/file_context_picker.rs @@ -1,6 +1,6 @@ use std::path::Path; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use file_icons::FileIcons; use fuzzy::PathMatch; @@ -9,9 +9,9 @@ use gpui::{ }; use picker::{Picker, PickerDelegate}; use project::{PathMatchCandidateSet, ProjectPath, WorktreeId}; -use ui::{prelude::*, ListItem, Tooltip}; +use ui::{ListItem, Tooltip, prelude::*}; use util::ResultExt as _; -use workspace::{notifications::NotifyResultExt, Workspace}; +use workspace::{Workspace, notifications::NotifyResultExt}; use crate::context_picker::{ConfirmBehavior, ContextPicker}; use crate::context_store::{ContextStore, FileInclusion}; diff --git a/crates/assistant2/src/context_picker/symbol_context_picker.rs b/crates/assistant2/src/context_picker/symbol_context_picker.rs index d792467611..9c7056deca 100644 --- a/crates/assistant2/src/context_picker/symbol_context_picker.rs +++ b/crates/assistant2/src/context_picker/symbol_context_picker.rs @@ -1,6 +1,6 @@ use std::cmp::Reverse; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use anyhow::{Context as _, Result}; use fuzzy::{StringMatch, StringMatchCandidate}; @@ -11,7 +11,7 @@ use ordered_float::OrderedFloat; use picker::{Picker, PickerDelegate}; use project::{DocumentSymbol, Symbol}; use text::OffsetRangeExt; -use ui::{prelude::*, ListItem}; +use ui::{ListItem, prelude::*}; use util::ResultExt as _; use workspace::Workspace; diff --git a/crates/assistant2/src/context_picker/thread_context_picker.rs b/crates/assistant2/src/context_picker/thread_context_picker.rs index 4c51edae09..094209e9cf 100644 --- a/crates/assistant2/src/context_picker/thread_context_picker.rs +++ b/crates/assistant2/src/context_picker/thread_context_picker.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use fuzzy::StringMatchCandidate; use gpui::{App, DismissEvent, Entity, FocusHandle, Focusable, Task, WeakEntity}; use picker::{Picker, PickerDelegate}; -use ui::{prelude::*, ListItem}; +use ui::{ListItem, prelude::*}; use crate::context_picker::{ConfirmBehavior, ContextPicker}; use crate::context_store::{self, ContextStore}; diff --git a/crates/assistant2/src/context_store.rs b/crates/assistant2/src/context_store.rs index 5857a70b89..8c6488db63 100644 --- a/crates/assistant2/src/context_store.rs +++ b/crates/assistant2/src/context_store.rs @@ -2,9 +2,9 @@ use std::ops::Range; use std::path::{Path, PathBuf}; use std::sync::Arc; -use anyhow::{anyhow, bail, Result}; +use anyhow::{Result, anyhow, bail}; 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 language::Buffer; use project::{ProjectItem, ProjectPath, Worktree}; diff --git a/crates/assistant2/src/context_strip.rs b/crates/assistant2/src/context_strip.rs index 63d4ce6cbb..d98d131e75 100644 --- a/crates/assistant2/src/context_strip.rs +++ b/crates/assistant2/src/context_strip.rs @@ -9,8 +9,8 @@ use gpui::{ }; use itertools::Itertools; use language::Buffer; -use ui::{prelude::*, KeyBinding, PopoverMenu, PopoverMenuHandle, Tooltip}; -use workspace::{notifications::NotifyResultExt, Workspace}; +use ui::{KeyBinding, PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*}; +use workspace::{Workspace, notifications::NotifyResultExt}; use crate::context::{ContextId, ContextKind}; use crate::context_picker::{ConfirmBehavior, ContextPicker}; @@ -239,11 +239,7 @@ impl ContextStrip { let eraser = if bounds.len() < 3 { 0 } else { 1 }; let pills = &bounds[1..bounds.len() - eraser]; - if pills.is_empty() { - None - } else { - Some(pills) - } + if pills.is_empty() { None } else { Some(pills) } } fn last_pill_index(&self) -> Option { diff --git a/crates/assistant2/src/history_store.rs b/crates/assistant2/src/history_store.rs index 49f935314d..9fd3b5a098 100644 --- a/crates/assistant2/src/history_store.rs +++ b/crates/assistant2/src/history_store.rs @@ -1,6 +1,6 @@ use assistant_context_editor::SavedContextMetadata; use chrono::{DateTime, Utc}; -use gpui::{prelude::*, Entity}; +use gpui::{Entity, prelude::*}; use crate::thread_store::{SerializedThreadMetadata, ThreadStore}; diff --git a/crates/assistant2/src/inline_assistant.rs b/crates/assistant2/src/inline_assistant.rs index e31fa168b9..93b7616ffa 100644 --- a/crates/assistant2/src/inline_assistant.rs +++ b/crates/assistant2/src/inline_assistant.rs @@ -7,24 +7,24 @@ use std::sync::Arc; use anyhow::{Context as _, Result}; use assistant_settings::AssistantSettings; use client::telemetry::Telemetry; -use collections::{hash_map, HashMap, HashSet, VecDeque}; +use collections::{HashMap, HashSet, VecDeque, hash_map}; use editor::{ + Anchor, AnchorRangeExt, CodeActionProvider, Editor, EditorEvent, ExcerptId, ExcerptRange, + GutterDimensions, MultiBuffer, MultiBufferSnapshot, ToOffset as _, ToPoint, actions::SelectAll, display_map::{ BlockContext, BlockPlacement, BlockProperties, BlockStyle, CustomBlockId, RenderBlock, ToDisplayPoint, }, - Anchor, AnchorRangeExt, CodeActionProvider, Editor, EditorEvent, ExcerptId, ExcerptRange, - GutterDimensions, MultiBuffer, MultiBufferSnapshot, ToOffset as _, ToPoint, }; use feature_flags::{Assistant2FeatureFlag, FeatureFlagViewExt as _}; use fs::Fs; use gpui::{ - point, App, Context, Entity, Focusable, Global, HighlightStyle, Subscription, Task, - UpdateGlobal, WeakEntity, Window, + App, Context, Entity, Focusable, Global, HighlightStyle, Subscription, Task, UpdateGlobal, + WeakEntity, Window, point, }; 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 parking_lot::Mutex; use project::LspAction; @@ -32,20 +32,20 @@ use project::{CodeAction, ProjectTransaction}; use prompt_store::PromptBuilder; use settings::{Settings, SettingsStore}; 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 ui::prelude::*; use util::RangeExt; use util::ResultExt; -use workspace::{dock::Panel, ShowConfiguration}; -use workspace::{notifications::NotificationId, ItemHandle, Toast, Workspace}; +use workspace::{ItemHandle, Toast, Workspace, notifications::NotificationId}; +use workspace::{ShowConfiguration, dock::Panel}; +use crate::AssistantPanel; use crate::buffer_codegen::{BufferCodegen, CodegenAlternative, CodegenEvent}; use crate::context_store::ContextStore; use crate::inline_prompt_editor::{CodegenStatus, InlineAssistId, PromptEditor, PromptEditorEvent}; use crate::terminal_inline_assistant::TerminalInlineAssistant; use crate::thread_store::ThreadStore; -use crate::AssistantPanel; pub fn init( fs: Arc, diff --git a/crates/assistant2/src/inline_prompt_editor.rs b/crates/assistant2/src/inline_prompt_editor.rs index 45385e25ff..baa72bd434 100644 --- a/crates/assistant2/src/inline_prompt_editor.rs +++ b/crates/assistant2/src/inline_prompt_editor.rs @@ -10,14 +10,14 @@ use crate::{RemoveAllContext, ToggleContextPicker}; use client::ErrorExt; use collections::VecDeque; use editor::{ - actions::{MoveDown, MoveUp}, Editor, EditorElement, EditorEvent, EditorMode, EditorStyle, GutterDimensions, MultiBuffer, + actions::{MoveDown, MoveUp}, }; use feature_flags::{FeatureFlagAppExt as _, ZedPro}; use fs::Fs; use gpui::{ - anchored, deferred, point, AnyElement, App, ClickEvent, Context, CursorStyle, Entity, - EventEmitter, FocusHandle, Focusable, FontWeight, Subscription, TextStyle, WeakEntity, Window, + AnyElement, App, ClickEvent, Context, CursorStyle, Entity, EventEmitter, FocusHandle, + Focusable, FontWeight, Subscription, TextStyle, WeakEntity, Window, anchored, deferred, point, }; use language_model::{LanguageModel, LanguageModelRegistry}; use language_model_selector::ToggleModelSelector; @@ -28,7 +28,7 @@ use std::sync::Arc; use theme::ThemeSettings; use ui::utils::WithRemSize; use ui::{ - prelude::*, CheckboxWithLabel, IconButtonShape, KeyBinding, Popover, PopoverMenuHandle, Tooltip, + CheckboxWithLabel, IconButtonShape, KeyBinding, Popover, PopoverMenuHandle, Tooltip, prelude::*, }; use util::ResultExt; use workspace::Workspace; @@ -455,47 +455,55 @@ impl PromptEditor { match codegen_status { CodegenStatus::Idle => { - vec![Button::new("start", mode.start_label()) - .label_size(LabelSize::Small) - .icon(IconName::Return) - .icon_size(IconSize::XSmall) - .icon_color(Color::Muted) - .on_click(cx.listener(|_, _, _, cx| cx.emit(PromptEditorEvent::StartRequested))) - .into_any_element()] + vec![ + Button::new("start", mode.start_label()) + .label_size(LabelSize::Small) + .icon(IconName::Return) + .icon_size(IconSize::XSmall) + .icon_color(Color::Muted) + .on_click( + cx.listener(|_, _, _, cx| cx.emit(PromptEditorEvent::StartRequested)), + ) + .into_any_element(), + ] } - CodegenStatus::Pending => vec![IconButton::new("stop", IconName::Stop) - .icon_color(Color::Error) - .shape(IconButtonShape::Square) - .tooltip(move |window, cx| { - Tooltip::with_meta( - mode.tooltip_interrupt(), - Some(&menu::Cancel), - "Changes won't be discarded", - window, - cx, - ) - }) - .on_click(cx.listener(|_, _, _, cx| cx.emit(PromptEditorEvent::StopRequested))) - .into_any_element()], + CodegenStatus::Pending => vec![ + IconButton::new("stop", IconName::Stop) + .icon_color(Color::Error) + .shape(IconButtonShape::Square) + .tooltip(move |window, cx| { + Tooltip::with_meta( + mode.tooltip_interrupt(), + Some(&menu::Cancel), + "Changes won't be discarded", + window, + cx, + ) + }) + .on_click(cx.listener(|_, _, _, cx| cx.emit(PromptEditorEvent::StopRequested))) + .into_any_element(), + ], CodegenStatus::Done | CodegenStatus::Error(_) => { let has_error = matches!(codegen_status, CodegenStatus::Error(_)); if has_error || self.edited_since_done { - vec![IconButton::new("restart", IconName::RotateCw) - .icon_color(Color::Info) - .shape(IconButtonShape::Square) - .tooltip(move |window, cx| { - Tooltip::with_meta( - mode.tooltip_restart(), - Some(&menu::Confirm), - "Changes will be discarded", - window, - cx, - ) - }) - .on_click(cx.listener(|_, _, _, cx| { - cx.emit(PromptEditorEvent::StartRequested); - })) - .into_any_element()] + vec![ + IconButton::new("restart", IconName::RotateCw) + .icon_color(Color::Info) + .shape(IconButtonShape::Square) + .tooltip(move |window, cx| { + Tooltip::with_meta( + mode.tooltip_restart(), + Some(&menu::Confirm), + "Changes will be discarded", + window, + cx, + ) + }) + .on_click(cx.listener(|_, _, _, cx| { + cx.emit(PromptEditorEvent::StartRequested); + })) + .into_any_element(), + ] } else { let accept = IconButton::new("accept", IconName::Check) .icon_color(Color::Info) diff --git a/crates/assistant2/src/message_editor.rs b/crates/assistant2/src/message_editor.rs index 6c5d64a5d0..5b4e11014e 100644 --- a/crates/assistant2/src/message_editor.rs +++ b/crates/assistant2/src/message_editor.rs @@ -6,8 +6,8 @@ use editor::{ContextMenuOptions, ContextMenuPlacement, Editor, EditorElement, Ed use file_icons::FileIcons; use fs::Fs; use gpui::{ - linear_color_stop, linear_gradient, point, Animation, AnimationExt, App, DismissEvent, Entity, - Focusable, Subscription, TextStyle, WeakEntity, + Animation, AnimationExt, App, DismissEvent, Entity, Focusable, Subscription, TextStyle, + WeakEntity, linear_color_stop, linear_gradient, point, }; use language_model::LanguageModelRegistry; use language_model_selector::ToggleModelSelector; @@ -16,8 +16,8 @@ use settings::Settings; use std::time::Duration; use theme::ThemeSettings; use ui::{ - prelude::*, ButtonLike, Disclosure, KeyBinding, PlatformStyle, PopoverMenu, PopoverMenuHandle, - Tooltip, + ButtonLike, Disclosure, KeyBinding, PlatformStyle, PopoverMenu, PopoverMenuHandle, Tooltip, + prelude::*, }; use util::ResultExt; use vim_mode_setting::VimModeSetting; @@ -25,7 +25,7 @@ use workspace::Workspace; use crate::assistant_model_selector::AssistantModelSelector; 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::profile_selector::ProfileSelector; use crate::thread::{RequestKind, Thread}; diff --git a/crates/assistant2/src/profile_selector.rs b/crates/assistant2/src/profile_selector.rs index 1f31a9867c..477721b40f 100644 --- a/crates/assistant2/src/profile_selector.rs +++ b/crates/assistant2/src/profile_selector.rs @@ -2,12 +2,12 @@ use std::sync::Arc; use assistant_settings::{AgentProfile, AssistantSettings}; use fs::Fs; -use gpui::{prelude::*, Action, Entity, FocusHandle, Subscription, WeakEntity}; +use gpui::{Action, Entity, FocusHandle, Subscription, WeakEntity, prelude::*}; use indexmap::IndexMap; -use settings::{update_settings_file, Settings as _, SettingsStore}; +use settings::{Settings as _, SettingsStore, update_settings_file}; use ui::{ - prelude::*, ButtonLike, ContextMenu, ContextMenuEntry, KeyBinding, PopoverMenu, - PopoverMenuHandle, + ButtonLike, ContextMenu, ContextMenuEntry, KeyBinding, PopoverMenu, PopoverMenuHandle, + prelude::*, }; use util::ResultExt as _; diff --git a/crates/assistant2/src/terminal_codegen.rs b/crates/assistant2/src/terminal_codegen.rs index 850beda229..a791de76b7 100644 --- a/crates/assistant2/src/terminal_codegen.rs +++ b/crates/assistant2/src/terminal_codegen.rs @@ -1,8 +1,8 @@ use crate::inline_prompt_editor::CodegenStatus; 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 language_model::{report_assistant_event, LanguageModelRegistry, LanguageModelRequest}; +use language_model::{LanguageModelRegistry, LanguageModelRequest, report_assistant_event}; use std::{sync::Arc, time::Instant}; use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase}; use terminal::Terminal; diff --git a/crates/assistant2/src/terminal_inline_assistant.rs b/crates/assistant2/src/terminal_inline_assistant.rs index 42d183e728..54b771b039 100644 --- a/crates/assistant2/src/terminal_inline_assistant.rs +++ b/crates/assistant2/src/terminal_inline_assistant.rs @@ -3,18 +3,18 @@ use crate::context_store::ContextStore; use crate::inline_prompt_editor::{ 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 anyhow::{Context as _, Result}; use client::telemetry::Telemetry; use collections::{HashMap, VecDeque}; -use editor::{actions::SelectAll, MultiBuffer}; +use editor::{MultiBuffer, actions::SelectAll}; use fs::Fs; use gpui::{App, Entity, Focusable, Global, Subscription, UpdateGlobal, WeakEntity}; use language::Buffer; use language_model::{ - report_assistant_event, LanguageModelRegistry, LanguageModelRequest, - LanguageModelRequestMessage, Role, + LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, Role, + report_assistant_event, }; use prompt_store::PromptBuilder; use std::sync::Arc; @@ -22,7 +22,7 @@ use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase}; use terminal_view::TerminalView; use ui::prelude::*; use util::ResultExt; -use workspace::{notifications::NotificationId, Toast, Workspace}; +use workspace::{Toast, Workspace, notifications::NotificationId}; pub fn init( fs: Arc, diff --git a/crates/assistant2/src/thread.rs b/crates/assistant2/src/thread.rs index 374c06b5d6..2de372ff89 100644 --- a/crates/assistant2/src/thread.rs +++ b/crates/assistant2/src/thread.rs @@ -26,10 +26,10 @@ use prompt_store::{ }; use serde::{Deserialize, Serialize}; 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 crate::context::{attach_context_to_message, ContextId, ContextSnapshot}; +use crate::context::{ContextId, ContextSnapshot, attach_context_to_message}; use crate::thread_store::{ SerializedMessage, SerializedMessageSegment, SerializedThread, SerializedToolResult, SerializedToolUse, diff --git a/crates/assistant2/src/thread_history.rs b/crates/assistant2/src/thread_history.rs index ebbc4ec96b..7170cc02eb 100644 --- a/crates/assistant2/src/thread_history.rs +++ b/crates/assistant2/src/thread_history.rs @@ -1,10 +1,10 @@ use assistant_context_editor::SavedContextMetadata; use gpui::{ - uniform_list, App, Entity, FocusHandle, Focusable, ScrollStrategy, UniformListScrollHandle, - WeakEntity, + App, Entity, FocusHandle, Focusable, ScrollStrategy, UniformListScrollHandle, WeakEntity, + uniform_list, }; 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::thread_store::SerializedThreadMetadata; diff --git a/crates/assistant2/src/thread_store.rs b/crates/assistant2/src/thread_store.rs index 474db2bcd8..86471215f8 100644 --- a/crates/assistant2/src/thread_store.rs +++ b/crates/assistant2/src/thread_store.rs @@ -2,20 +2,20 @@ use std::borrow::Cow; use std::path::PathBuf; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_settings::{AgentProfile, AssistantSettings}; use assistant_tool::{ToolId, ToolSource, ToolWorkingSet}; use chrono::{DateTime, Utc}; use collections::HashMap; use context_server::manager::ContextServerManager; use context_server::{ContextServerFactoryRegistry, ContextServerTool}; -use futures::future::{self, BoxFuture, Shared}; use futures::FutureExt as _; +use futures::future::{self, BoxFuture, Shared}; 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::types::SerdeBincode; use language_model::{LanguageModelToolUseId, Role, TokenUsage}; use project::Project; use prompt_store::PromptBuilder; diff --git a/crates/assistant2/src/tool_use.rs b/crates/assistant2/src/tool_use.rs index 67bfbb6e88..602a8ab5ae 100644 --- a/crates/assistant2/src/tool_use.rs +++ b/crates/assistant2/src/tool_use.rs @@ -3,8 +3,8 @@ use std::sync::Arc; use anyhow::Result; use assistant_tool::{Tool, ToolWorkingSet}; use collections::HashMap; -use futures::future::Shared; use futures::FutureExt as _; +use futures::future::Shared; use gpui::{App, SharedString, Task}; use language_model::{ LanguageModelRequestMessage, LanguageModelToolResult, LanguageModelToolUse, diff --git a/crates/assistant2/src/ui/agent_notification.rs b/crates/assistant2/src/ui/agent_notification.rs index 56448b999a..a0529b25b0 100644 --- a/crates/assistant2/src/ui/agent_notification.rs +++ b/crates/assistant2/src/ui/agent_notification.rs @@ -1,12 +1,12 @@ use gpui::{ - linear_color_stop, linear_gradient, point, App, Context, EventEmitter, IntoElement, - PlatformDisplay, Size, Window, WindowBackgroundAppearance, WindowBounds, WindowDecorations, - WindowKind, WindowOptions, + App, Context, EventEmitter, IntoElement, PlatformDisplay, Size, Window, + WindowBackgroundAppearance, WindowBounds, WindowDecorations, WindowKind, WindowOptions, + linear_color_stop, linear_gradient, point, }; use release_channel::ReleaseChannel; use std::rc::Rc; use theme; -use ui::{prelude::*, Render}; +use ui::{Render, prelude::*}; pub struct AgentNotification { title: SharedString, diff --git a/crates/assistant2/src/ui/context_pill.rs b/crates/assistant2/src/ui/context_pill.rs index bc37583a2f..eeaf975192 100644 --- a/crates/assistant2/src/ui/context_pill.rs +++ b/crates/assistant2/src/ui/context_pill.rs @@ -1,7 +1,7 @@ use std::rc::Rc; use gpui::ClickEvent; -use ui::{prelude::*, IconButtonShape, Tooltip}; +use ui::{IconButtonShape, Tooltip, prelude::*}; use crate::context::{ContextKind, ContextSnapshot}; diff --git a/crates/assistant_context_editor/src/context.rs b/crates/assistant_context_editor/src/context.rs index 1ebb2a9289..4b2747d9ad 100644 --- a/crates/assistant_context_editor/src/context.rs +++ b/crates/assistant_context_editor/src/context.rs @@ -2,7 +2,7 @@ mod context_tests; use crate::patch::{AssistantEdit, AssistantPatch, AssistantPatchStatus}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_slash_command::{ SlashCommandContent, SlashCommandEvent, SlashCommandLine, SlashCommandOutputSection, SlashCommandResult, SlashCommandWorkingSet, @@ -12,17 +12,17 @@ use client::{self, proto, telemetry::Telemetry}; use clock::ReplicaId; use collections::{HashMap, HashSet}; use fs::{Fs, RemoveOptions}; -use futures::{future::Shared, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, future::Shared}; use gpui::{ App, AppContext as _, Context, Entity, EventEmitter, RenderImage, SharedString, Subscription, Task, }; use language::{AnchorRangeExt, Bias, Buffer, LanguageRegistry, OffsetRangeExt, Point, ToOffset}; use language_model::{ - report_assistant_event, LanguageModel, LanguageModelCacheConfiguration, - LanguageModelCompletionEvent, LanguageModelImage, LanguageModelRegistry, LanguageModelRequest, - LanguageModelRequestMessage, LanguageModelToolUseId, MaxMonthlySpendReachedError, - MessageContent, PaymentRequiredError, Role, StopReason, + LanguageModel, LanguageModelCacheConfiguration, LanguageModelCompletionEvent, + LanguageModelImage, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, + LanguageModelToolUseId, MaxMonthlySpendReachedError, MessageContent, PaymentRequiredError, + Role, StopReason, report_assistant_event, }; use open_ai::Model as OpenAiModel; use paths::contexts_dir; @@ -31,7 +31,7 @@ use prompt_store::PromptBuilder; use serde::{Deserialize, Serialize}; use smallvec::SmallVec; use std::{ - cmp::{max, Ordering}, + cmp::{Ordering, max}, fmt::Debug, iter, mem, ops::Range, @@ -43,7 +43,7 @@ use std::{ use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase}; use text::{BufferSnapshot, ToPoint}; use ui::IconName; -use util::{post_inc, ResultExt, TryFutureExt}; +use util::{ResultExt, TryFutureExt, post_inc}; use uuid::Uuid; #[derive(Clone, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)] diff --git a/crates/assistant_context_editor/src/context/context_tests.rs b/crates/assistant_context_editor/src/context/context_tests.rs index ffa44defb0..8293744831 100644 --- a/crates/assistant_context_editor/src/context/context_tests.rs +++ b/crates/assistant_context_editor/src/context/context_tests.rs @@ -14,7 +14,7 @@ use futures::{ channel::mpsc, 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_model::{LanguageModelCacheConfiguration, LanguageModelRegistry, Role}; use parking_lot::Mutex; @@ -30,14 +30,14 @@ use std::{ ops::Range, path::Path, 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 unindent::Unindent; use util::{ - test::{generate_marked_text, marked_text_ranges}, RandomCharIter, + test::{generate_marked_text, marked_text_ranges}, }; use workspace::Workspace; diff --git a/crates/assistant_context_editor/src/context_editor.rs b/crates/assistant_context_editor/src/context_editor.rs index 74fca648e6..c155c0b2bf 100644 --- a/crates/assistant_context_editor/src/context_editor.rs +++ b/crates/assistant_context_editor/src/context_editor.rs @@ -2,36 +2,36 @@ use anyhow::Result; use assistant_settings::AssistantSettings; use assistant_slash_command::{SlashCommand, SlashCommandOutputSection, SlashCommandWorkingSet}; use assistant_slash_commands::{ - selections_creases, DefaultSlashCommand, DocsSlashCommand, DocsSlashCommandArgs, - FileSlashCommand, + DefaultSlashCommand, DocsSlashCommand, DocsSlashCommandArgs, FileSlashCommand, + selections_creases, }; use client::{proto, zed_urls}; -use collections::{hash_map, BTreeSet, HashMap, HashSet}; +use collections::{BTreeSet, HashMap, HashSet, hash_map}; use editor::{ + Anchor, Editor, EditorEvent, MenuInlineCompletionsPolicy, ProposedChangeLocation, + ProposedChangesEditor, RowExt, ToOffset as _, ToPoint, actions::{FoldAt, MoveToEndOfLine, Newline, ShowCompletions, UnfoldAt}, display_map::{ BlockContext, BlockId, BlockPlacement, BlockProperties, BlockStyle, Crease, CreaseMetadata, CustomBlockId, FoldId, RenderBlock, ToDisplayPoint, }, 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 futures::FutureExt; use gpui::{ - actions, div, img, impl_internal_actions, percentage, point, prelude::*, pulsating_between, - size, Animation, AnimationExt, AnyElement, AnyView, App, AsyncWindowContext, ClipboardEntry, + Animation, AnimationExt, AnyElement, AnyView, App, AsyncWindowContext, ClipboardEntry, ClipboardItem, CursorStyle, Empty, Entity, EventEmitter, FocusHandle, Focusable, FontWeight, Global, InteractiveElement, IntoElement, ParentElement, Pixels, Render, RenderImage, 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 language::{ - language_settings::{all_language_settings, SoftWrap}, BufferSnapshot, LspAdapterDelegate, ToOffset, + language_settings::{SoftWrap, all_language_settings}, }; use language_model::{ LanguageModelImage, LanguageModelProvider, LanguageModelProviderTosView, LanguageModelRegistry, @@ -46,33 +46,33 @@ use project::lsp_store::LocalLspAdapterDelegate; use project::{Project, Worktree}; use rope::Point; 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 text::SelectionGoal; use ui::{ - prelude::*, ButtonLike, Disclosure, ElevationIndex, KeyBinding, PopoverMenuHandle, TintColor, - Tooltip, + ButtonLike, Disclosure, ElevationIndex, KeyBinding, PopoverMenuHandle, TintColor, Tooltip, + prelude::*, }; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; use workspace::searchable::{Direction, SearchableItemHandle}; use workspace::{ + Save, ShowConfiguration, Toast, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, + Workspace, item::{self, FollowableItem, Item, ItemHandle}, notifications::NotificationId, pane::{self, SaveIntent}, searchable::{SearchEvent, SearchableItem}, - Save, ShowConfiguration, Toast, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, - Workspace, }; -use crate::{ - slash_command::SlashCommandCompletionProvider, slash_command_picker, - ThoughtProcessOutputSection, -}; use crate::{ AssistantContext, AssistantPatch, AssistantPatchStatus, CacheStatus, Content, ContextEvent, ContextId, InvokedSlashCommandId, InvokedSlashCommandStatus, Message, MessageId, MessageMetadata, MessageStatus, ParsedSlashCommand, PendingSlashCommandStatus, RequestType, }; +use crate::{ + ThoughtProcessOutputSection, slash_command::SlashCommandCompletionProvider, + slash_command_picker, +}; actions!( assistant, diff --git a/crates/assistant_context_editor/src/context_history.rs b/crates/assistant_context_editor/src/context_history.rs index 83df49e16f..35b932158b 100644 --- a/crates/assistant_context_editor/src/context_history.rs +++ b/crates/assistant_context_editor/src/context_history.rs @@ -3,13 +3,13 @@ use std::sync::Arc; use gpui::{App, Entity, EventEmitter, FocusHandle, Focusable, Subscription, Task, WeakEntity}; use picker::{Picker, PickerDelegate}; use project::Project; -use ui::utils::{format_distance_from_now, DateTimeType}; -use ui::{prelude::*, Avatar, ListItem, ListItemSpacing}; +use ui::utils::{DateTimeType, format_distance_from_now}; +use ui::{Avatar, ListItem, ListItemSpacing, prelude::*}; use workspace::{Item, Workspace}; use crate::{ - AssistantPanelDelegate, ContextStore, RemoteContextMetadata, SavedContextMetadata, - DEFAULT_TAB_TITLE, + AssistantPanelDelegate, ContextStore, DEFAULT_TAB_TITLE, RemoteContextMetadata, + SavedContextMetadata, }; #[derive(Clone)] @@ -229,10 +229,12 @@ impl PickerDelegate for SavedContextPickerDelegate { .into_any_element(), ] } else { - vec![Label::new("Shared by host") - .color(Color::Muted) - .size(LabelSize::Small) - .into_any_element()] + vec![ + Label::new("Shared by host") + .color(Color::Muted) + .size(LabelSize::Small) + .into_any_element(), + ] }), ) } diff --git a/crates/assistant_context_editor/src/context_store.rs b/crates/assistant_context_editor/src/context_store.rs index af6a34f1c8..a7b33c279b 100644 --- a/crates/assistant_context_editor/src/context_store.rs +++ b/crates/assistant_context_editor/src/context_store.rs @@ -2,13 +2,13 @@ use crate::{ AssistantContext, ContextEvent, ContextId, ContextOperation, ContextVersion, SavedContext, SavedContextMetadata, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_slash_command::{SlashCommandId, SlashCommandWorkingSet}; -use client::{proto, telemetry::Telemetry, Client, TypedEnvelope}; +use client::{Client, TypedEnvelope, proto, telemetry::Telemetry}; use clock::ReplicaId; use collections::HashMap; -use context_server::manager::ContextServerManager; use context_server::ContextServerFactoryRegistry; +use context_server::manager::ContextServerManager; use fs::{Fs, RemoveOptions}; use futures::StreamExt; use fuzzy::StringMatchCandidate; @@ -104,52 +104,47 @@ impl ContextStore { const CONTEXT_WATCH_DURATION: Duration = Duration::from_millis(100); let (mut events, _) = fs.watch(contexts_dir(), CONTEXT_WATCH_DURATION).await; - let this = - cx.new(|cx: &mut Context| { - let context_server_factory_registry = - ContextServerFactoryRegistry::default_global(cx); - let context_server_manager = cx.new(|cx| { - ContextServerManager::new( - context_server_factory_registry, - project.clone(), - cx, - ) - }); - let mut this = Self { - contexts: Vec::new(), - contexts_metadata: Vec::new(), - context_server_manager, - context_server_slash_command_ids: HashMap::default(), - host_contexts: Vec::new(), - fs, - languages, - slash_commands, - 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(()) + let this = cx.new(|cx: &mut Context| { + let context_server_factory_registry = + ContextServerFactoryRegistry::default_global(cx); + let context_server_manager = cx.new(|cx| { + ContextServerManager::new(context_server_factory_registry, project.clone(), cx) + }); + let mut this = Self { + contexts: Vec::new(), + contexts_metadata: Vec::new(), + context_server_manager, + context_server_slash_command_ids: HashMap::default(), + host_contexts: Vec::new(), + fs, + languages, + slash_commands, + 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(); } - .log_err() - .await - }), - client_subscription: None, - _project_subscriptions: vec![ - cx.subscribe(&project, Self::handle_project_event) - ], - project_is_shared: false, - client: project.read(cx).client(), - project: project.clone(), - prompt_builder, - }; - this.handle_project_shared(project.clone(), cx); - this.synchronize_contexts(cx); - this.register_context_server_handlers(cx); - this.reload(cx).detach_and_log_err(cx); - this - })?; + anyhow::Ok(()) + } + .log_err() + .await + }), + client_subscription: None, + _project_subscriptions: vec![ + cx.subscribe(&project, Self::handle_project_event), + ], + project_is_shared: false, + client: project.read(cx).client(), + project: project.clone(), + prompt_builder, + }; + this.handle_project_shared(project.clone(), cx); + this.synchronize_contexts(cx); + this.register_context_server_handlers(cx); + this.reload(cx).detach_and_log_err(cx); + this + })?; Ok(this) }) diff --git a/crates/assistant_context_editor/src/patch.rs b/crates/assistant_context_editor/src/patch.rs index e46c420fc5..286bd38da1 100644 --- a/crates/assistant_context_editor/src/patch.rs +++ b/crates/assistant_context_editor/src/patch.rs @@ -1,7 +1,7 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::HashMap; use editor::ProposedChangesEditor; -use futures::{future, TryFutureExt as _}; +use futures::{TryFutureExt as _, future}; use gpui::{App, AppContext as _, AsyncApp, Entity, SharedString}; use language::{AutoindentMode, Buffer, BufferSnapshot}; use project::{Project, ProjectPath}; @@ -548,7 +548,7 @@ mod tests { use super::*; use gpui::App; use language::{ - language_settings::AllLanguageSettings, Language, LanguageConfig, LanguageMatcher, + Language, LanguageConfig, LanguageMatcher, language_settings::AllLanguageSettings, }; use settings::SettingsStore; use ui::BorrowAppContext; diff --git a/crates/assistant_context_editor/src/slash_command.rs b/crates/assistant_context_editor/src/slash_command.rs index a3897e3235..481a408f4c 100644 --- a/crates/assistant_context_editor/src/slash_command.rs +++ b/crates/assistant_context_editor/src/slash_command.rs @@ -3,19 +3,19 @@ use anyhow::Result; pub use assistant_slash_command::SlashCommand; use assistant_slash_command::{AfterCompletion, SlashCommandLine, SlashCommandWorkingSet}; 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 language::{Anchor, Buffer, ToPoint}; use parking_lot::Mutex; -use project::{lsp_store::CompletionDocumentation, CompletionIntent, CompletionSource}; +use project::{CompletionIntent, CompletionSource, lsp_store::CompletionDocumentation}; use rope::Point; use std::{ cell::RefCell, ops::Range, rc::Rc, sync::{ - atomic::{AtomicBool, Ordering::SeqCst}, Arc, + atomic::{AtomicBool, Ordering::SeqCst}, }, }; use workspace::Workspace; diff --git a/crates/assistant_context_editor/src/slash_command_picker.rs b/crates/assistant_context_editor/src/slash_command_picker.rs index 6666317639..384fdc5790 100644 --- a/crates/assistant_context_editor/src/slash_command_picker.rs +++ b/crates/assistant_context_editor/src/slash_command_picker.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use assistant_slash_command::SlashCommandWorkingSet; use gpui::{AnyElement, AnyView, DismissEvent, SharedString, Task, WeakEntity}; 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; diff --git a/crates/assistant_eval/src/headless_assistant.rs b/crates/assistant_eval/src/headless_assistant.rs index 69b8fa2fdc..1c983b85de 100644 --- a/crates/assistant_eval/src/headless_assistant.rs +++ b/crates/assistant_eval/src/headless_assistant.rs @@ -1,11 +1,11 @@ use anyhow::anyhow; -use assistant2::{RequestKind, Thread, ThreadEvent, ThreadStore}; use assistant_tool::ToolWorkingSet; +use assistant2::{RequestKind, Thread, ThreadEvent, ThreadStore}; use client::{Client, UserStore}; use collections::HashMap; use dap::DapRegistry; 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_model::{ AuthenticateError, LanguageModel, LanguageModelProviderId, LanguageModelRegistry, diff --git a/crates/assistant_eval/src/main.rs b/crates/assistant_eval/src/main.rs index 786e858f6a..129f4b14fd 100644 --- a/crates/assistant_eval/src/main.rs +++ b/crates/assistant_eval/src/main.rs @@ -6,7 +6,7 @@ use clap::Parser; use eval::{Eval, EvalOutput}; use futures::future; 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 judge::Judge; use language_model::{LanguageModel, LanguageModelRegistry}; diff --git a/crates/assistant_settings/src/assistant_settings.rs b/crates/assistant_settings/src/assistant_settings.rs index b0a5ee7926..f496311486 100644 --- a/crates/assistant_settings/src/assistant_settings.rs +++ b/crates/assistant_settings/src/assistant_settings.rs @@ -11,7 +11,7 @@ use indexmap::IndexMap; use language_model::{CloudModel, LanguageModel}; use lmstudio::Model as LmStudioModel; use ollama::Model as OllamaModel; -use schemars::{schema::Schema, JsonSchema}; +use schemars::{JsonSchema, schema::Schema}; use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsSources}; diff --git a/crates/assistant_slash_command/src/assistant_slash_command.rs b/crates/assistant_slash_command/src/assistant_slash_command.rs index ab5f9dad4a..ce8318ba12 100644 --- a/crates/assistant_slash_command/src/assistant_slash_command.rs +++ b/crates/assistant_slash_command/src/assistant_slash_command.rs @@ -6,17 +6,17 @@ pub use crate::extension_slash_command::*; pub use crate::slash_command_registry::*; pub use crate::slash_command_working_set::*; use anyhow::Result; -use futures::stream::{self, BoxStream}; use futures::StreamExt; +use futures::stream::{self, BoxStream}; use gpui::{App, SharedString, Task, WeakEntity, Window}; use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate, OffsetRangeExt}; pub use language_model::Role; use serde::{Deserialize, Serialize}; use std::{ 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) { SlashCommandRegistry::default_global(cx); diff --git a/crates/assistant_slash_command/src/extension_slash_command.rs b/crates/assistant_slash_command/src/extension_slash_command.rs index e56c4314aa..6cc1f73c47 100644 --- a/crates/assistant_slash_command/src/extension_slash_command.rs +++ b/crates/assistant_slash_command/src/extension_slash_command.rs @@ -1,5 +1,5 @@ use std::path::PathBuf; -use std::sync::{atomic::AtomicBool, Arc}; +use std::sync::{Arc, atomic::AtomicBool}; use anyhow::Result; use async_trait::async_trait; diff --git a/crates/assistant_slash_commands/src/cargo_workspace_command.rs b/crates/assistant_slash_commands/src/cargo_workspace_command.rs index 196aa98fd9..8b088ea012 100644 --- a/crates/assistant_slash_commands/src/cargo_workspace_command.rs +++ b/crates/assistant_slash_commands/src/cargo_workspace_command.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, @@ -10,7 +10,7 @@ use project::{Project, ProjectPath}; use std::{ fmt::Write, path::Path, - sync::{atomic::AtomicBool, Arc}, + sync::{Arc, atomic::AtomicBool}, }; use ui::prelude::*; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/context_server_command.rs b/crates/assistant_slash_commands/src/context_server_command.rs index 42f814791d..9ad25cadf9 100644 --- a/crates/assistant_slash_commands/src/context_server_command.rs +++ b/crates/assistant_slash_commands/src/context_server_command.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_slash_command::{ AfterCompletion, ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, @@ -10,8 +10,8 @@ use context_server::{ }; use gpui::{App, Entity, Task, WeakEntity, Window}; use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate}; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use text::LineEnding; use ui::{IconName, SharedString}; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/default_command.rs b/crates/assistant_slash_commands/src/default_command.rs index 6bc7e98a1b..e5bda3c03b 100644 --- a/crates/assistant_slash_commands/src/default_command.rs +++ b/crates/assistant_slash_commands/src/default_command.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, @@ -8,7 +8,7 @@ use language::{BufferSnapshot, LspAdapterDelegate}; use prompt_store::PromptStore; use std::{ fmt::Write, - sync::{atomic::AtomicBool, Arc}, + sync::{Arc, atomic::AtomicBool}, }; use ui::prelude::*; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/delta_command.rs b/crates/assistant_slash_commands/src/delta_command.rs index 3199b426d4..491ed65d87 100644 --- a/crates/assistant_slash_commands/src/delta_command.rs +++ b/crates/assistant_slash_commands/src/delta_command.rs @@ -1,5 +1,5 @@ use crate::file_command::{FileCommandMetadata, FileSlashCommand}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, @@ -8,7 +8,7 @@ use collections::HashSet; use futures::future; use gpui::{App, Task, WeakEntity, Window}; use language::{BufferSnapshot, LspAdapterDelegate}; -use std::sync::{atomic::AtomicBool, Arc}; +use std::sync::{Arc, atomic::AtomicBool}; use text::OffsetRangeExt; use ui::prelude::*; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/diagnostics_command.rs b/crates/assistant_slash_commands/src/diagnostics_command.rs index 716fcbcd1d..b365de97d4 100644 --- a/crates/assistant_slash_commands/src/diagnostics_command.rs +++ b/crates/assistant_slash_commands/src/diagnostics_command.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, @@ -14,11 +14,11 @@ use rope::Point; use std::{ fmt::Write, path::{Path, PathBuf}, - sync::{atomic::AtomicBool, Arc}, + sync::{Arc, atomic::AtomicBool}, }; use ui::prelude::*; -use util::paths::PathMatcher; use util::ResultExt; +use util::paths::PathMatcher; use workspace::Workspace; use crate::create_label_for_command; diff --git a/crates/assistant_slash_commands/src/docs_command.rs b/crates/assistant_slash_commands/src/docs_command.rs index 2114a9b9fd..a9d7d1679e 100644 --- a/crates/assistant_slash_commands/src/docs_command.rs +++ b/crates/assistant_slash_commands/src/docs_command.rs @@ -1,9 +1,9 @@ use std::path::Path; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use std::time::Duration; -use anyhow::{anyhow, bail, Result}; +use anyhow::{Result, anyhow, bail}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, @@ -16,7 +16,7 @@ use indexed_docs::{ use language::{BufferSnapshot, LspAdapterDelegate}; use project::{Project, ProjectPath}; use ui::prelude::*; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; use workspace::Workspace; pub struct DocsSlashCommand; diff --git a/crates/assistant_slash_commands/src/fetch_command.rs b/crates/assistant_slash_commands/src/fetch_command.rs index 8188766e72..6c1badeb74 100644 --- a/crates/assistant_slash_commands/src/fetch_command.rs +++ b/crates/assistant_slash_commands/src/fetch_command.rs @@ -1,16 +1,16 @@ use std::cell::RefCell; use std::rc::Rc; -use std::sync::atomic::AtomicBool; 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::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, }; use futures::AsyncReadExt; 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 language::{BufferSnapshot, LspAdapterDelegate}; use ui::prelude::*; diff --git a/crates/assistant_slash_commands/src/file_command.rs b/crates/assistant_slash_commands/src/file_command.rs index e08913e5cc..a47f8ac96a 100644 --- a/crates/assistant_slash_commands/src/file_command.rs +++ b/crates/assistant_slash_commands/src/file_command.rs @@ -1,10 +1,10 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_slash_command::{ AfterCompletion, ArgumentCompletion, SlashCommand, SlashCommandContent, SlashCommandEvent, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, }; -use futures::channel::mpsc; use futures::Stream; +use futures::channel::mpsc; use fuzzy::PathMatch; use gpui::{App, Entity, Task, WeakEntity}; use language::{BufferSnapshot, CodeLabel, HighlightId, LineEnding, LspAdapterDelegate}; @@ -15,7 +15,7 @@ use std::{ fmt::Write, ops::{Range, RangeInclusive}, path::{Path, PathBuf}, - sync::{atomic::AtomicBool, Arc}, + sync::{Arc, atomic::AtomicBool}, }; use ui::prelude::*; use util::ResultExt; @@ -694,15 +694,21 @@ mod test { assert_eq!(result.sections.len(), 7); // Ensure that full file paths are included in the real output - assert!(result - .text - .contains(separator!("zed/assets/themes/andromeda/LICENSE"))); - assert!(result - .text - .contains(separator!("zed/assets/themes/ayu/LICENSE"))); - assert!(result - .text - .contains(separator!("zed/assets/themes/summercamp/LICENSE"))); + assert!( + result + .text + .contains(separator!("zed/assets/themes/andromeda/LICENSE")) + ); + assert!( + result + .text + .contains(separator!("zed/assets/themes/ayu/LICENSE")) + ); + assert!( + result + .text + .contains(separator!("zed/assets/themes/summercamp/LICENSE")) + ); assert_eq!(result.sections[5].label, "summercamp"); diff --git a/crates/assistant_slash_commands/src/now_command.rs b/crates/assistant_slash_commands/src/now_command.rs index 6d4ae75dd7..e4abef2a7c 100644 --- a/crates/assistant_slash_commands/src/now_command.rs +++ b/crates/assistant_slash_commands/src/now_command.rs @@ -1,5 +1,5 @@ -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use anyhow::Result; use assistant_slash_command::{ diff --git a/crates/assistant_slash_commands/src/prompt_command.rs b/crates/assistant_slash_commands/src/prompt_command.rs index 73f75ceb05..7d535f803a 100644 --- a/crates/assistant_slash_commands/src/prompt_command.rs +++ b/crates/assistant_slash_commands/src/prompt_command.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, @@ -6,7 +6,7 @@ use assistant_slash_command::{ use gpui::{Task, WeakEntity}; use language::{BufferSnapshot, LspAdapterDelegate}; use prompt_store::PromptStore; -use std::sync::{atomic::AtomicBool, Arc}; +use std::sync::{Arc, atomic::AtomicBool}; use ui::prelude::*; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/selection_command.rs b/crates/assistant_slash_commands/src/selection_command.rs index fbe4d42bcb..0d643b44ba 100644 --- a/crates/assistant_slash_commands/src/selection_command.rs +++ b/crates/assistant_slash_commands/src/selection_command.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandContent, SlashCommandEvent, SlashCommandOutputSection, SlashCommandResult, @@ -7,8 +7,8 @@ use editor::Editor; use futures::StreamExt; use gpui::{App, Context, SharedString, Task, WeakEntity, Window}; use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate}; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use ui::IconName; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/streaming_example_command.rs b/crates/assistant_slash_commands/src/streaming_example_command.rs index ac6b5a5f7e..3f56613bc2 100644 --- a/crates/assistant_slash_commands/src/streaming_example_command.rs +++ b/crates/assistant_slash_commands/src/streaming_example_command.rs @@ -1,5 +1,5 @@ -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use std::time::Duration; use anyhow::Result; @@ -11,8 +11,8 @@ use feature_flags::FeatureFlag; use futures::channel::mpsc; use gpui::{Task, WeakEntity}; use language::{BufferSnapshot, LspAdapterDelegate}; -use smol::stream::StreamExt; use smol::Timer; +use smol::stream::StreamExt; use ui::prelude::*; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/symbols_command.rs b/crates/assistant_slash_commands/src/symbols_command.rs index 533c561b13..ef93146431 100644 --- a/crates/assistant_slash_commands/src/symbols_command.rs +++ b/crates/assistant_slash_commands/src/symbols_command.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, diff --git a/crates/assistant_slash_commands/src/tab_command.rs b/crates/assistant_slash_commands/src/tab_command.rs index c4953aec30..49e93f0ad8 100644 --- a/crates/assistant_slash_commands/src/tab_command.rs +++ b/crates/assistant_slash_commands/src/tab_command.rs @@ -10,9 +10,9 @@ use gpui::{Task, WeakEntity}; use language::{BufferSnapshot, CodeLabel, HighlightId, LspAdapterDelegate}; use std::{ 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 workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/terminal_command.rs b/crates/assistant_slash_commands/src/terminal_command.rs index fe567e7501..b521e10f72 100644 --- a/crates/assistant_slash_commands/src/terminal_command.rs +++ b/crates/assistant_slash_commands/src/terminal_command.rs @@ -1,5 +1,5 @@ -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use anyhow::Result; use assistant_slash_command::{ @@ -8,9 +8,9 @@ use assistant_slash_command::{ }; use gpui::{App, Entity, Task, WeakEntity}; use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate}; -use terminal_view::{terminal_panel::TerminalPanel, TerminalView}; +use terminal_view::{TerminalView, terminal_panel::TerminalPanel}; use ui::prelude::*; -use workspace::{dock::Panel, Workspace}; +use workspace::{Workspace, dock::Panel}; use super::create_label_for_command; diff --git a/crates/assistant_tools/src/bash_tool.rs b/crates/assistant_tools/src/bash_tool.rs index fb3c5c96d3..9423d3b81b 100644 --- a/crates/assistant_tools/src/bash_tool.rs +++ b/crates/assistant_tools/src/bash_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; diff --git a/crates/assistant_tools/src/batch_tool.rs b/crates/assistant_tools/src/batch_tool.rs index 8516f3062b..919389b3a1 100644 --- a/crates/assistant_tools/src/batch_tool.rs +++ b/crates/assistant_tools/src/batch_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool, ToolWorkingSet}; use futures::future::join_all; use gpui::{App, AppContext, Entity, Task}; diff --git a/crates/assistant_tools/src/code_symbols_tool.rs b/crates/assistant_tools/src/code_symbols_tool.rs index 6abf447484..d139a31382 100644 --- a/crates/assistant_tools/src/code_symbols_tool.rs +++ b/crates/assistant_tools/src/code_symbols_tool.rs @@ -2,7 +2,7 @@ use std::fmt::{self, Write}; use std::path::PathBuf; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use collections::IndexMap; use gpui::{App, AsyncApp, Entity, Task}; diff --git a/crates/assistant_tools/src/copy_path_tool.rs b/crates/assistant_tools/src/copy_path_tool.rs index f872703f8c..540da5ff7a 100644 --- a/crates/assistant_tools/src/copy_path_tool.rs +++ b/crates/assistant_tools/src/copy_path_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, AppContext, Entity, Task}; use language_model::LanguageModelRequestMessage; diff --git a/crates/assistant_tools/src/create_directory_tool.rs b/crates/assistant_tools/src/create_directory_tool.rs index 0e8d77eda7..d5b948a2d9 100644 --- a/crates/assistant_tools/src/create_directory_tool.rs +++ b/crates/assistant_tools/src/create_directory_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, Entity, Task}; use language_model::LanguageModelRequestMessage; diff --git a/crates/assistant_tools/src/create_file_tool.rs b/crates/assistant_tools/src/create_file_tool.rs index 37c016821f..d4f0f77e64 100644 --- a/crates/assistant_tools/src/create_file_tool.rs +++ b/crates/assistant_tools/src/create_file_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, Entity, Task}; use language_model::LanguageModelRequestMessage; diff --git a/crates/assistant_tools/src/delete_path_tool.rs b/crates/assistant_tools/src/delete_path_tool.rs index bd0ca72890..3eae3e1790 100644 --- a/crates/assistant_tools/src/delete_path_tool.rs +++ b/crates/assistant_tools/src/delete_path_tool.rs @@ -1,7 +1,7 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; -use futures::{channel::mpsc, SinkExt, StreamExt}; +use futures::{SinkExt, StreamExt, channel::mpsc}; use gpui::{App, AppContext, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use project::{Project, ProjectPath}; diff --git a/crates/assistant_tools/src/diagnostics_tool.rs b/crates/assistant_tools/src/diagnostics_tool.rs index 1dbcee0bca..feb78dfe56 100644 --- a/crates/assistant_tools/src/diagnostics_tool.rs +++ b/crates/assistant_tools/src/diagnostics_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, Entity, Task}; use language::{DiagnosticSeverity, OffsetRangeExt}; diff --git a/crates/assistant_tools/src/edit_files_tool.rs b/crates/assistant_tools/src/edit_files_tool.rs index 818e541e7a..579bd6e9b3 100644 --- a/crates/assistant_tools/src/edit_files_tool.rs +++ b/crates/assistant_tools/src/edit_files_tool.rs @@ -3,11 +3,11 @@ pub mod log; use crate::replace::{replace_exact, replace_with_flexible_indent}; use crate::schema::json_schema_for; -use anyhow::{anyhow, Context, Result}; +use anyhow::{Context, Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use collections::HashSet; -use edit_action::{edit_model_prompt, EditAction, EditActionParser}; -use futures::{channel::mpsc, SinkExt, StreamExt}; +use edit_action::{EditAction, EditActionParser, edit_model_prompt}; +use futures::{SinkExt, StreamExt, channel::mpsc}; use gpui::{App, AppContext, AsyncApp, Entity, Task}; use language_model::LanguageModelToolSchemaFormat; use language_model::{ diff --git a/crates/assistant_tools/src/edit_files_tool/log.rs b/crates/assistant_tools/src/edit_files_tool/log.rs index 31a3a98c8f..b4c5523d91 100644 --- a/crates/assistant_tools/src/edit_files_tool/log.rs +++ b/crates/assistant_tools/src/edit_files_tool/log.rs @@ -3,13 +3,13 @@ use std::path::Path; use collections::HashSet; use feature_flags::FeatureFlagAppExt; use gpui::{ - actions, list, prelude::*, App, Empty, Entity, EventEmitter, FocusHandle, Focusable, Global, - ListAlignment, ListState, SharedString, Subscription, Window, + App, Empty, Entity, EventEmitter, FocusHandle, Focusable, Global, ListAlignment, ListState, + SharedString, Subscription, Window, actions, list, prelude::*, }; use release_channel::ReleaseChannel; use settings::Settings; use ui::prelude::*; -use workspace::{item::ItemEvent, Item, Workspace, WorkspaceId}; +use workspace::{Item, Workspace, WorkspaceId, item::ItemEvent}; use super::edit_action::EditAction; diff --git a/crates/assistant_tools/src/fetch_tool.rs b/crates/assistant_tools/src/fetch_tool.rs index 62df4860e6..6c24bf3ba1 100644 --- a/crates/assistant_tools/src/fetch_tool.rs +++ b/crates/assistant_tools/src/fetch_tool.rs @@ -3,11 +3,11 @@ use std::rc::Rc; use std::sync::Arc; 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 futures::AsyncReadExt as _; 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 language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use project::Project; diff --git a/crates/assistant_tools/src/find_replace_file_tool.rs b/crates/assistant_tools/src/find_replace_file_tool.rs index 725ae746d7..bed732f060 100644 --- a/crates/assistant_tools/src/find_replace_file_tool.rs +++ b/crates/assistant_tools/src/find_replace_file_tool.rs @@ -1,5 +1,5 @@ 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 gpui::{App, AppContext, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; diff --git a/crates/assistant_tools/src/list_directory_tool.rs b/crates/assistant_tools/src/list_directory_tool.rs index 478dc7e572..81ad0dd801 100644 --- a/crates/assistant_tools/src/list_directory_tool.rs +++ b/crates/assistant_tools/src/list_directory_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; diff --git a/crates/assistant_tools/src/move_path_tool.rs b/crates/assistant_tools/src/move_path_tool.rs index 4377ae0280..9f8e27c60e 100644 --- a/crates/assistant_tools/src/move_path_tool.rs +++ b/crates/assistant_tools/src/move_path_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, AppContext, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; diff --git a/crates/assistant_tools/src/now_tool.rs b/crates/assistant_tools/src/now_tool.rs index 796e2ab15a..e793899855 100644 --- a/crates/assistant_tools/src/now_tool.rs +++ b/crates/assistant_tools/src/now_tool.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use chrono::{Local, Utc}; use gpui::{App, Entity, Task}; diff --git a/crates/assistant_tools/src/open_tool.rs b/crates/assistant_tools/src/open_tool.rs index 5064d3d22f..013ee4fcaf 100644 --- a/crates/assistant_tools/src/open_tool.rs +++ b/crates/assistant_tools/src/open_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, AppContext, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; diff --git a/crates/assistant_tools/src/path_search_tool.rs b/crates/assistant_tools/src/path_search_tool.rs index 649e3d8bde..f7bdb0b8e5 100644 --- a/crates/assistant_tools/src/path_search_tool.rs +++ b/crates/assistant_tools/src/path_search_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, AppContext, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; diff --git a/crates/assistant_tools/src/read_file_tool.rs b/crates/assistant_tools/src/read_file_tool.rs index 267655a1ec..3c8a36dccc 100644 --- a/crates/assistant_tools/src/read_file_tool.rs +++ b/crates/assistant_tools/src/read_file_tool.rs @@ -2,7 +2,7 @@ use std::path::Path; use std::sync::Arc; use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, Entity, Task}; use itertools::Itertools; diff --git a/crates/assistant_tools/src/regex_search_tool.rs b/crates/assistant_tools/src/regex_search_tool.rs index 7886c1b0f9..d300f0ddc1 100644 --- a/crates/assistant_tools/src/regex_search_tool.rs +++ b/crates/assistant_tools/src/regex_search_tool.rs @@ -1,13 +1,13 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use futures::StreamExt; use gpui::{App, Entity, Task}; use language::OffsetRangeExt; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use project::{ - search::{SearchQuery, SearchResult}, Project, + search::{SearchQuery, SearchResult}, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; diff --git a/crates/assistant_tools/src/replace.rs b/crates/assistant_tools/src/replace.rs index 8a11910151..bbfadf981e 100644 --- a/crates/assistant_tools/src/replace.rs +++ b/crates/assistant_tools/src/replace.rs @@ -1,7 +1,7 @@ use language::{BufferSnapshot, Diff, Point, ToOffset}; use project::search::SearchQuery; 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. /// 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)] mod tests { use super::*; - use gpui::prelude::*; use gpui::TestAppContext; + use gpui::prelude::*; use unindent::Unindent; #[gpui::test] diff --git a/crates/assistant_tools/src/schema.rs b/crates/assistant_tools/src/schema.rs index 7c767153fc..10ae594ecd 100644 --- a/crates/assistant_tools/src/schema.rs +++ b/crates/assistant_tools/src/schema.rs @@ -1,8 +1,8 @@ use anyhow::Result; use language_model::LanguageModelToolSchemaFormat; use schemars::{ - schema::{RootSchema, Schema, SchemaObject}, JsonSchema, + schema::{RootSchema, Schema, SchemaObject}, }; pub fn json_schema_for(format: LanguageModelToolSchemaFormat) -> serde_json::Value { diff --git a/crates/assistant_tools/src/symbol_info_tool.rs b/crates/assistant_tools/src/symbol_info_tool.rs index 9fab92497a..b9be2bb8d4 100644 --- a/crates/assistant_tools/src/symbol_info_tool.rs +++ b/crates/assistant_tools/src/symbol_info_tool.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, AsyncApp, Entity, Task}; use language::{self, Anchor, Buffer, BufferSnapshot, Location, Point, ToPoint, ToPointUtf16}; diff --git a/crates/assistant_tools/src/thinking_tool.rs b/crates/assistant_tools/src/thinking_tool.rs index f4a0ab2342..b189edc0b6 100644 --- a/crates/assistant_tools/src/thinking_tool.rs +++ b/crates/assistant_tools/src/thinking_tool.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; diff --git a/crates/audio/src/assets.rs b/crates/audio/src/assets.rs index 19a53bcc0f..58074d6c93 100644 --- a/crates/audio/src/assets.rs +++ b/crates/audio/src/assets.rs @@ -4,8 +4,8 @@ use anyhow::Result; use collections::HashMap; use gpui::{App, AssetSource, Global}; use rodio::{ - source::{Buffered, SamplesConverter}, Decoder, Source, + source::{Buffered, SamplesConverter}, }; type Sound = Buffered>>, f32>>; diff --git a/crates/auto_update/src/auto_update.rs b/crates/auto_update/src/auto_update.rs index 11a699b0b6..77d2037288 100644 --- a/crates/auto_update/src/auto_update.rs +++ b/crates/auto_update/src/auto_update.rs @@ -1,9 +1,9 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use client::{Client, TelemetrySettings}; -use db::kvp::KEY_VALUE_STORE; use db::RELEASE_CHANNEL; +use db::kvp::KEY_VALUE_STORE; 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 paths::remote_servers_dir; @@ -252,9 +252,11 @@ impl AutoUpdater { } pub fn start_polling(&self, cx: &mut Context) -> Task> { - cx.spawn(async move |this, cx| loop { - this.update(cx, |this, cx| this.poll(cx))?; - cx.background_executor().timer(POLL_INTERVAL).await; + cx.spawn(async move |this, cx| { + loop { + this.update(cx, |this, cx| this.poll(cx))?; + cx.background_executor().timer(POLL_INTERVAL).await; + } }) } diff --git a/crates/auto_update_ui/src/auto_update_ui.rs b/crates/auto_update_ui/src/auto_update_ui.rs index 61aebaf8ed..b0fd67add0 100644 --- a/crates/auto_update_ui/src/auto_update_ui.rs +++ b/crates/auto_update_ui/src/auto_update_ui.rs @@ -1,16 +1,16 @@ use auto_update::AutoUpdater; use client::proto::UpdateNotification; 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 markdown_preview::markdown_preview_view::{MarkdownPreviewMode, MarkdownPreviewView}; use release_channel::{AppVersion, ReleaseChannel}; use serde::Deserialize; use smol::io::AsyncReadExt; use util::ResultExt as _; -use workspace::notifications::simple_message_notification::MessageNotification; -use workspace::notifications::{show_app_notification, NotificationId}; use workspace::Workspace; +use workspace::notifications::simple_message_notification::MessageNotification; +use workspace::notifications::{NotificationId, show_app_notification}; actions!(auto_update, [ViewReleaseNotesLocally]); diff --git a/crates/bedrock/src/bedrock.rs b/crates/bedrock/src/bedrock.rs index fa17bc0383..df6701e474 100644 --- a/crates/bedrock/src/bedrock.rs +++ b/crates/bedrock/src/bedrock.rs @@ -2,7 +2,7 @@ mod models; use std::pin::Pin; -use anyhow::{anyhow, Context, Error, Result}; +use anyhow::{Context, Error, Result, anyhow}; use aws_sdk_bedrockruntime as bedrock; pub use aws_sdk_bedrockruntime as bedrock_client; pub use aws_sdk_bedrockruntime::types::{ diff --git a/crates/breadcrumbs/src/breadcrumbs.rs b/crates/breadcrumbs/src/breadcrumbs.rs index 53c8ce7317..78a4d858cc 100644 --- a/crates/breadcrumbs/src/breadcrumbs.rs +++ b/crates/breadcrumbs/src/breadcrumbs.rs @@ -6,10 +6,10 @@ use gpui::{ use itertools::Itertools; use std::cmp; use theme::ActiveTheme; -use ui::{prelude::*, ButtonLike, ButtonStyle, Label, Tooltip}; +use ui::{ButtonLike, ButtonStyle, Label, Tooltip, prelude::*}; use workspace::{ - item::{BreadcrumbText, ItemEvent, ItemHandle}, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, + item::{BreadcrumbText, ItemEvent, ItemHandle}, }; pub struct Breadcrumbs { diff --git a/crates/buffer_diff/src/buffer_diff.rs b/crates/buffer_diff/src/buffer_diff.rs index f5a0b7d6a7..57873e9fba 100644 --- a/crates/buffer_diff/src/buffer_diff.rs +++ b/crates/buffer_diff/src/buffer_diff.rs @@ -1296,7 +1296,7 @@ mod tests { use super::*; use gpui::TestAppContext; 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 unindent::Unindent as _; use util::test::marked_text_ranges; diff --git a/crates/call/src/call_impl/mod.rs b/crates/call/src/call_impl/mod.rs index 0db63b203c..1017bd92be 100644 --- a/crates/call/src/call_impl/mod.rs +++ b/crates/call/src/call_impl/mod.rs @@ -2,11 +2,11 @@ pub mod participant; pub mod room; use crate::call_settings::CallSettings; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; 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 futures::{channel::oneshot, future::Shared, Future, FutureExt}; +use futures::{Future, FutureExt, channel::oneshot, future::Shared}; use gpui::{ App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, Subscription, Task, WeakEntity, diff --git a/crates/call/src/call_impl/participant.rs b/crates/call/src/call_impl/participant.rs index e887aeb329..19b59f48ad 100644 --- a/crates/call/src/call_impl/participant.rs +++ b/crates/call/src/call_impl/participant.rs @@ -1,5 +1,5 @@ -use anyhow::{anyhow, Result}; -use client::{proto, ParticipantIndex, User}; +use anyhow::{Result, anyhow}; +use client::{ParticipantIndex, User, proto}; use collections::HashMap; use gpui::WeakEntity; use livekit_client::AudioStream; diff --git a/crates/call/src/call_impl/room.rs b/crates/call/src/call_impl/room.rs index 3ee7f492a7..0b9e951ae5 100644 --- a/crates/call/src/call_impl/room.rs +++ b/crates/call/src/call_impl/room.rs @@ -2,11 +2,11 @@ use crate::{ call_settings::CallSettings, participant::{LocalParticipant, ParticipantLocation, RemoteParticipant}, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use audio::{Audio, Sound}; use client::{ - proto::{self, PeerId}, ChannelId, Client, ParticipantIndex, TypedEnvelope, User, UserStore, + proto::{self, PeerId}, }; use collections::{BTreeMap, HashMap, HashSet}; use fs::Fs; @@ -20,7 +20,7 @@ use postage::{sink::Sink, stream::Stream, watch}; use project::Project; use settings::Settings as _; use std::{any::Any, future::Future, mem, sync::Arc, time::Duration}; -use util::{post_inc, ResultExt, TryFutureExt}; +use util::{ResultExt, TryFutureExt, post_inc}; pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30); @@ -139,7 +139,7 @@ impl Room { pending_participants: Default::default(), pending_call_count: 0, client_subscriptions: vec![ - client.add_message_handler(cx.weak_entity(), Self::handle_room_updated) + client.add_message_handler(cx.weak_entity(), Self::handle_room_updated), ], _subscriptions: vec![ cx.on_release(Self::released), diff --git a/crates/channel/src/channel.rs b/crates/channel/src/channel.rs index 13b66c7dc3..63865c574e 100644 --- a/crates/channel/src/channel.rs +++ b/crates/channel/src/channel.rs @@ -6,10 +6,10 @@ use client::{Client, UserStore}; use gpui::{App, Entity}; use std::sync::Arc; -pub use channel_buffer::{ChannelBuffer, ChannelBufferEvent, ACKNOWLEDGE_DEBOUNCE_INTERVAL}; +pub use channel_buffer::{ACKNOWLEDGE_DEBOUNCE_INTERVAL, ChannelBuffer, ChannelBufferEvent}; pub use channel_chat::{ - mentions_to_proto, ChannelChat, ChannelChatEvent, ChannelMessage, ChannelMessageId, - MessageParams, + ChannelChat, ChannelChatEvent, ChannelMessage, ChannelMessageId, MessageParams, + mentions_to_proto, }; pub use channel_store::{Channel, ChannelEvent, ChannelMembership, ChannelStore}; diff --git a/crates/channel/src/channel_buffer.rs b/crates/channel/src/channel_buffer.rs index 9cea4a4d48..50420bf297 100644 --- a/crates/channel/src/channel_buffer.rs +++ b/crates/channel/src/channel_buffer.rs @@ -5,8 +5,8 @@ use collections::HashMap; use gpui::{App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Task}; use language::proto::serialize_version; use rpc::{ - proto::{self, PeerId}, AnyProtoClient, TypedEnvelope, + proto::{self, PeerId}, }; use std::{sync::Arc, time::Duration}; use text::BufferId; diff --git a/crates/channel/src/channel_chat.rs b/crates/channel/src/channel_chat.rs index bbf74af697..400f8ff35c 100644 --- a/crates/channel/src/channel_chat.rs +++ b/crates/channel/src/channel_chat.rs @@ -1,9 +1,8 @@ use crate::{Channel, ChannelStore}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use client::{ - proto, + ChannelId, Client, Subscription, TypedEnvelope, UserId, proto, user::{User, UserStore}, - ChannelId, Client, Subscription, TypedEnvelope, UserId, }; use collections::HashSet; use futures::lock::Mutex; @@ -16,7 +15,7 @@ use std::{ }; use sum_tree::{Bias, SumTree}; use time::OffsetDateTime; -use util::{post_inc, ResultExt as _, TryFutureExt}; +use util::{ResultExt as _, TryFutureExt, post_inc}; pub struct ChannelChat { pub channel_id: ChannelId, @@ -339,7 +338,7 @@ impl ChannelChat { .item() .map_or(false, |message| message.id == message_id) { - Some(cursor.start().1 .0) + Some(cursor.start().1.0) } else { None }, @@ -595,7 +594,7 @@ impl ChannelChat { let mut old_cursor = self.messages.cursor::<(ChannelMessageId, Count)>(&()); let mut new_messages = old_cursor.slice(&first_message.id, Bias::Left, &()); - let start_ix = old_cursor.start().1 .0; + let start_ix = old_cursor.start().1.0; let removed_messages = old_cursor.slice(&last_message.id, Bias::Right, &()); let removed_count = removed_messages.summary().count; let new_count = messages.summary().count; @@ -613,7 +612,7 @@ impl ChannelChat { ); while let Some(message) = old_cursor.item() { - let message_ix = old_cursor.start().1 .0; + let message_ix = old_cursor.start().1.0; if nonces.contains(&message.nonce) { if ranges.last().map_or(false, |r| r.end == message_ix) { ranges.last_mut().unwrap().end += 1; diff --git a/crates/channel/src/channel_store.rs b/crates/channel/src/channel_store.rs index 945db550d4..17fa43def5 100644 --- a/crates/channel/src/channel_store.rs +++ b/crates/channel/src/channel_store.rs @@ -1,23 +1,23 @@ mod channel_index; -use crate::{channel_buffer::ChannelBuffer, channel_chat::ChannelChat, ChannelMessage}; -use anyhow::{anyhow, Result}; +use crate::{ChannelMessage, channel_buffer::ChannelBuffer, channel_chat::ChannelChat}; +use anyhow::{Result, anyhow}; use channel_index::ChannelIndex; use client::{ChannelId, Client, ClientSettings, Subscription, User, UserId, UserStore}; -use collections::{hash_map, HashMap, HashSet}; -use futures::{channel::mpsc, future::Shared, Future, FutureExt, StreamExt}; +use collections::{HashMap, HashSet, hash_map}; +use futures::{Future, FutureExt, StreamExt, channel::mpsc, future::Shared}; use gpui::{ App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, SharedString, Task, WeakEntity, }; use language::Capability; use rpc::{ - proto::{self, ChannelRole, ChannelVisibility}, TypedEnvelope, + proto::{self, ChannelRole, ChannelVisibility}, }; use settings::Settings; use std::{mem, sync::Arc, time::Duration}; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30); diff --git a/crates/channel/src/channel_store_tests.rs b/crates/channel/src/channel_store_tests.rs index 779849df24..b7bed8a1a9 100644 --- a/crates/channel/src/channel_store_tests.rs +++ b/crates/channel/src/channel_store_tests.rs @@ -1,7 +1,7 @@ use crate::channel_chat::ChannelChatEvent; use super::*; -use client::{test::FakeServer, Client, UserStore}; +use client::{Client, UserStore, test::FakeServer}; use clock::FakeSystemClock; use gpui::{App, AppContext as _, Entity, SemanticVersion, TestAppContext}; use http_client::FakeHttpClient; diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 40534f318d..17a578bd6c 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -5,7 +5,7 @@ use anyhow::{Context as _, Result}; use clap::Parser; -use cli::{ipc::IpcOneShotServer, CliRequest, CliResponse, IpcHandshake}; +use cli::{CliRequest, CliResponse, IpcHandshake, ipc::IpcOneShotServer}; use collections::HashMap; use parking_lot::Mutex; use std::{ @@ -614,14 +614,14 @@ mod windows { use anyhow::Context; use release_channel::app_identifier; use windows::{ - core::HSTRING, Win32::{ - Foundation::{CloseHandle, GetLastError, ERROR_ALREADY_EXISTS, GENERIC_WRITE}, + Foundation::{CloseHandle, ERROR_ALREADY_EXISTS, GENERIC_WRITE, GetLastError}, Storage::FileSystem::{ - CreateFileW, WriteFile, FILE_FLAGS_AND_ATTRIBUTES, FILE_SHARE_MODE, OPEN_EXISTING, + CreateFileW, FILE_FLAGS_AND_ATTRIBUTES, FILE_SHARE_MODE, OPEN_EXISTING, WriteFile, }, System::Threading::CreateMutexW, }, + core::HSTRING, }; use crate::{Detect, InstalledApp}; @@ -728,14 +728,14 @@ mod windows { #[cfg(target_os = "macos")] mod mac_os { - use anyhow::{anyhow, Context as _, Result}; + use anyhow::{Context as _, Result, anyhow}; use core_foundation::{ array::{CFArray, CFIndex}, base::TCFType as _, string::kCFStringEncodingUTF8, - url::{CFURLCreateWithBytes, CFURL}, + url::{CFURL, CFURLCreateWithBytes}, }; - use core_services::{kLSLaunchDefaults, LSLaunchURLSpec, LSOpenFromURLSpec}; + use core_services::{LSLaunchURLSpec, LSOpenFromURLSpec, kLSLaunchDefaults}; use serde::Deserialize; use std::{ ffi::OsStr, diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs index 35051446e2..196a38e31f 100644 --- a/crates/client/src/client.rs +++ b/crates/client/src/client.rs @@ -6,7 +6,7 @@ pub mod telemetry; pub mod user; pub mod zed_urls; -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use async_recursion::async_recursion; use async_tungstenite::tungstenite::{ client::IntoClientRequest, @@ -17,10 +17,10 @@ use chrono::{DateTime, Utc}; use clock::SystemClock; use credentials_provider::CredentialsProvider; use futures::{ - channel::oneshot, future::BoxFuture, AsyncReadExt, FutureExt, SinkExt, Stream, StreamExt, - TryFutureExt as _, TryStreamExt, + AsyncReadExt, FutureExt, SinkExt, Stream, StreamExt, TryFutureExt as _, TryStreamExt, + channel::oneshot, future::BoxFuture, }; -use gpui::{actions, App, AppContext as _, AsyncApp, Entity, Global, Task, WeakEntity}; +use gpui::{App, AppContext as _, AsyncApp, Entity, Global, Task, WeakEntity, actions}; use http_client::{AsyncBody, HttpClient, HttpClientWithUrl}; use parking_lot::RwLock; use postage::watch; @@ -40,8 +40,8 @@ use std::{ marker::PhantomData, path::PathBuf, sync::{ - atomic::{AtomicU64, Ordering}, Arc, LazyLock, Weak, + atomic::{AtomicU64, Ordering}, }, time::{Duration, Instant}, }; diff --git a/crates/client/src/socks.rs b/crates/client/src/socks.rs index 45126697d4..722e06a2f7 100644 --- a/crates/client/src/socks.rs +++ b/crates/client/src/socks.rs @@ -1,5 +1,5 @@ //! socks proxy -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use futures::io::{AsyncRead, AsyncWrite}; use http_client::Uri; use tokio_socks::{ diff --git a/crates/client/src/test.rs b/crates/client/src/test.rs index 2f23d43ae3..825c0f43b4 100644 --- a/crates/client/src/test.rs +++ b/crates/client/src/test.rs @@ -1,12 +1,12 @@ use crate::{Client, Connection, Credentials, EstablishConnectionError, UserStore}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use chrono::Duration; -use futures::{stream::BoxStream, StreamExt}; +use futures::{StreamExt, stream::BoxStream}; use gpui::{AppContext as _, BackgroundExecutor, Entity, TestAppContext}; use parking_lot::Mutex; use rpc::{ - proto::{self, GetPrivateUserInfo, GetPrivateUserInfoResponse}, ConnectionId, Peer, Receipt, TypedEnvelope, + proto::{self, GetPrivateUserInfo, GetPrivateUserInfoResponse}, }; use std::sync::Arc; diff --git a/crates/client/src/user.rs b/crates/client/src/user.rs index de5141b104..b213354a1b 100644 --- a/crates/client/src/user.rs +++ b/crates/client/src/user.rs @@ -1,9 +1,9 @@ -use super::{proto, Client, Status, TypedEnvelope}; -use anyhow::{anyhow, Context as _, Result}; +use super::{Client, Status, TypedEnvelope, proto}; +use anyhow::{Context as _, Result, anyhow}; use chrono::{DateTime, Utc}; -use collections::{hash_map::Entry, HashMap, HashSet}; +use collections::{HashMap, HashSet, hash_map::Entry}; use feature_flags::FeatureFlagAppExt; -use futures::{channel::mpsc, Future, StreamExt}; +use futures::{Future, StreamExt, channel::mpsc}; use gpui::{ App, AsyncApp, Context, Entity, EventEmitter, SharedString, SharedUri, Task, WeakEntity, }; diff --git a/crates/collab/src/api.rs b/crates/collab/src/api.rs index 2b8b5ac6fb..fde0d64eae 100644 --- a/crates/collab/src/api.rs +++ b/crates/collab/src/api.rs @@ -6,12 +6,13 @@ pub mod ips_file; pub mod slack; use crate::{ - auth, + AppState, Error, Result, auth, db::{User, UserId}, - rpc, AppState, Error, Result, + rpc, }; use anyhow::anyhow; use axum::{ + Extension, Json, Router, body::Body, extract::{Path, Query}, headers::Header, @@ -19,7 +20,6 @@ use axum::{ middleware::{self, Next}, response::IntoResponse, routing::{get, post}, - Extension, Json, Router, }; use axum_extra::response::ErasedJson; use serde::{Deserialize, Serialize}; diff --git a/crates/collab/src/api/billing.rs b/crates/collab/src/api/billing.rs index 2561767a3f..4115c999a9 100644 --- a/crates/collab/src/api/billing.rs +++ b/crates/collab/src/api/billing.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, bail, Context}; +use anyhow::{Context, anyhow, bail}; use axum::{ + Extension, Json, Router, extract::{self, Query}, routing::{get, post}, - Extension, Json, Router, }; use chrono::{DateTime, SecondsFormat, Utc}; use collections::HashSet; @@ -24,17 +24,16 @@ use crate::api::events::SnowflakeRow; use crate::db::billing_subscription::{StripeCancellationReason, StripeSubscriptionStatus}; use crate::llm::{DEFAULT_MAX_MONTHLY_SPEND, FREE_TIER_MONTHLY_SPENDING_LIMIT}; use crate::rpc::{ResultExt as _, Server}; +use crate::{AppState, Cents, Error, Result}; use crate::{db::UserId, llm::db::LlmDatabase}; use crate::{ db::{ - billing_customer, BillingSubscriptionId, CreateBillingCustomerParams, - CreateBillingSubscriptionParams, CreateProcessedStripeEventParams, - UpdateBillingCustomerParams, UpdateBillingPreferencesParams, - UpdateBillingSubscriptionParams, + BillingSubscriptionId, CreateBillingCustomerParams, CreateBillingSubscriptionParams, + CreateProcessedStripeEventParams, UpdateBillingCustomerParams, + UpdateBillingPreferencesParams, UpdateBillingSubscriptionParams, billing_customer, }, stripe_billing::StripeBilling, }; -use crate::{AppState, Cents, Error, Result}; pub fn router() -> Router { Router::new() diff --git a/crates/collab/src/api/contributors.rs b/crates/collab/src/api/contributors.rs index 51d0e060df..70b1590195 100644 --- a/crates/collab/src/api/contributors.rs +++ b/crates/collab/src/api/contributors.rs @@ -2,9 +2,9 @@ use std::sync::{Arc, OnceLock}; use anyhow::anyhow; use axum::{ + Extension, Json, Router, extract::{self, Query}, routing::get, - Extension, Json, Router, }; use chrono::{NaiveDateTime, SecondsFormat}; use serde::{Deserialize, Serialize}; diff --git a/crates/collab/src/api/events.rs b/crates/collab/src/api/events.rs index c7792690f8..04515ae44d 100644 --- a/crates/collab/src/api/events.rs +++ b/crates/collab/src/api/events.rs @@ -1,14 +1,14 @@ use super::ips_file::IpsFile; use crate::api::CloudflareIpCountryHeader; -use crate::{api::slack, AppState, Error, Result}; +use crate::{AppState, Error, Result, api::slack}; use anyhow::anyhow; use aws_sdk_s3::primitives::ByteStream; use axum::{ + Extension, Router, TypedHeader, body::Bytes, headers::Header, http::{HeaderMap, HeaderName, StatusCode}, routing::post, - Extension, Router, TypedHeader, }; use chrono::Duration; use semantic_version::SemanticVersion; diff --git a/crates/collab/src/api/extensions.rs b/crates/collab/src/api/extensions.rs index 73aea45340..034c8dcd3a 100644 --- a/crates/collab/src/api/extensions.rs +++ b/crates/collab/src/api/extensions.rs @@ -1,13 +1,13 @@ use crate::db::ExtensionVersionConstraints; -use crate::{db::NewExtensionVersion, AppState, Error, Result}; -use anyhow::{anyhow, Context as _}; +use crate::{AppState, Error, Result, db::NewExtensionVersion}; +use anyhow::{Context as _, anyhow}; use aws_sdk_s3::presigning::PresigningConfig; use axum::{ + Extension, Json, Router, extract::{Path, Query}, http::StatusCode, response::Redirect, routing::get, - Extension, Json, Router, }; use collections::{BTreeSet, HashMap}; use rpc::{ExtensionApiManifest, ExtensionProvides, GetExtensionsResponse}; @@ -16,7 +16,7 @@ use serde::Deserialize; use std::str::FromStr; use std::{sync::Arc, time::Duration}; use time::PrimitiveDateTime; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; pub fn router() -> Router { Router::new() diff --git a/crates/collab/src/auth.rs b/crates/collab/src/auth.rs index 0c50564769..ee411d855c 100644 --- a/crates/collab/src/auth.rs +++ b/crates/collab/src/auth.rs @@ -1,20 +1,20 @@ use crate::{ + AppState, Error, Result, db::{self, AccessTokenId, Database, UserId}, rpc::Principal, - AppState, Error, Result, }; -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use axum::{ http::{self, Request, StatusCode}, middleware::Next, response::IntoResponse, }; use base64::prelude::*; -use prometheus::{exponential_buckets, register_histogram, Histogram}; +use prometheus::{Histogram, exponential_buckets, register_histogram}; pub use rpc::auth::random_token; use scrypt::{ - password_hash::{PasswordHash, PasswordVerifier}, Scrypt, + password_hash::{PasswordHash, PasswordVerifier}, }; use serde::{Deserialize, Serialize}; use sha2::Digest; @@ -232,7 +232,7 @@ mod test { use sea_orm::EntityTrait; use super::*; - use crate::db::{access_token, NewUserParams}; + use crate::db::{NewUserParams, access_token}; #[gpui::test] async fn test_verify_access_token(cx: &mut gpui::TestAppContext) { diff --git a/crates/collab/src/db.rs b/crates/collab/src/db.rs index fa90239d9c..764eec401e 100644 --- a/crates/collab/src/db.rs +++ b/crates/collab/src/db.rs @@ -4,24 +4,24 @@ mod tables; #[cfg(test)] pub mod tests; -use crate::{executor::Executor, Error, Result}; +use crate::{Error, Result, executor::Executor}; use anyhow::anyhow; use collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use dashmap::DashMap; use futures::StreamExt; use project_repository_statuses::StatusKind; -use rand::{prelude::StdRng, Rng, SeedableRng}; +use rand::{Rng, SeedableRng, prelude::StdRng}; use rpc::ExtensionProvides; use rpc::{ - proto::{self}, ConnectionId, ExtensionMetadata, + proto::{self}, }; use sea_orm::{ - entity::prelude::*, - sea_query::{Alias, Expr, OnConflict}, ActiveValue, Condition, ConnectionTrait, DatabaseConnection, DatabaseTransaction, DbErr, FromQueryResult, IntoActiveModel, IsolationLevel, JoinType, QueryOrder, QuerySelect, Statement, TransactionTrait, + entity::prelude::*, + sea_query::{Alias, Expr, OnConflict}, }; use semantic_version::SemanticVersion; use serde::{Deserialize, Serialize}; diff --git a/crates/collab/src/db/ids.rs b/crates/collab/src/db/ids.rs index 698b1c5693..2ba7ec1051 100644 --- a/crates/collab/src/db/ids.rs +++ b/crates/collab/src/db/ids.rs @@ -1,6 +1,6 @@ use crate::Result; use rpc::proto; -use sea_orm::{entity::prelude::*, DbErr}; +use sea_orm::{DbErr, entity::prelude::*}; use serde::{Deserialize, Serialize}; #[macro_export] diff --git a/crates/collab/src/db/queries/channels.rs b/crates/collab/src/db/queries/channels.rs index da301090ca..a21f85d4f8 100644 --- a/crates/collab/src/db/queries/channels.rs +++ b/crates/collab/src/db/queries/channels.rs @@ -1,7 +1,7 @@ use super::*; use rpc::{ - proto::{channel_member::Kind, ChannelBufferVersion, VectorClockEntry}, ErrorCode, ErrorCodeExt, + proto::{ChannelBufferVersion, VectorClockEntry, channel_member::Kind}, }; use sea_orm::{DbBackend, TryGetableMany}; diff --git a/crates/collab/src/db/queries/messages.rs b/crates/collab/src/db/queries/messages.rs index e4f6e0f497..8e5c4ba851 100644 --- a/crates/collab/src/db/queries/messages.rs +++ b/crates/collab/src/db/queries/messages.rs @@ -480,7 +480,7 @@ impl Database { self.notification_kinds_by_id .iter() .find(|(_, kind)| **kind == notification_kind) - .map(|kind| kind.0 .0) + .map(|kind| kind.0.0) } /// Removes the channel message with the given ID. diff --git a/crates/collab/src/db/tables/channel_member.rs b/crates/collab/src/db/tables/channel_member.rs index 5498a00856..a00a380d55 100644 --- a/crates/collab/src/db/tables/channel_member.rs +++ b/crates/collab/src/db/tables/channel_member.rs @@ -1,4 +1,4 @@ -use crate::db::{channel_member, ChannelId, ChannelMemberId, ChannelRole, UserId}; +use crate::db::{ChannelId, ChannelMemberId, ChannelRole, UserId, channel_member}; use sea_orm::entity::prelude::*; #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] diff --git a/crates/collab/src/db/tests.rs b/crates/collab/src/db/tests.rs index 52370c0956..cb27e15d6b 100644 --- a/crates/collab/src/db/tests.rs +++ b/crates/collab/src/db/tests.rs @@ -20,8 +20,8 @@ use parking_lot::Mutex; use sea_orm::ConnectionTrait; use sqlx::migrate::MigrateDatabase; use std::sync::{ - atomic::{AtomicI32, AtomicU32, Ordering::SeqCst}, Arc, + atomic::{AtomicI32, AtomicU32, Ordering::SeqCst}, }; pub struct TestDb { diff --git a/crates/collab/src/db/tests/buffer_tests.rs b/crates/collab/src/db/tests/buffer_tests.rs index 63986b8efc..13c440d437 100644 --- a/crates/collab/src/db/tests/buffer_tests.rs +++ b/crates/collab/src/db/tests/buffer_tests.rs @@ -111,10 +111,11 @@ async fn test_channel_buffers(db: &Arc) { assert_eq!(buffer_b.text(), "hello, cruel world"); // Ensure that C fails to open the buffer - assert!(db - .join_channel_buffer(zed_id, c_id, ConnectionId { owner_id, id: 3 }) - .await - .is_err()); + assert!( + db.join_channel_buffer(zed_id, c_id, ConnectionId { owner_id, id: 3 }) + .await + .is_err() + ); // Ensure that both collaborators have shown up assert_eq!( diff --git a/crates/collab/src/db/tests/channel_tests.rs b/crates/collab/src/db/tests/channel_tests.rs index 387454a784..a4ff43bb37 100644 --- a/crates/collab/src/db/tests/channel_tests.rs +++ b/crates/collab/src/db/tests/channel_tests.rs @@ -1,13 +1,13 @@ use crate::{ db::{ - tests::{channel_tree, new_test_connection, new_test_user}, Channel, ChannelId, ChannelRole, Database, NewUserParams, RoomId, UserId, + tests::{channel_tree, new_test_connection, new_test_user}, }, test_both_dbs, }; use rpc::{ - proto::{self}, ConnectionId, + proto::{self}, }; use std::sync::Arc; @@ -142,10 +142,11 @@ async fn test_joining_channels(db: &Arc) { let room_id = RoomId::from_proto(joined_room.room.id); drop(joined_room); // cannot join a room without membership to its channel - assert!(db - .join_room(room_id, user_2, ConnectionId { owner_id, id: 1 },) - .await - .is_err()); + assert!( + db.join_room(room_id, user_2, ConnectionId { owner_id, id: 1 },) + .await + .is_err() + ); } test_both_dbs!( @@ -547,8 +548,8 @@ async fn test_user_is_channel_participant(db: &Arc) { db.set_channel_member_role(zed_channel, admin, guest, ChannelRole::Banned) .await .unwrap(); - assert!(db - .transaction(|tx| async move { + assert!( + db.transaction(|tx| async move { db.check_user_is_channel_participant( &db.get_channel_internal(public_channel_id, &tx) .await @@ -559,7 +560,8 @@ async fn test_user_is_channel_participant(db: &Arc) { .await }) .await - .is_err()); + .is_err() + ); let (mut members, _) = db .get_channel_participant_details(public_channel_id, "", 100, admin) @@ -640,8 +642,8 @@ async fn test_user_is_channel_participant(db: &Arc) { }) .await .unwrap(); - assert!(db - .transaction(|tx| async move { + assert!( + db.transaction(|tx| async move { db.check_user_is_channel_participant( &db.get_channel_internal(internal_channel_id, &tx) .await @@ -652,7 +654,8 @@ async fn test_user_is_channel_participant(db: &Arc) { .await }) .await - .is_err(),); + .is_err(), + ); db.transaction(|tx| async move { db.check_user_is_channel_participant( @@ -720,19 +723,21 @@ async fn test_guest_access(db: &Arc) { .await .unwrap(); - assert!(db - .join_channel_chat(zed_channel, guest_connection, guest) - .await - .is_err()); + assert!( + db.join_channel_chat(zed_channel, guest_connection, guest) + .await + .is_err() + ); db.join_channel(zed_channel, guest, guest_connection) .await .unwrap(); - assert!(db - .join_channel_chat(zed_channel, guest_connection, guest) - .await - .is_ok()) + assert!( + db.join_channel_chat(zed_channel, guest_connection, guest) + .await + .is_ok() + ) } #[track_caller] diff --git a/crates/collab/src/db/tests/embedding_tests.rs b/crates/collab/src/db/tests/embedding_tests.rs index fcafac625d..8659d4b4a1 100644 --- a/crates/collab/src/db/tests/embedding_tests.rs +++ b/crates/collab/src/db/tests/embedding_tests.rs @@ -1,7 +1,7 @@ use super::TestDb; use crate::db::embedding; use collections::HashMap; -use sea_orm::{sea_query::Expr, ColumnTrait, EntityTrait, QueryFilter}; +use sea_orm::{ColumnTrait, EntityTrait, QueryFilter, sea_query::Expr}; use std::ops::Sub; use time::{Duration, OffsetDateTime, PrimitiveDateTime}; diff --git a/crates/collab/src/db/tests/extension_tests.rs b/crates/collab/src/db/tests/extension_tests.rs index 460d74ffc0..9396b405fd 100644 --- a/crates/collab/src/db/tests/extension_tests.rs +++ b/crates/collab/src/db/tests/extension_tests.rs @@ -6,7 +6,7 @@ use rpc::ExtensionProvides; use super::Database; use crate::db::ExtensionVersionConstraints; use crate::{ - db::{queries::extensions::convert_time_to_chrono, ExtensionMetadata, NewExtensionVersion}, + db::{ExtensionMetadata, NewExtensionVersion, queries::extensions::convert_time_to_chrono}, test_both_dbs, }; @@ -162,10 +162,11 @@ async fn test_extensions(db: &Arc) { } // Record download returns false if the extension does not exist. - assert!(!db - .record_extension_download("no-such-extension", "0.0.2") - .await - .unwrap()); + assert!( + !db.record_extension_download("no-such-extension", "0.0.2") + .await + .unwrap() + ); // Extensions are returned in descending order of total downloads. let extensions = db.get_extensions(None, None, 1, 5).await.unwrap(); diff --git a/crates/collab/src/env.rs b/crates/collab/src/env.rs index aaefd43df5..bf9290e8d7 100644 --- a/crates/collab/src/env.rs +++ b/crates/collab/src/env.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use std::fs; use std::path::Path; diff --git a/crates/collab/src/llm.rs b/crates/collab/src/llm.rs index aa513c099f..1665d2e54b 100644 --- a/crates/collab/src/llm.rs +++ b/crates/collab/src/llm.rs @@ -2,30 +2,30 @@ mod authorization; pub mod db; mod token; -use crate::api::events::SnowflakeRow; use crate::api::CloudflareIpCountryHeader; +use crate::api::events::SnowflakeRow; use crate::build_kinesis_client; use crate::rpc::MIN_ACCOUNT_AGE_FOR_LLM_USE; -use crate::{db::UserId, executor::Executor, Cents, Config, Error, Result}; -use anyhow::{anyhow, Context as _}; +use crate::{Cents, Config, Error, Result, db::UserId, executor::Executor}; +use anyhow::{Context as _, anyhow}; use authorization::authorize_access_to_language_model; use axum::routing::get; use axum::{ + Extension, Json, Router, TypedHeader, body::Body, http::{self, HeaderName, HeaderValue, Request, StatusCode}, middleware::{self, Next}, response::{IntoResponse, Response}, routing::post, - Extension, Json, Router, TypedHeader, }; use chrono::{DateTime, Duration, Utc}; use collections::HashMap; use db::TokenUsage; -use db::{usage_measure::UsageMeasure, ActiveUserCount, LlmDatabase}; +use db::{ActiveUserCount, LlmDatabase, usage_measure::UsageMeasure}; use futures::{Stream, StreamExt as _}; use reqwest_client::ReqwestClient; use rpc::{ - proto::Plan, LanguageModelProvider, PerformCompletionParams, EXPIRED_LLM_TOKEN_HEADER_NAME, + EXPIRED_LLM_TOKEN_HEADER_NAME, LanguageModelProvider, PerformCompletionParams, proto::Plan, }; use rpc::{ListModelsResponse, MAX_LLM_MONTHLY_SPEND_REACHED_HEADER_NAME}; use serde_json::json; diff --git a/crates/collab/src/llm/db.rs b/crates/collab/src/llm/db.rs index 4374214c1b..6a46184171 100644 --- a/crates/collab/src/llm/db.rs +++ b/crates/collab/src/llm/db.rs @@ -21,15 +21,15 @@ use std::sync::Arc; use anyhow::anyhow; pub use queries::usages::{ActiveUserCount, TokenUsage}; -use sea_orm::prelude::*; pub use sea_orm::ConnectOptions; +use sea_orm::prelude::*; use sea_orm::{ ActiveValue, DatabaseConnection, DatabaseTransaction, IsolationLevel, TransactionTrait, }; +use crate::Result; use crate::db::TransactionHandle; use crate::executor::Executor; -use crate::Result; /// The database for the LLM service. pub struct LlmDatabase { diff --git a/crates/collab/src/llm/db/ids.rs b/crates/collab/src/llm/db/ids.rs index 67f2a49380..03cab6cee0 100644 --- a/crates/collab/src/llm/db/ids.rs +++ b/crates/collab/src/llm/db/ids.rs @@ -1,4 +1,4 @@ -use sea_orm::{entity::prelude::*, DbErr}; +use sea_orm::{DbErr, entity::prelude::*}; use serde::{Deserialize, Serialize}; use crate::id_type; diff --git a/crates/collab/src/llm/db/queries/providers.rs b/crates/collab/src/llm/db/queries/providers.rs index 7e51061cee..9c7dbdd184 100644 --- a/crates/collab/src/llm/db/queries/providers.rs +++ b/crates/collab/src/llm/db/queries/providers.rs @@ -1,5 +1,5 @@ use super::*; -use sea_orm::{sea_query::OnConflict, QueryOrder}; +use sea_orm::{QueryOrder, sea_query::OnConflict}; use std::str::FromStr; use strum::IntoEnumIterator as _; diff --git a/crates/collab/src/llm/db/tests/billing_tests.rs b/crates/collab/src/llm/db/tests/billing_tests.rs index b76121887c..3a95610bc2 100644 --- a/crates/collab/src/llm/db/tests/billing_tests.rs +++ b/crates/collab/src/llm/db/tests/billing_tests.rs @@ -1,10 +1,11 @@ use crate::{ + Cents, db::UserId, llm::{ - db::{queries::providers::ModelParams, LlmDatabase, TokenUsage}, FREE_TIER_MONTHLY_SPENDING_LIMIT, + db::{LlmDatabase, TokenUsage, queries::providers::ModelParams}, }, - test_llm_db, Cents, + test_llm_db, }; use chrono::{DateTime, Utc}; use pretty_assertions::assert_eq; diff --git a/crates/collab/src/llm/db/tests/usage_tests.rs b/crates/collab/src/llm/db/tests/usage_tests.rs index 3213c26e82..7e3d1ab502 100644 --- a/crates/collab/src/llm/db/tests/usage_tests.rs +++ b/crates/collab/src/llm/db/tests/usage_tests.rs @@ -1,11 +1,12 @@ use crate::llm::FREE_TIER_MONTHLY_SPENDING_LIMIT; use crate::{ + Cents, db::UserId, llm::db::{ - queries::{providers::ModelParams, usages::Usage}, LlmDatabase, TokenUsage, + queries::{providers::ModelParams, usages::Usage}, }, - test_llm_db, Cents, + test_llm_db, }; use chrono::{DateTime, Duration, Utc}; use pretty_assertions::assert_eq; diff --git a/crates/collab/src/llm/token.rs b/crates/collab/src/llm/token.rs index 068e5f333e..68005a2d4c 100644 --- a/crates/collab/src/llm/token.rs +++ b/crates/collab/src/llm/token.rs @@ -1,8 +1,8 @@ +use crate::Cents; use crate::db::user; use crate::llm::{DEFAULT_MAX_MONTHLY_SPEND, FREE_TIER_MONTHLY_SPENDING_LIMIT}; -use crate::Cents; -use crate::{db::billing_preference, Config}; -use anyhow::{anyhow, Result}; +use crate::{Config, db::billing_preference}; +use anyhow::{Result, anyhow}; use chrono::{NaiveDateTime, Utc}; use jsonwebtoken::{DecodingKey, EncodingKey, Header, Validation}; use serde::{Deserialize, Serialize}; diff --git a/crates/collab/src/main.rs b/crates/collab/src/main.rs index d552bba68e..30dab40cce 100644 --- a/crates/collab/src/main.rs +++ b/crates/collab/src/main.rs @@ -1,22 +1,22 @@ use anyhow::anyhow; use axum::headers::HeaderMapExt; use axum::{ + Extension, Router, extract::MatchedPath, http::{Request, Response}, routing::get, - Extension, Router, }; -use collab::api::billing::sync_llm_usage_with_stripe_periodically; use collab::api::CloudflareIpCountryHeader; +use collab::api::billing::sync_llm_usage_with_stripe_periodically; use collab::llm::{db::LlmDatabase, log_usage_periodically}; use collab::migrations::run_database_migrations; use collab::user_backfiller::spawn_user_backfiller; -use collab::{api::billing::poll_stripe_events_periodically, llm::LlmState, ServiceMode}; use collab::{ - api::fetch_extensions_from_blob_store_periodically, db, env, executor::Executor, - rpc::ResultExt, AppState, Config, RateLimiter, Result, + AppState, Config, RateLimiter, Result, api::fetch_extensions_from_blob_store_periodically, db, + env, executor::Executor, rpc::ResultExt, }; +use collab::{ServiceMode, api::billing::poll_stripe_events_periodically, llm::LlmState}; use db::Database; use std::{ env::args, @@ -29,9 +29,9 @@ use std::{ use tokio::signal::unix::SignalKind; use tower_http::trace::TraceLayer; use tracing_subscriber::{ - filter::EnvFilter, fmt::format::JsonFields, util::SubscriberInitExt, Layer, + Layer, filter::EnvFilter, fmt::format::JsonFields, util::SubscriberInitExt, }; -use util::{maybe, ResultExt as _}; +use util::{ResultExt as _, maybe}; const VERSION: &str = env!("CARGO_PKG_VERSION"); const REVISION: Option<&'static str> = option_env!("GITHUB_SHA"); diff --git a/crates/collab/src/migrations.rs b/crates/collab/src/migrations.rs index 56200500cf..a9285c7564 100644 --- a/crates/collab/src/migrations.rs +++ b/crates/collab/src/migrations.rs @@ -1,11 +1,11 @@ use std::path::Path; use std::time::Duration; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::HashMap; use sea_orm::ConnectOptions; -use sqlx::migrate::{Migrate, Migration, MigrationSource}; use sqlx::Connection; +use sqlx::migrate::{Migrate, Migration, MigrationSource}; /// Runs the database migrations for the specified database. pub async fn run_database_migrations( diff --git a/crates/collab/src/rate_limiter.rs b/crates/collab/src/rate_limiter.rs index 21f8d0318f..889910f8ea 100644 --- a/crates/collab/src/rate_limiter.rs +++ b/crates/collab/src/rate_limiter.rs @@ -1,4 +1,4 @@ -use crate::{db::UserId, executor::Executor, Database, Error, Result}; +use crate::{Database, Error, Result, db::UserId, executor::Executor}; use chrono::{DateTime, Duration, Utc}; use dashmap::{DashMap, DashSet}; use rpc::ErrorCodeExt; diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs index 429b744224..7f2c5c782d 100644 --- a/crates/collab/src/rpc.rs +++ b/crates/collab/src/rpc.rs @@ -3,7 +3,7 @@ mod connection_pool; use crate::api::{CloudflareIpCountryHeader, SystemIdHeader}; use crate::llm::LlmTokenClaims; use crate::{ - auth, + AppState, Config, Error, RateLimit, Result, auth, db::{ self, BufferId, Capability, Channel, ChannelId, ChannelRole, ChannelsForUser, CreatedChannelMessage, Database, InviteMemberResult, MembershipUpdated, MessageId, @@ -11,47 +11,46 @@ use crate::{ RespondToChannelInvite, RoomId, ServerId, UpdatedChannelMessage, User, UserId, }, executor::Executor, - AppState, Config, Error, RateLimit, Result, }; -use anyhow::{anyhow, bail, Context as _}; +use anyhow::{Context as _, anyhow, bail}; use async_tungstenite::tungstenite::{ - protocol::CloseFrame as TungsteniteCloseFrame, Message as TungsteniteMessage, + Message as TungsteniteMessage, protocol::CloseFrame as TungsteniteCloseFrame, }; use axum::{ + Extension, Router, TypedHeader, body::Body, extract::{ - ws::{CloseFrame as AxumCloseFrame, Message as AxumMessage}, ConnectInfo, WebSocketUpgrade, + ws::{CloseFrame as AxumCloseFrame, Message as AxumMessage}, }, headers::{Header, HeaderName}, http::StatusCode, middleware, response::IntoResponse, routing::get, - Extension, Router, TypedHeader, }; use chrono::Utc; use collections::{HashMap, HashSet}; pub use connection_pool::{ConnectionPool, ZedVersion}; use core::fmt::{self, Debug, Formatter}; use http_client::HttpClient; -use open_ai::{OpenAiEmbeddingModel, OPEN_AI_API_URL}; +use open_ai::{OPEN_AI_API_URL, OpenAiEmbeddingModel}; use reqwest_client::ReqwestClient; use rpc::proto::split_repository_update; use sha2::Digest; use supermaven_api::{CreateExternalUserRequest, SupermavenAdminApi}; use futures::{ - channel::oneshot, future::BoxFuture, stream::FuturesUnordered, FutureExt, SinkExt, StreamExt, - TryStreamExt, + FutureExt, SinkExt, StreamExt, TryStreamExt, channel::oneshot, future::BoxFuture, + stream::FuturesUnordered, }; -use prometheus::{register_int_gauge, IntGauge}; +use prometheus::{IntGauge, register_int_gauge}; use rpc::{ + Connection, ConnectionId, ErrorCode, ErrorCodeExt, ErrorExt, Peer, Receipt, TypedEnvelope, proto::{ self, Ack, AnyTypedEnvelope, EntityMessage, EnvelopedMessage, LiveKitConnectionInfo, RequestMessage, ShareProject, UpdateChannelBufferCollaborators, }, - Connection, ConnectionId, ErrorCode, ErrorCodeExt, ErrorExt, Peer, Receipt, TypedEnvelope, }; use semantic_version::SemanticVersion; use serde::{Serialize, Serializer}; @@ -64,17 +63,18 @@ use std::{ ops::{Deref, DerefMut}, rc::Rc, sync::{ - atomic::{AtomicBool, Ordering::SeqCst}, Arc, OnceLock, + atomic::{AtomicBool, Ordering::SeqCst}, }, time::{Duration, Instant}, }; use time::OffsetDateTime; -use tokio::sync::{watch, MutexGuard, Semaphore}; +use tokio::sync::{MutexGuard, Semaphore, watch}; use tower::ServiceBuilder; use tracing::{ + Instrument, field::{self}, - info_span, instrument, Instrument, + info_span, instrument, }; pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30); @@ -1115,7 +1115,7 @@ pub async fn handle_websocket_request( .into_response(); } - let Some(version) = app_version_header.map(|header| ZedVersion(header.0 .0)) else { + let Some(version) = app_version_header.map(|header| ZedVersion(header.0.0)) else { return ( StatusCode::UPGRADE_REQUIRED, "no version header found".to_string(), diff --git a/crates/collab/src/rpc/connection_pool.rs b/crates/collab/src/rpc/connection_pool.rs index 6af90770dc..e21d3d4f40 100644 --- a/crates/collab/src/rpc/connection_pool.rs +++ b/crates/collab/src/rpc/connection_pool.rs @@ -1,5 +1,5 @@ use crate::db::{ChannelId, ChannelRole, UserId}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::{BTreeMap, HashMap, HashSet}; use rpc::ConnectionId; use semantic_version::SemanticVersion; @@ -159,12 +159,13 @@ impl ConnectionPool { #[cfg(test)] pub fn check_invariants(&self) { for (connection_id, connection) in &self.connections { - assert!(self - .connected_users - .get(&connection.user_id) - .unwrap() - .connection_ids - .contains(connection_id)); + assert!( + self.connected_users + .get(&connection.user_id) + .unwrap() + .connection_ids + .contains(connection_id) + ); } for (user_id, state) in &self.connected_users { diff --git a/crates/collab/src/seed.rs b/crates/collab/src/seed.rs index ce5d99bbe0..b9322a5d81 100644 --- a/crates/collab/src/seed.rs +++ b/crates/collab/src/seed.rs @@ -3,7 +3,7 @@ use crate::db::{self, ChannelRole, NewUserParams}; use anyhow::Context as _; use chrono::{DateTime, Utc}; use db::Database; -use serde::{de::DeserializeOwned, Deserialize}; +use serde::{Deserialize, de::DeserializeOwned}; use std::{fs, path::Path}; use crate::Config; diff --git a/crates/collab/src/stripe_billing.rs b/crates/collab/src/stripe_billing.rs index 9f561ab1b2..8ad5105c9b 100644 --- a/crates/collab/src/stripe_billing.rs +++ b/crates/collab/src/stripe_billing.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use crate::{llm, Cents, Result}; +use crate::{Cents, Result, llm}; use anyhow::Context as _; use chrono::{Datelike, Utc}; use collections::HashMap; diff --git a/crates/collab/src/tests.rs b/crates/collab/src/tests.rs index 8a57d07a45..5a9af2a622 100644 --- a/crates/collab/src/tests.rs +++ b/crates/collab/src/tests.rs @@ -20,9 +20,9 @@ mod randomized_test_helpers; mod remote_editing_collaboration_tests; mod test_server; -use language::{tree_sitter_rust, Language, LanguageConfig, LanguageMatcher}; +use language::{Language, LanguageConfig, LanguageMatcher, tree_sitter_rust}; pub use randomized_test_helpers::{ - run_randomized_test, save_randomized_test_plan, RandomizedTest, TestError, UserTestPlan, + RandomizedTest, TestError, UserTestPlan, run_randomized_test, save_randomized_test_plan, }; pub use test_server::{TestClient, TestServer}; diff --git a/crates/collab/src/tests/channel_buffer_tests.rs b/crates/collab/src/tests/channel_buffer_tests.rs index 6286670d3d..4ed2745aa5 100644 --- a/crates/collab/src/tests/channel_buffer_tests.rs +++ b/crates/collab/src/tests/channel_buffer_tests.rs @@ -1,6 +1,6 @@ use crate::{ rpc::{CLEANUP_TIMEOUT, RECONNECT_TIMEOUT}, - tests::{test_server::open_channel_notes, TestServer}, + tests::{TestServer, test_server::open_channel_notes}, }; use call::ActiveCall; use channel::ACKNOWLEDGE_DEBOUNCE_INTERVAL; @@ -10,7 +10,7 @@ use collections::HashMap; use editor::{Anchor, Editor, ToOffset}; use futures::future; use gpui::{BackgroundExecutor, Context, Entity, TestAppContext, Window}; -use rpc::{proto::PeerId, RECEIVE_TIMEOUT}; +use rpc::{RECEIVE_TIMEOUT, proto::PeerId}; use serde_json::json; use std::ops::Range; diff --git a/crates/collab/src/tests/channel_guest_tests.rs b/crates/collab/src/tests/channel_guest_tests.rs index 0e8d856221..6f7a6228b2 100644 --- a/crates/collab/src/tests/channel_guest_tests.rs +++ b/crates/collab/src/tests/channel_guest_tests.rs @@ -51,13 +51,15 @@ async fn test_channel_guests( Some(project_id), ); assert!(project_b.read_with(cx_b, |project, cx| project.is_read_only(cx))); - assert!(project_b - .update(cx_b, |project, cx| { - let worktree_id = project.worktrees(cx).next().unwrap().read(cx).id(); - project.create_entry((worktree_id, "b.txt"), false, cx) - }) - .await - .is_err()); + assert!( + project_b + .update(cx_b, |project, cx| { + let worktree_id = project.worktrees(cx).next().unwrap().read(cx).id(); + project.create_entry((worktree_id, "b.txt"), false, cx) + }) + .await + .is_err() + ); assert!(room_b.read_with(cx_b, |room, _| room.is_muted())); } @@ -110,10 +112,12 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test cx_b.update(|_window, cx_b| { assert!(room_b.read_with(cx_b, |room, _| !room.can_use_microphone())); }); - assert!(room_b - .update(cx_b, |room, cx| room.share_microphone(cx)) - .await - .is_err()); + assert!( + room_b + .update(cx_b, |room, cx| room.share_microphone(cx)) + .await + .is_err() + ); // B is promoted active_call_a @@ -161,10 +165,12 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test // project and buffers are no longer editable assert!(project_b.read_with(cx_b, |project, cx| project.is_read_only(cx))); assert!(editor_b.update(cx_b, |editor, cx| editor.read_only(cx))); - assert!(room_b - .update(cx_b, |room, cx| room.share_microphone(cx)) - .await - .is_err()); + assert!( + room_b + .update(cx_b, |room, cx| room.share_microphone(cx)) + .await + .is_err() + ); } #[gpui::test] diff --git a/crates/collab/src/tests/channel_tests.rs b/crates/collab/src/tests/channel_tests.rs index 43f616dc57..fdfd9c502c 100644 --- a/crates/collab/src/tests/channel_tests.rs +++ b/crates/collab/src/tests/channel_tests.rs @@ -1,7 +1,7 @@ use crate::{ db::{self, UserId}, rpc::RECONNECT_TIMEOUT, - tests::{room_participants, RoomParticipants, TestServer}, + tests::{RoomParticipants, TestServer, room_participants}, }; use call::ActiveCall; use channel::{ChannelMembership, ChannelStore}; @@ -9,8 +9,8 @@ use client::{ChannelId, User}; use futures::future::try_join_all; use gpui::{BackgroundExecutor, Entity, SharedString, TestAppContext}; use rpc::{ - proto::{self, ChannelRole}, RECEIVE_TIMEOUT, + proto::{self, ChannelRole}, }; use std::sync::Arc; @@ -348,10 +348,12 @@ async fn test_joining_channel_ancestor_member( let active_call_b = cx_b.read(ActiveCall::global); - assert!(active_call_b - .update(cx_b, |active_call, cx| active_call.join_channel(sub_id, cx)) - .await - .is_ok()); + assert!( + active_call_b + .update(cx_b, |active_call, cx| active_call.join_channel(sub_id, cx)) + .await + .is_ok() + ); } #[gpui::test] @@ -1203,10 +1205,12 @@ async fn test_guest_access( let active_call_b = cx_b.read(ActiveCall::global); // Non-members should not be allowed to join - assert!(active_call_b - .update(cx_b, |call, cx| call.join_channel(channel_a, cx)) - .await - .is_err()); + assert!( + active_call_b + .update(cx_b, |call, cx| call.join_channel(channel_a, cx)) + .await + .is_err() + ); // Make channels A and B public client_a @@ -1271,10 +1275,12 @@ async fn test_invite_access( let active_call_b = cx_b.read(ActiveCall::global); // should not be allowed to join - assert!(active_call_b - .update(cx_b, |call, cx| call.join_channel(channel_b_id, cx)) - .await - .is_err()); + assert!( + active_call_b + .update(cx_b, |call, cx| call.join_channel(channel_b_id, cx)) + .await + .is_err() + ); client_a .channel_store() diff --git a/crates/collab/src/tests/editor_tests.rs b/crates/collab/src/tests/editor_tests.rs index 8a595cc2e1..719b8643f2 100644 --- a/crates/collab/src/tests/editor_tests.rs +++ b/crates/collab/src/tests/editor_tests.rs @@ -1,9 +1,10 @@ use crate::{ rpc::RECONNECT_TIMEOUT, - tests::{rust_lang, TestServer}, + tests::{TestServer, rust_lang}, }; use call::ActiveCall; use editor::{ + Editor, RowInfo, actions::{ ConfirmCodeAction, ConfirmCompletion, ConfirmRename, ContextMenuFirst, ExpandMacroRecursively, Redo, Rename, ToggleCodeActions, Undo, @@ -12,23 +13,22 @@ use editor::{ editor_test_context::{AssertionContextManager, EditorTestContext}, expand_macro_recursively, }, - Editor, RowInfo, }; use fs::Fs; use futures::StreamExt; use gpui::{TestAppContext, UpdateGlobal, VisualContext, VisualTestContext}; use indoc::indoc; use language::{ - language_settings::{AllLanguageSettings, InlayHintSettings}, FakeLspAdapter, + language_settings::{AllLanguageSettings, InlayHintSettings}, }; use project::{ + ProjectPath, SERVER_PROGRESS_THROTTLE_TIMEOUT, lsp_store::{ lsp_ext_command::{ExpandedMacro, LspExpandMacro}, rust_analyzer_ext::RUST_ANALYZER_NAME, }, project_settings::{InlineBlameSettings, ProjectSettings}, - ProjectPath, SERVER_PROGRESS_THROTTLE_TIMEOUT, }; use recent_projects::disconnected_overlay::DisconnectedOverlay; use rpc::RECEIVE_TIMEOUT; @@ -38,8 +38,8 @@ use std::{ ops::Range, path::{Path, PathBuf}, sync::{ - atomic::{self, AtomicBool, AtomicUsize}, Arc, + atomic::{self, AtomicBool, AtomicUsize}, }, }; use text::Point; diff --git a/crates/collab/src/tests/following_tests.rs b/crates/collab/src/tests/following_tests.rs index bc372d16fe..3c8204cd51 100644 --- a/crates/collab/src/tests/following_tests.rs +++ b/crates/collab/src/tests/following_tests.rs @@ -8,8 +8,8 @@ use collab_ui::{ }; use editor::{Editor, ExcerptRange, MultiBuffer}; use gpui::{ - point, AppContext as _, BackgroundExecutor, BorrowAppContext, Entity, SharedString, - TestAppContext, VisualTestContext, + AppContext as _, BackgroundExecutor, BorrowAppContext, Entity, SharedString, TestAppContext, + VisualTestContext, point, }; use language::Capability; use project::WorktreeSettings; @@ -17,7 +17,7 @@ use rpc::proto::PeerId; use serde_json::json; use settings::SettingsStore; use util::path; -use workspace::{item::ItemHandle as _, SplitDirection, Workspace}; +use workspace::{SplitDirection, Workspace, item::ItemHandle as _}; use super::TestClient; @@ -441,7 +441,7 @@ async fn test_basic_following( use crate::rpc::RECONNECT_TIMEOUT; use gpui::TestScreenCaptureSource; use workspace::{ - dock::{test::TestPanel, DockPosition}, + dock::{DockPosition, test::TestPanel}, item::test::TestItem, shared_screen::SharedScreen, }; diff --git a/crates/collab/src/tests/integration_tests.rs b/crates/collab/src/tests/integration_tests.rs index b0e374fcfa..0c3ee91d6c 100644 --- a/crates/collab/src/tests/integration_tests.rs +++ b/crates/collab/src/tests/integration_tests.rs @@ -1,38 +1,39 @@ use crate::{ rpc::{CLEANUP_TIMEOUT, RECONNECT_TIMEOUT}, tests::{ - channel_id, following_tests::join_channel, room_participants, rust_lang, RoomParticipants, - TestClient, TestServer, + RoomParticipants, TestClient, TestServer, channel_id, following_tests::join_channel, + room_participants, rust_lang, }, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_context_editor::ContextStore; use assistant_slash_command::SlashCommandWorkingSet; -use buffer_diff::{assert_hunks, DiffHunkSecondaryStatus, DiffHunkStatus}; -use call::{room, ActiveCall, ParticipantLocation, Room}; -use client::{User, RECEIVE_TIMEOUT}; +use buffer_diff::{DiffHunkSecondaryStatus, DiffHunkStatus, assert_hunks}; +use call::{ActiveCall, ParticipantLocation, Room, room}; +use client::{RECEIVE_TIMEOUT, User}; use collections::{HashMap, HashSet}; use fs::{FakeFs, Fs as _, RemoveOptions}; -use futures::{channel::mpsc, StreamExt as _}; +use futures::{StreamExt as _, channel::mpsc}; use git::status::{FileStatus, StatusCode, TrackedStatus, UnmergedStatus, UnmergedStatusCode}; use gpui::{ - px, size, App, BackgroundExecutor, Entity, Modifiers, MouseButton, MouseDownEvent, - TestAppContext, UpdateGlobal, + App, BackgroundExecutor, Entity, Modifiers, MouseButton, MouseDownEvent, TestAppContext, + UpdateGlobal, px, size, }; use language::{ + Diagnostic, DiagnosticEntry, FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, + LineEnding, OffsetRangeExt, Point, Rope, language_settings::{ AllLanguageSettings, Formatter, FormatterList, PrettierSettings, SelectedFormatter, }, - tree_sitter_rust, tree_sitter_typescript, Diagnostic, DiagnosticEntry, FakeLspAdapter, - Language, LanguageConfig, LanguageMatcher, LineEnding, OffsetRangeExt, Point, Rope, + tree_sitter_rust, tree_sitter_typescript, }; use lsp::{LanguageServerId, OneOf}; use parking_lot::Mutex; use pretty_assertions::assert_eq; use project::{ + DiagnosticSummary, HoverBlockKind, Project, ProjectPath, lsp_store::{FormatTrigger, LspFormatTarget}, search::{SearchQuery, SearchResult}, - DiagnosticSummary, HoverBlockKind, Project, ProjectPath, }; use prompt_store::PromptBuilder; use rand::prelude::*; @@ -44,8 +45,8 @@ use std::{ path::{Path, PathBuf}, rc::Rc, sync::{ - atomic::{AtomicBool, Ordering::SeqCst}, Arc, + atomic::{AtomicBool, Ordering::SeqCst}, }, time::Duration, }; @@ -6206,15 +6207,19 @@ async fn test_contact_requests( executor.run_until_parked(); assert_eq!(client_a.summarize_contacts(cx_a).current, &["user_b"]); assert_eq!(client_b.summarize_contacts(cx_b).current, &["user_a"]); - assert!(client_b - .summarize_contacts(cx_b) - .incoming_requests - .is_empty()); + assert!( + client_b + .summarize_contacts(cx_b) + .incoming_requests + .is_empty() + ); assert!(client_c.summarize_contacts(cx_c).current.is_empty()); - assert!(client_c - .summarize_contacts(cx_c) - .outgoing_requests - .is_empty()); + assert!( + client_c + .summarize_contacts(cx_c) + .outgoing_requests + .is_empty() + ); async fn disconnect_and_reconnect(client: &TestClient, cx: &mut TestAppContext) { client.disconnect(&cx.to_async()); diff --git a/crates/collab/src/tests/notification_tests.rs b/crates/collab/src/tests/notification_tests.rs index cdec324632..4e64b5526b 100644 --- a/crates/collab/src/tests/notification_tests.rs +++ b/crates/collab/src/tests/notification_tests.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use gpui::{BackgroundExecutor, TestAppContext}; use notifications::NotificationEvent; use parking_lot::Mutex; -use rpc::{proto, Notification}; +use rpc::{Notification, proto}; use crate::tests::TestServer; diff --git a/crates/collab/src/tests/random_channel_buffer_tests.rs b/crates/collab/src/tests/random_channel_buffer_tests.rs index 0eacc56ffb..c283a9fcd1 100644 --- a/crates/collab/src/tests/random_channel_buffer_tests.rs +++ b/crates/collab/src/tests/random_channel_buffer_tests.rs @@ -1,6 +1,6 @@ use crate::db::ChannelRole; -use super::{run_randomized_test, RandomizedTest, TestClient, TestError, TestServer, UserTestPlan}; +use super::{RandomizedTest, TestClient, TestError, TestServer, UserTestPlan, run_randomized_test}; use anyhow::Result; use async_trait::async_trait; use gpui::{BackgroundExecutor, SharedString, TestAppContext}; diff --git a/crates/collab/src/tests/random_project_collaboration_tests.rs b/crates/collab/src/tests/random_project_collaboration_tests.rs index e20b1d9762..0eca664b50 100644 --- a/crates/collab/src/tests/random_project_collaboration_tests.rs +++ b/crates/collab/src/tests/random_project_collaboration_tests.rs @@ -1,6 +1,6 @@ use super::{RandomizedTest, TestClient, TestError, TestServer, UserTestPlan}; use crate::{db::UserId, tests::run_randomized_test}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use call::ActiveCall; use collections::{BTreeMap, HashMap}; @@ -9,12 +9,12 @@ use fs::{FakeFs, Fs as _}; use git::status::{FileStatus, StatusCode, TrackedStatus, UnmergedStatus, UnmergedStatusCode}; use gpui::{BackgroundExecutor, Entity, TestAppContext}; use language::{ - range_to_lsp, FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, PointUtf16, + FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, PointUtf16, range_to_lsp, }; use lsp::FakeLanguageServer; use pretty_assertions::assert_eq; use project::{ - search::SearchQuery, search::SearchResult, Project, ProjectPath, DEFAULT_COMPLETION_CONTEXT, + DEFAULT_COMPLETION_CONTEXT, Project, ProjectPath, search::SearchQuery, search::SearchResult, }; use rand::{ distributions::{Alphanumeric, DistString}, @@ -27,7 +27,7 @@ use std::{ rc::Rc, sync::Arc, }; -use util::{path, ResultExt}; +use util::{ResultExt, path}; #[gpui::test( iterations = 100, @@ -784,10 +784,12 @@ impl RandomizedTest for ProjectCollaborationTest { let save = cx.spawn(|cx| async move { save.await .map_err(|err| anyhow!("save request failed: {:?}", err))?; - assert!(buffer - .read_with(&cx, |buffer, _| { buffer.saved_version().to_owned() }) - .expect("App should not be dropped") - .observed_all(&requested_version)); + assert!( + buffer + .read_with(&cx, |buffer, _| { buffer.saved_version().to_owned() }) + .expect("App should not be dropped") + .observed_all(&requested_version) + ); anyhow::Ok(()) }); if detach { diff --git a/crates/collab/src/tests/randomized_test_helpers.rs b/crates/collab/src/tests/randomized_test_helpers.rs index 773d31fc3b..cabf10cfbc 100644 --- a/crates/collab/src/tests/randomized_test_helpers.rs +++ b/crates/collab/src/tests/randomized_test_helpers.rs @@ -9,7 +9,7 @@ use gpui::{BackgroundExecutor, Task, TestAppContext}; use parking_lot::Mutex; use rand::prelude::*; use rpc::RECEIVE_TIMEOUT; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::DeserializeOwned}; use settings::SettingsStore; use std::sync::OnceLock; use std::{ @@ -17,8 +17,8 @@ use std::{ path::PathBuf, rc::Rc, sync::{ - atomic::{AtomicBool, Ordering::SeqCst}, Arc, + atomic::{AtomicBool, Ordering::SeqCst}, }, }; diff --git a/crates/collab/src/tests/remote_editing_collaboration_tests.rs b/crates/collab/src/tests/remote_editing_collaboration_tests.rs index f79e9efe88..03c7702dd8 100644 --- a/crates/collab/src/tests/remote_editing_collaboration_tests.rs +++ b/crates/collab/src/tests/remote_editing_collaboration_tests.rs @@ -10,17 +10,17 @@ use gpui::{ }; use http_client::BlockedHttpClient; use language::{ + FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, LanguageRegistry, language_settings::{ - language_settings, AllLanguageSettings, Formatter, FormatterList, PrettierSettings, - SelectedFormatter, + AllLanguageSettings, Formatter, FormatterList, PrettierSettings, SelectedFormatter, + language_settings, }, - tree_sitter_typescript, FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, - LanguageRegistry, + tree_sitter_typescript, }; use node_runtime::NodeRuntime; use project::{ - lsp_store::{FormatTrigger, LspFormatTarget}, ProjectPath, + lsp_store::{FormatTrigger, LspFormatTarget}, }; use remote::SshRemoteClient; use remote_server::{HeadlessAppState, HeadlessProject}; diff --git a/crates/collab/src/tests/test_server.rs b/crates/collab/src/tests/test_server.rs index f139beaa09..77fbf1f7f7 100644 --- a/crates/collab/src/tests/test_server.rs +++ b/crates/collab/src/tests/test_server.rs @@ -1,22 +1,22 @@ use crate::{ - db::{tests::TestDb, NewUserParams, UserId}, - executor::Executor, - rpc::{Principal, Server, ZedVersion, CLEANUP_TIMEOUT, RECONNECT_TIMEOUT}, AppState, Config, RateLimiter, + db::{NewUserParams, UserId, tests::TestDb}, + executor::Executor, + rpc::{CLEANUP_TIMEOUT, Principal, RECONNECT_TIMEOUT, Server, ZedVersion}, }; use anyhow::anyhow; use call::ActiveCall; use channel::{ChannelBuffer, ChannelStore}; use client::{ - self, proto::PeerId, ChannelId, Client, Connection, Credentials, EstablishConnectionError, - UserStore, + self, ChannelId, Client, Connection, Credentials, EstablishConnectionError, UserStore, + proto::PeerId, }; use clock::FakeSystemClock; use collab_ui::channel_view::ChannelView; use collections::{HashMap, HashSet}; use dap::DapRegistry; use fs::FakeFs; -use futures::{channel::oneshot, StreamExt as _}; +use futures::{StreamExt as _, channel::oneshot}; use git::GitHostingProviderRegistry; use gpui::{AppContext as _, BackgroundExecutor, Entity, Task, TestAppContext, VisualTestContext}; use http_client::FakeHttpClient; @@ -27,8 +27,8 @@ use parking_lot::Mutex; use project::{Project, WorktreeId}; use remote::SshRemoteClient; use rpc::{ - proto::{self, ChannelRole}, RECEIVE_TIMEOUT, + proto::{self, ChannelRole}, }; use semantic_version::SemanticVersion; use serde_json::json; @@ -40,8 +40,8 @@ use std::{ ops::{Deref, DerefMut}, path::Path, sync::{ - atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst}, Arc, + atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst}, }, }; use util::path; diff --git a/crates/collab/src/user_backfiller.rs b/crates/collab/src/user_backfiller.rs index dcabe8d216..274dc37bc0 100644 --- a/crates/collab/src/user_backfiller.rs +++ b/crates/collab/src/user_backfiller.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use chrono::{DateTime, Utc}; use util::ResultExt; diff --git a/crates/collab_ui/src/channel_view.rs b/crates/collab_ui/src/channel_view.rs index ca910e2f9b..554cfe113a 100644 --- a/crates/collab_ui/src/channel_view.rs +++ b/crates/collab_ui/src/channel_view.rs @@ -2,17 +2,17 @@ use anyhow::Result; use call::ActiveCall; use channel::{Channel, ChannelBuffer, ChannelBufferEvent, ChannelStore}; use client::{ - proto::{self, PeerId}, ChannelId, Collaborator, ParticipantIndex, + proto::{self, PeerId}, }; use collections::HashMap; use editor::{ - display_map::ToDisplayPoint, scroll::Autoscroll, CollaborationHub, DisplayPoint, Editor, - EditorEvent, + CollaborationHub, DisplayPoint, Editor, EditorEvent, display_map::ToDisplayPoint, + scroll::Autoscroll, }; use gpui::{ - actions, AnyView, App, ClipboardItem, Context, Entity, EventEmitter, Focusable, Pixels, Point, - Render, Subscription, Task, VisualContext as _, WeakEntity, Window, + AnyView, App, ClipboardItem, Context, Entity, EventEmitter, Focusable, Pixels, Point, Render, + Subscription, Task, VisualContext as _, WeakEntity, Window, actions, }; use project::Project; use rpc::proto::ChannelVisibility; @@ -23,12 +23,12 @@ use std::{ use ui::prelude::*; use util::ResultExt; use workspace::item::TabContentParams; -use workspace::{item::Dedup, notifications::NotificationId}; use workspace::{ + ItemNavHistory, Pane, SaveIntent, Toast, ViewId, Workspace, WorkspaceId, item::{FollowableItem, Item, ItemEvent, ItemHandle}, searchable::SearchableItemHandle, - ItemNavHistory, Pane, SaveIntent, Toast, ViewId, Workspace, WorkspaceId, }; +use workspace::{item::Dedup, notifications::NotificationId}; actions!(collab, [CopyLink]); diff --git a/crates/collab_ui/src/chat_panel.rs b/crates/collab_ui/src/chat_panel.rs index f3f85259b9..0eee89d1fe 100644 --- a/crates/collab_ui/src/chat_panel.rs +++ b/crates/collab_ui/src/chat_panel.rs @@ -1,16 +1,16 @@ -use crate::{collab_panel, ChatPanelButton, ChatPanelSettings}; +use crate::{ChatPanelButton, ChatPanelSettings, collab_panel}; use anyhow::Result; -use call::{room, ActiveCall}; +use call::{ActiveCall, room}; use channel::{ChannelChat, ChannelChatEvent, ChannelMessage, ChannelMessageId, ChannelStore}; use client::{ChannelId, Client}; use collections::HashMap; use db::kvp::KEY_VALUE_STORE; -use editor::{actions, Editor}; +use editor::{Editor, actions}; use gpui::{ - actions, div, list, prelude::*, px, Action, App, AsyncWindowContext, ClipboardItem, Context, - CursorStyle, DismissEvent, ElementId, Entity, EventEmitter, FocusHandle, Focusable, FontWeight, - HighlightStyle, ListOffset, ListScrollEvent, ListState, Render, Stateful, Subscription, Task, - WeakEntity, Window, + Action, App, AsyncWindowContext, ClipboardItem, Context, CursorStyle, DismissEvent, ElementId, + Entity, EventEmitter, FocusHandle, Focusable, FontWeight, HighlightStyle, ListOffset, + ListScrollEvent, ListState, Render, Stateful, Subscription, Task, WeakEntity, Window, actions, + div, list, prelude::*, px, }; use language::LanguageRegistry; use menu::Confirm; @@ -22,13 +22,13 @@ use settings::Settings; use std::{sync::Arc, time::Duration}; use time::{OffsetDateTime, UtcOffset}; use ui::{ - prelude::*, Avatar, Button, ContextMenu, IconButton, IconName, KeyBinding, Label, PopoverMenu, - Tab, TabBar, Tooltip, + Avatar, Button, ContextMenu, IconButton, IconName, KeyBinding, Label, PopoverMenu, Tab, TabBar, + Tooltip, prelude::*, }; use util::{ResultExt, TryFutureExt}; use workspace::{ - dock::{DockPosition, Panel, PanelEvent}, Workspace, + dock::{DockPosition, Panel, PanelEvent}, }; mod message_editor; diff --git a/crates/collab_ui/src/chat_panel/message_editor.rs b/crates/collab_ui/src/chat_panel/message_editor.rs index b74c1f0c7b..d5dafd8193 100644 --- a/crates/collab_ui/src/chat_panel/message_editor.rs +++ b/crates/collab_ui/src/chat_panel/message_editor.rs @@ -9,10 +9,10 @@ use gpui::{ HighlightStyle, IntoElement, Render, Task, TextStyle, WeakEntity, Window, }; use language::{ - language_settings::SoftWrap, Anchor, Buffer, BufferSnapshot, CodeLabel, LanguageRegistry, - ToOffset, + Anchor, Buffer, BufferSnapshot, CodeLabel, LanguageRegistry, ToOffset, + language_settings::SoftWrap, }; -use project::{search::SearchQuery, Completion, CompletionSource}; +use project::{Completion, CompletionSource, search::SearchQuery}; use settings::Settings; use std::{ cell::RefCell, @@ -22,7 +22,7 @@ use std::{ time::Duration, }; use theme::ThemeSettings; -use ui::{prelude::*, TextSize}; +use ui::{TextSize, prelude::*}; use crate::panel_settings::MessageEditorSettings; diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rs index 382fd922b0..b09d8edd87 100644 --- a/crates/collab_ui/src/collab_panel.rs +++ b/crates/collab_ui/src/collab_panel.rs @@ -2,26 +2,26 @@ mod channel_modal; mod contact_finder; use self::channel_modal::ChannelModal; -use crate::{channel_view::ChannelView, chat_panel::ChatPanel, CollaborationPanelSettings}; +use crate::{CollaborationPanelSettings, channel_view::ChannelView, chat_panel::ChatPanel}; use call::ActiveCall; use channel::{Channel, ChannelEvent, ChannelStore}; use client::{ChannelId, Client, Contact, User, UserStore}; use contact_finder::ContactFinder; use db::kvp::KEY_VALUE_STORE; use editor::{Editor, EditorElement, EditorStyle}; -use fuzzy::{match_strings, StringMatchCandidate}; +use fuzzy::{StringMatchCandidate, match_strings}; use gpui::{ - actions, anchored, canvas, deferred, div, fill, list, point, prelude::*, px, AnyElement, App, - AsyncWindowContext, Bounds, ClickEvent, ClipboardItem, Context, DismissEvent, Div, Entity, - EventEmitter, FocusHandle, Focusable, FontStyle, InteractiveElement, IntoElement, ListOffset, - ListState, MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Render, SharedString, - Styled, Subscription, Task, TextStyle, WeakEntity, Window, + AnyElement, App, AsyncWindowContext, Bounds, ClickEvent, ClipboardItem, Context, DismissEvent, + Div, Entity, EventEmitter, FocusHandle, Focusable, FontStyle, InteractiveElement, IntoElement, + ListOffset, ListState, MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Render, + SharedString, Styled, Subscription, Task, TextStyle, WeakEntity, Window, actions, anchored, + canvas, deferred, div, fill, list, point, prelude::*, px, }; use menu::{Cancel, Confirm, SecondaryConfirm, SelectNext, SelectPrevious}; use project::{Fs, Project}; use rpc::{ - proto::{self, ChannelVisibility, PeerId}, ErrorCode, ErrorExt, + proto::{self, ChannelVisibility, PeerId}, }; use serde_derive::{Deserialize, Serialize}; use settings::Settings; @@ -29,15 +29,15 @@ use smallvec::SmallVec; use std::{mem, sync::Arc}; use theme::{ActiveTheme, ThemeSettings}; use ui::{ - prelude::*, tooltip_container, Avatar, AvatarAvailabilityIndicator, Button, Color, ContextMenu, - Facepile, Icon, IconButton, IconName, IconSize, Indicator, Label, ListHeader, ListItem, - Tooltip, + Avatar, AvatarAvailabilityIndicator, Button, Color, ContextMenu, Facepile, Icon, IconButton, + IconName, IconSize, Indicator, Label, ListHeader, ListItem, Tooltip, prelude::*, + tooltip_container, }; -use util::{maybe, ResultExt, TryFutureExt}; +use util::{ResultExt, TryFutureExt, maybe}; use workspace::{ + OpenChannelNotes, Workspace, dock::{DockPosition, Panel, PanelEvent}, notifications::{DetachAndPromptErr, NotifyResultExt, NotifyTaskExt}, - OpenChannelNotes, Workspace, }; actions!( @@ -2519,12 +2519,14 @@ impl CollabPanel { ] } else { let github_login = github_login.clone(); - vec![IconButton::new("remove_contact", IconName::Close) - .on_click(cx.listener(move |this, _, window, cx| { - this.remove_contact(user_id, &github_login, window, cx); - })) - .icon_color(color) - .tooltip(Tooltip::text("Cancel invite"))] + vec![ + IconButton::new("remove_contact", IconName::Close) + .on_click(cx.listener(move |this, _, window, cx| { + this.remove_contact(user_id, &github_login, window, cx); + })) + .icon_color(color) + .tooltip(Tooltip::text("Cancel invite")), + ] }; ListItem::new(github_login.clone()) diff --git a/crates/collab_ui/src/collab_panel/channel_modal.rs b/crates/collab_ui/src/collab_panel/channel_modal.rs index f2949305ec..1c22fc35c6 100644 --- a/crates/collab_ui/src/collab_panel/channel_modal.rs +++ b/crates/collab_ui/src/collab_panel/channel_modal.rs @@ -1,18 +1,18 @@ use channel::{ChannelMembership, ChannelStore}; use client::{ - proto::{self, ChannelRole, ChannelVisibility}, ChannelId, User, UserId, UserStore, + proto::{self, ChannelRole, ChannelVisibility}, }; -use fuzzy::{match_strings, StringMatchCandidate}; +use fuzzy::{StringMatchCandidate, match_strings}; use gpui::{ - actions, anchored, deferred, div, App, ClipboardItem, Context, DismissEvent, Entity, - EventEmitter, Focusable, ParentElement, Render, Styled, Subscription, Task, WeakEntity, Window, + App, ClipboardItem, Context, DismissEvent, Entity, EventEmitter, Focusable, ParentElement, + Render, Styled, Subscription, Task, WeakEntity, Window, actions, anchored, deferred, div, }; use picker::{Picker, PickerDelegate}; use std::sync::Arc; -use ui::{prelude::*, Avatar, CheckboxWithLabel, ContextMenu, ListItem, ListItemSpacing}; +use ui::{Avatar, CheckboxWithLabel, ContextMenu, ListItem, ListItemSpacing, prelude::*}; use util::TryFutureExt; -use workspace::{notifications::DetachAndPromptErr, ModalView}; +use workspace::{ModalView, notifications::DetachAndPromptErr}; actions!( channel_modal, diff --git a/crates/collab_ui/src/collab_panel/contact_finder.rs b/crates/collab_ui/src/collab_panel/contact_finder.rs index 325f749c09..3c23ccc017 100644 --- a/crates/collab_ui/src/collab_panel/contact_finder.rs +++ b/crates/collab_ui/src/collab_panel/contact_finder.rs @@ -5,7 +5,7 @@ use gpui::{ }; use picker::{Picker, PickerDelegate}; use std::sync::Arc; -use ui::{prelude::*, Avatar, ListItem, ListItemSpacing}; +use ui::{Avatar, ListItem, ListItemSpacing, prelude::*}; use util::{ResultExt as _, TryFutureExt}; use workspace::ModalView; diff --git a/crates/collab_ui/src/collab_ui.rs b/crates/collab_ui/src/collab_ui.rs index dbc408741c..f9a2fa4925 100644 --- a/crates/collab_ui/src/collab_ui.rs +++ b/crates/collab_ui/src/collab_ui.rs @@ -9,8 +9,8 @@ use std::{rc::Rc, sync::Arc}; pub use collab_panel::CollabPanel; use gpui::{ - point, App, Pixels, PlatformDisplay, Size, WindowBackgroundAppearance, WindowBounds, - WindowDecorations, WindowKind, WindowOptions, + App, Pixels, PlatformDisplay, Size, WindowBackgroundAppearance, WindowBounds, + WindowDecorations, WindowKind, WindowOptions, point, }; use panel_settings::MessageEditorSettings; pub use panel_settings::{ diff --git a/crates/collab_ui/src/notification_panel.rs b/crates/collab_ui/src/notification_panel.rs index a45a0c0989..58df3cead3 100644 --- a/crates/collab_ui/src/notification_panel.rs +++ b/crates/collab_ui/src/notification_panel.rs @@ -1,4 +1,4 @@ -use crate::{chat_panel::ChatPanel, NotificationPanelSettings}; +use crate::{NotificationPanelSettings, chat_panel::ChatPanel}; use anyhow::Result; use channel::ChannelStore; use client::{ChannelId, Client, Notification, User, UserStore}; @@ -6,10 +6,10 @@ use collections::HashMap; use db::kvp::KEY_VALUE_STORE; use futures::StreamExt; use gpui::{ - actions, div, img, list, px, AnyElement, App, AsyncWindowContext, Context, CursorStyle, - DismissEvent, Element, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, - IntoElement, ListAlignment, ListScrollEvent, ListState, ParentElement, Render, - StatefulInteractiveElement, Styled, Task, WeakEntity, Window, + AnyElement, App, AsyncWindowContext, Context, CursorStyle, DismissEvent, Element, Entity, + EventEmitter, FocusHandle, Focusable, InteractiveElement, IntoElement, ListAlignment, + ListScrollEvent, ListState, ParentElement, Render, StatefulInteractiveElement, Styled, Task, + WeakEntity, Window, actions, div, img, list, px, }; use notifications::{NotificationEntry, NotificationEvent, NotificationStore}; use project::Fs; @@ -19,13 +19,13 @@ use settings::{Settings, SettingsStore}; use std::{sync::Arc, time::Duration}; use time::{OffsetDateTime, UtcOffset}; use ui::{ - h_flex, prelude::*, v_flex, Avatar, Button, Icon, IconButton, IconName, Label, Tab, Tooltip, + Avatar, Button, Icon, IconButton, IconName, Label, Tab, Tooltip, h_flex, prelude::*, v_flex, }; use util::{ResultExt, TryFutureExt}; use workspace::notifications::{Notification as WorkspaceNotification, NotificationId}; use workspace::{ - dock::{DockPosition, Panel, PanelEvent}, Workspace, + dock::{DockPosition, Panel, PanelEvent}, }; const LOADING_THRESHOLD: usize = 30; diff --git a/crates/collab_ui/src/notifications/collab_notification.rs b/crates/collab_ui/src/notifications/collab_notification.rs index 6b2c5dd045..9d5541d9c2 100644 --- a/crates/collab_ui/src/notifications/collab_notification.rs +++ b/crates/collab_ui/src/notifications/collab_notification.rs @@ -1,4 +1,4 @@ -use gpui::{img, prelude::*, AnyElement, SharedUri}; +use gpui::{AnyElement, SharedUri, img, prelude::*}; use smallvec::SmallVec; use ui::prelude::*; diff --git a/crates/collab_ui/src/notifications/incoming_call_notification.rs b/crates/collab_ui/src/notifications/incoming_call_notification.rs index a3b40f0232..0bf71ce614 100644 --- a/crates/collab_ui/src/notifications/incoming_call_notification.rs +++ b/crates/collab_ui/src/notifications/incoming_call_notification.rs @@ -2,10 +2,10 @@ use crate::notification_window_options; use crate::notifications::collab_notification::CollabNotification; use call::{ActiveCall, IncomingCall}; use futures::StreamExt; -use gpui::{prelude::*, App, WindowHandle}; +use gpui::{App, WindowHandle, prelude::*}; use std::sync::{Arc, Weak}; -use ui::{prelude::*, Button, Label}; +use ui::{Button, Label, prelude::*}; use util::ResultExt; use workspace::AppState; diff --git a/crates/collab_ui/src/notifications/project_shared_notification.rs b/crates/collab_ui/src/notifications/project_shared_notification.rs index d5880dc4b9..f80a5e561e 100644 --- a/crates/collab_ui/src/notifications/project_shared_notification.rs +++ b/crates/collab_ui/src/notifications/project_shared_notification.rs @@ -1,12 +1,12 @@ use crate::notification_window_options; use crate::notifications::collab_notification::CollabNotification; -use call::{room, ActiveCall}; +use call::{ActiveCall, room}; use client::User; use collections::HashMap; use gpui::{App, Size}; use std::sync::{Arc, Weak}; -use ui::{prelude::*, Button, Label}; +use ui::{Button, Label, prelude::*}; use util::ResultExt; use workspace::AppState; diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index 5f4997570b..7a2db51fb2 100644 --- a/crates/command_palette/src/command_palette.rs +++ b/crates/command_palette/src/command_palette.rs @@ -17,10 +17,10 @@ use gpui::{ use picker::{Picker, PickerDelegate}; use postage::{sink::Sink, stream::Stream}; use settings::Settings; -use ui::{h_flex, prelude::*, v_flex, HighlightedLabel, KeyBinding, ListItem, ListItemSpacing}; +use ui::{HighlightedLabel, KeyBinding, ListItem, ListItemSpacing, h_flex, prelude::*, v_flex}; use util::ResultExt; use workspace::{ModalView, Workspace, WorkspaceSettings}; -use zed_actions::{command_palette::Toggle, OpenZedUrl}; +use zed_actions::{OpenZedUrl, command_palette::Toggle}; pub fn init(cx: &mut App) { client::init_settings(cx); diff --git a/crates/component/src/component.rs b/crates/component/src/component.rs index 5ecf564c07..2ce6d9892f 100644 --- a/crates/component/src/component.rs +++ b/crates/component/src/component.rs @@ -3,7 +3,7 @@ use std::ops::{Deref, DerefMut}; use std::sync::LazyLock; use collections::HashMap; -use gpui::{div, prelude::*, px, AnyElement, App, IntoElement, RenderOnce, SharedString, Window}; +use gpui::{AnyElement, App, IntoElement, RenderOnce, SharedString, Window, div, prelude::*, px}; use linkme::distributed_slice; use parking_lot::RwLock; use theme::ActiveTheme; diff --git a/crates/component_preview/src/component_preview.rs b/crates/component_preview/src/component_preview.rs index 41a0d154c4..48afadd7d8 100644 --- a/crates/component_preview/src/component_preview.rs +++ b/crates/component_preview/src/component_preview.rs @@ -6,10 +6,10 @@ use std::iter::Iterator; use std::sync::Arc; use client::UserStore; -use component::{components, ComponentId, ComponentMetadata}; +use component::{ComponentId, ComponentMetadata, components}; use gpui::{ - list, prelude::*, uniform_list, App, Entity, EventEmitter, FocusHandle, Focusable, Task, - WeakEntity, Window, + App, Entity, EventEmitter, FocusHandle, Focusable, Task, WeakEntity, Window, list, prelude::*, + uniform_list, }; use collections::HashMap; @@ -18,10 +18,10 @@ use gpui::{ListState, ScrollHandle, UniformListScrollHandle}; use languages::LanguageRegistry; use notifications::status_toast::{StatusToast, ToastIcon}; use project::Project; -use ui::{prelude::*, Divider, ListItem, ListSubHeader}; +use ui::{Divider, ListItem, ListSubHeader, prelude::*}; -use workspace::{item::ItemEvent, Item, Workspace, WorkspaceId}; use workspace::{AppState, ItemId, SerializableItem}; +use workspace::{Item, Workspace, WorkspaceId, item::ItemEvent}; pub fn init(app_state: Arc, cx: &mut App) { let app_state = app_state.clone(); diff --git a/crates/context_server/src/client.rs b/crates/context_server/src/client.rs index de035dac3d..119279b26f 100644 --- a/crates/context_server/src/client.rs +++ b/crates/context_server/src/client.rs @@ -1,18 +1,18 @@ -use anyhow::{anyhow, Context, Result}; +use anyhow::{Context, Result, anyhow}; use collections::HashMap; -use futures::{channel::oneshot, select, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, channel::oneshot, select}; use gpui::{AppContext as _, AsyncApp, BackgroundExecutor, Task}; use parking_lot::Mutex; use postage::barrier; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; -use serde_json::{value::RawValue, Value}; +use serde::{Deserialize, Serialize, de::DeserializeOwned}; +use serde_json::{Value, value::RawValue}; use smol::channel; use std::{ fmt, path::PathBuf, sync::{ - atomic::{AtomicI32, Ordering::SeqCst}, Arc, + atomic::{AtomicI32, Ordering::SeqCst}, }, time::{Duration, Instant}, }; diff --git a/crates/context_server/src/context_server.rs b/crates/context_server/src/context_server.rs index bbd0cc6a7c..27d285ba93 100644 --- a/crates/context_server/src/context_server.rs +++ b/crates/context_server/src/context_server.rs @@ -9,7 +9,7 @@ pub mod types; use command_palette_hooks::CommandPaletteFilter; pub use context_server_settings::{ContextServerSettings, ServerCommand, ServerConfig}; -use gpui::{actions, App}; +use gpui::{App, actions}; pub use crate::context_server_tool::ContextServerTool; pub use crate::registry::ContextServerFactoryRegistry; diff --git a/crates/context_server/src/context_server_tool.rs b/crates/context_server/src/context_server_tool.rs index d932d516ce..31801ddfc7 100644 --- a/crates/context_server/src/context_server_tool.rs +++ b/crates/context_server/src/context_server_tool.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use anyhow::{anyhow, bail, Result}; +use anyhow::{Result, anyhow, bail}; use assistant_tool::{ActionLog, Tool, ToolSource}; use gpui::{App, Entity, Task}; use icons::IconName; diff --git a/crates/context_server/src/manager.rs b/crates/context_server/src/manager.rs index fdacb9308e..cb163a655a 100644 --- a/crates/context_server/src/manager.rs +++ b/crates/context_server/src/manager.rs @@ -17,7 +17,7 @@ use std::path::Path; use std::sync::Arc; -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use collections::HashMap; use command_palette_hooks::CommandPaletteFilter; use gpui::{AsyncApp, Context, Entity, EventEmitter, Subscription, Task, WeakEntity}; @@ -30,8 +30,9 @@ use util::ResultExt as _; use crate::{ContextServerSettings, ServerConfig}; use crate::{ + CONTEXT_SERVERS_NAMESPACE, ContextServerFactoryRegistry, client::{self, Client}, - types, ContextServerFactoryRegistry, CONTEXT_SERVERS_NAMESPACE, + types, }; pub struct ContextServer { diff --git a/crates/context_server_settings/src/context_server_settings.rs b/crates/context_server_settings/src/context_server_settings.rs index c98f504e5f..a8cfc12571 100644 --- a/crates/context_server_settings/src/context_server_settings.rs +++ b/crates/context_server_settings/src/context_server_settings.rs @@ -2,9 +2,9 @@ use std::sync::Arc; use collections::HashMap; use gpui::App; +use schemars::JsonSchema; use schemars::r#gen::SchemaGenerator; use schemars::schema::{InstanceType, Schema, SchemaObject}; -use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsSources}; diff --git a/crates/copilot/src/copilot.rs b/crates/copilot/src/copilot.rs index e60204a382..ac7b4b4a92 100644 --- a/crates/copilot/src/copilot.rs +++ b/crates/copilot/src/copilot.rs @@ -4,20 +4,20 @@ pub mod request; mod sign_in; use ::fs::Fs; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::{HashMap, HashSet}; use command_palette_hooks::CommandPaletteFilter; -use futures::{channel::oneshot, future::Shared, Future, FutureExt, TryFutureExt}; +use futures::{Future, FutureExt, TryFutureExt, channel::oneshot, future::Shared}; use gpui::{ - actions, App, AppContext as _, AsyncApp, Context, Entity, EntityId, EventEmitter, Global, Task, - WeakEntity, + App, AppContext as _, AsyncApp, Context, Entity, EntityId, EventEmitter, Global, Task, + WeakEntity, actions, }; use http_client::HttpClient; use language::language_settings::CopilotSettings; use language::{ - language_settings::{all_language_settings, language_settings, EditPredictionProvider}, - point_from_lsp, point_to_lsp, Anchor, Bias, Buffer, BufferSnapshot, Language, PointUtf16, - ToPointUtf16, + Anchor, Bias, Buffer, BufferSnapshot, Language, PointUtf16, ToPointUtf16, + language_settings::{EditPredictionProvider, all_language_settings, language_settings}, + point_from_lsp, point_to_lsp, }; use lsp::{LanguageServer, LanguageServerBinary, LanguageServerId, LanguageServerName}; use node_runtime::NodeRuntime; @@ -33,10 +33,10 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use util::{fs::remove_matching, ResultExt}; +use util::{ResultExt, fs::remove_matching}; pub use crate::copilot_completion_provider::CopilotCompletionProvider; -pub use crate::sign_in::{initiate_sign_in, CopilotCodeVerification}; +pub use crate::sign_in::{CopilotCodeVerification, initiate_sign_in}; actions!( copilot, diff --git a/crates/copilot/src/copilot_chat.rs b/crates/copilot/src/copilot_chat.rs index 15a4cddf20..e8274b1965 100644 --- a/crates/copilot/src/copilot_chat.rs +++ b/crates/copilot/src/copilot_chat.rs @@ -2,12 +2,12 @@ use std::path::PathBuf; use std::sync::Arc; use std::sync::OnceLock; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use chrono::DateTime; use collections::HashSet; use fs::Fs; -use futures::{io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, StreamExt}; -use gpui::{prelude::*, App, AsyncApp, Global}; +use futures::{AsyncBufReadExt, AsyncReadExt, StreamExt, io::BufReader, stream::BoxStream}; +use gpui::{App, AsyncApp, Global, prelude::*}; use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest}; use paths::home_dir; use serde::{Deserialize, Serialize}; diff --git a/crates/copilot/src/copilot_completion_provider.rs b/crates/copilot/src/copilot_completion_provider.rs index aad74f4744..fdf76e2392 100644 --- a/crates/copilot/src/copilot_completion_provider.rs +++ b/crates/copilot/src/copilot_completion_provider.rs @@ -2,7 +2,7 @@ use crate::{Completion, Copilot}; use anyhow::Result; use gpui::{App, Context, Entity, EntityId, Task}; use inline_completion::{Direction, EditPredictionProvider, InlineCompletion}; -use language::{language_settings::AllLanguageSettings, Buffer, OffsetRangeExt, ToOffset}; +use language::{Buffer, OffsetRangeExt, ToOffset, language_settings::AllLanguageSettings}; use project::Project; use settings::Settings; use std::{path::Path, time::Duration}; @@ -264,18 +264,18 @@ fn common_prefix, T2: Iterator>(a: T1, b: mod tests { use super::*; use editor::{ - test::editor_lsp_test_context::EditorLspTestContext, Editor, ExcerptRange, MultiBuffer, + Editor, ExcerptRange, MultiBuffer, test::editor_lsp_test_context::EditorLspTestContext, }; use fs::FakeFs; use futures::StreamExt; use gpui::{AppContext as _, BackgroundExecutor, TestAppContext, UpdateGlobal}; use indoc::indoc; use language::{ + Point, language_settings::{ AllLanguageSettings, AllLanguageSettingsContent, CompletionSettings, WordsCompletionMode, }, - Point, }; use project::Project; use serde_json::json; @@ -283,7 +283,7 @@ mod tests { use std::future::Future; use util::{ path, - test::{marked_text_ranges_by, TextRangeMarker}, + test::{TextRangeMarker, marked_text_ranges_by}, }; #[gpui::test(iterations = 10)] diff --git a/crates/copilot/src/sign_in.rs b/crates/copilot/src/sign_in.rs index 4afff98c4f..70ca6b7d47 100644 --- a/crates/copilot/src/sign_in.rs +++ b/crates/copilot/src/sign_in.rs @@ -1,11 +1,11 @@ -use crate::{request::PromptUserDeviceFlow, Copilot, Status}; +use crate::{Copilot, Status, request::PromptUserDeviceFlow}; use gpui::{ - div, percentage, svg, Animation, AnimationExt, App, ClipboardItem, Context, DismissEvent, - Element, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, IntoElement, - MouseDownEvent, ParentElement, Render, Styled, Subscription, Transformation, Window, + Animation, AnimationExt, App, ClipboardItem, Context, DismissEvent, Element, Entity, + EventEmitter, FocusHandle, Focusable, InteractiveElement, IntoElement, MouseDownEvent, + ParentElement, Render, Styled, Subscription, Transformation, Window, div, percentage, svg, }; use std::time::Duration; -use ui::{prelude::*, Button, Label, Vector, VectorName}; +use ui::{Button, Label, Vector, VectorName, prelude::*}; use util::ResultExt as _; use workspace::notifications::NotificationId; use workspace::{ModalView, Toast, Workspace}; diff --git a/crates/dap/src/adapters.rs b/crates/dap/src/adapters.rs index a1e0cc0b8f..8dfd4896d0 100644 --- a/crates/dap/src/adapters.rs +++ b/crates/dap/src/adapters.rs @@ -1,11 +1,11 @@ use ::fs::Fs; -use anyhow::{anyhow, Context as _, Ok, Result}; +use anyhow::{Context as _, Ok, Result, anyhow}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use async_trait::async_trait; use futures::io::BufReader; use gpui::{AsyncApp, SharedString}; -pub use http_client::{github::latest_github_release, HttpClient}; +pub use http_client::{HttpClient, github::latest_github_release}; use language::LanguageToolchainStore; use node_runtime::NodeRuntime; use serde::{Deserialize, Serialize}; diff --git a/crates/dap/src/client.rs b/crates/dap/src/client.rs index aa058620da..c681b64e55 100644 --- a/crates/dap/src/client.rs +++ b/crates/dap/src/client.rs @@ -2,12 +2,12 @@ use crate::{ adapters::{DebugAdapterBinary, DebugAdapterName}, transport::{IoKind, LogKind, TransportDelegate}, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use dap_types::{ messages::{Message, Response}, requests::Request, }; -use futures::{channel::oneshot, select, FutureExt as _}; +use futures::{FutureExt as _, channel::oneshot, select}; use gpui::{AppContext, AsyncApp, BackgroundExecutor}; use smol::channel::{Receiver, Sender}; use std::{ @@ -281,17 +281,17 @@ mod tests { use super::*; use crate::{client::DebugAdapterClient, debugger_settings::DebuggerSettings}; use dap_types::{ - messages::Events, - requests::{Initialize, Request, RunInTerminal}, Capabilities, InitializeRequestArguments, InitializeRequestArgumentsPathFormat, RunInTerminalRequestArguments, + messages::Events, + requests::{Initialize, Request, RunInTerminal}, }; use gpui::TestAppContext; use serde_json::json; use settings::{Settings, SettingsStore}; use std::sync::{ - atomic::{AtomicBool, Ordering}, Arc, + atomic::{AtomicBool, Ordering}, }; pub fn init_test(cx: &mut gpui::TestAppContext) { diff --git a/crates/dap/src/proto_conversions.rs b/crates/dap/src/proto_conversions.rs index 097593b11c..f110ccc614 100644 --- a/crates/dap/src/proto_conversions.rs +++ b/crates/dap/src/proto_conversions.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use client::proto::{ self, DapChecksum, DapChecksumAlgorithm, DapEvaluateContext, DapModule, DapScope, DapScopePresentationHint, DapSource, DapSourcePresentationHint, DapStackFrame, DapVariable, diff --git a/crates/dap/src/transport.rs b/crates/dap/src/transport.rs index 7106f076dd..727cc1c00d 100644 --- a/crates/dap/src/transport.rs +++ b/crates/dap/src/transport.rs @@ -1,14 +1,14 @@ -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use dap_types::{ - messages::{Message, Response}, ErrorResponse, + messages::{Message, Response}, }; -use futures::{channel::oneshot, select, AsyncRead, AsyncReadExt as _, AsyncWrite, FutureExt as _}; +use futures::{AsyncRead, AsyncReadExt as _, AsyncWrite, FutureExt as _, channel::oneshot, select}; use gpui::AsyncApp; use settings::Settings as _; use smallvec::SmallVec; use smol::{ - channel::{unbounded, Receiver, Sender}, + channel::{Receiver, Sender, unbounded}, io::{AsyncBufReadExt as _, AsyncWriteExt, BufReader}, lock::Mutex, net::{TcpListener, TcpStream}, diff --git a/crates/dap_adapters/src/dap_adapters.rs b/crates/dap_adapters/src/dap_adapters.rs index c9c0a58ed8..b337bfbf5a 100644 --- a/crates/dap_adapters/src/dap_adapters.rs +++ b/crates/dap_adapters/src/dap_adapters.rs @@ -7,14 +7,14 @@ mod python; use std::{net::Ipv4Addr, sync::Arc}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use dap::{ + DapRegistry, adapters::{ self, AdapterVersion, DapDelegate, DebugAdapter, DebugAdapterBinary, DebugAdapterName, GithubRepo, }, - DapRegistry, }; use gdb::GdbDebugAdapter; use go::GoDebugAdapter; @@ -22,7 +22,7 @@ use javascript::JsDebugAdapter; use lldb::LldbDebugAdapter; use php::PhpDebugAdapter; use python::PythonDebugAdapter; -use serde_json::{json, Value}; +use serde_json::{Value, json}; use task::{DebugAdapterConfig, TCPHost}; pub fn init(registry: Arc) { diff --git a/crates/dap_adapters/src/gdb.rs b/crates/dap_adapters/src/gdb.rs index f0fde352b1..3187a00fa0 100644 --- a/crates/dap_adapters/src/gdb.rs +++ b/crates/dap_adapters/src/gdb.rs @@ -1,6 +1,6 @@ use std::ffi::OsStr; -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use async_trait::async_trait; use gpui::AsyncApp; use task::{DebugAdapterConfig, DebugTaskDefinition}; diff --git a/crates/db/src/db.rs b/crates/db/src/db.rs index 0b1e5767a4..5d8fec21f6 100644 --- a/crates/db/src/db.rs +++ b/crates/db/src/db.rs @@ -17,9 +17,9 @@ use sqlez::thread_safe_connection::ThreadSafeConnection; use sqlez_macros::sql; use std::future::Future; use std::path::Path; -use std::sync::{atomic::Ordering, LazyLock}; +use std::sync::{LazyLock, atomic::Ordering}; use std::{env, sync::atomic::AtomicBool}; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; const CONNECTION_INITIALIZE_QUERY: &str = sql!( PRAGMA foreign_keys=TRUE; diff --git a/crates/debugger_tools/src/dap_log.rs b/crates/debugger_tools/src/dap_log.rs index cae500abb7..80b34a851d 100644 --- a/crates/debugger_tools/src/dap_log.rs +++ b/crates/debugger_tools/src/dap_log.rs @@ -5,17 +5,17 @@ use dap::{ }; use editor::{Editor, EditorEvent}; use futures::{ - channel::mpsc::{unbounded, UnboundedSender}, StreamExt, + channel::mpsc::{UnboundedSender, unbounded}, }; use gpui::{ - actions, div, App, AppContext, Context, Empty, Entity, EventEmitter, FocusHandle, Focusable, - IntoElement, ParentElement, Render, SharedString, Styled, Subscription, WeakEntity, Window, + App, AppContext, Context, Empty, Entity, EventEmitter, FocusHandle, Focusable, IntoElement, + ParentElement, Render, SharedString, Styled, Subscription, WeakEntity, Window, actions, div, }; use project::{ + Project, debugger::{dap_store, session::Session}, search::SearchQuery, - Project, }; use settings::Settings as _; use std::{ @@ -25,10 +25,10 @@ use std::{ }; use util::maybe; use workspace::{ + ToolbarItemEvent, ToolbarItemView, Workspace, item::Item, searchable::{Direction, SearchEvent, SearchableItem, SearchableItemHandle}, - ui::{h_flex, Button, Clickable, ContextMenu, Label, LabelCommon, PopoverMenu}, - ToolbarItemEvent, ToolbarItemView, Workspace, + ui::{Button, Clickable, ContextMenu, Label, LabelCommon, PopoverMenu, h_flex}, }; struct DapLogView { diff --git a/crates/debugger_ui/src/attach_modal.rs b/crates/debugger_ui/src/attach_modal.rs index ac2219b4c8..de4e005939 100644 --- a/crates/debugger_ui/src/attach_modal.rs +++ b/crates/debugger_ui/src/attach_modal.rs @@ -7,7 +7,7 @@ use picker::{Picker, PickerDelegate}; use std::cell::LazyCell; use std::sync::Arc; use sysinfo::System; -use ui::{prelude::*, Context, Tooltip}; +use ui::{Context, Tooltip, prelude::*}; use ui::{ListItem, ListItemSpacing}; use util::debug_panic; use workspace::ModalView; diff --git a/crates/debugger_ui/src/debugger_panel.rs b/crates/debugger_ui/src/debugger_panel.rs index 0246603bce..0e441f2376 100644 --- a/crates/debugger_ui/src/debugger_panel.rs +++ b/crates/debugger_ui/src/debugger_panel.rs @@ -1,20 +1,20 @@ use crate::session::DebugSession; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::HashMap; use command_palette_hooks::CommandPaletteFilter; use dap::{ - client::SessionId, debugger_settings::DebuggerSettings, ContinuedEvent, LoadedSourceEvent, - ModuleEvent, OutputEvent, StoppedEvent, ThreadEvent, + ContinuedEvent, LoadedSourceEvent, ModuleEvent, OutputEvent, StoppedEvent, ThreadEvent, + client::SessionId, debugger_settings::DebuggerSettings, }; -use futures::{channel::mpsc, SinkExt as _}; +use futures::{SinkExt as _, channel::mpsc}; use gpui::{ - actions, Action, App, AsyncWindowContext, Context, Entity, EventEmitter, FocusHandle, - Focusable, Subscription, Task, WeakEntity, + Action, App, AsyncWindowContext, Context, Entity, EventEmitter, FocusHandle, Focusable, + Subscription, Task, WeakEntity, actions, }; use project::{ + Project, debugger::dap_store::{self, DapStore}, terminals::TerminalKind, - Project, }; use rpc::proto::{self}; use settings::Settings; @@ -24,9 +24,10 @@ use terminal_view::terminal_panel::TerminalPanel; use ui::prelude::*; use util::ResultExt; use workspace::{ + ClearAllBreakpoints, Continue, Disconnect, Pane, Pause, Restart, StepBack, StepInto, StepOut, + StepOver, Stop, ToggleIgnoreBreakpoints, Workspace, dock::{DockPosition, Panel, PanelEvent}, - pane, ClearAllBreakpoints, Continue, Disconnect, Pane, Pause, Restart, StepBack, StepInto, - StepOut, StepOver, Stop, ToggleIgnoreBreakpoints, Workspace, + pane, }; pub enum DebugPanelEvent { diff --git a/crates/debugger_ui/src/session.rs b/crates/debugger_ui/src/session.rs index 0c5f81b679..fd9e76c9fe 100644 --- a/crates/debugger_ui/src/session.rs +++ b/crates/debugger_ui/src/session.rs @@ -8,22 +8,22 @@ use std::time::Duration; use dap::client::SessionId; use failed::FailedState; use gpui::{ - percentage, Animation, AnimationExt, AnyElement, App, Entity, EventEmitter, FocusHandle, - Focusable, Subscription, Task, Transformation, WeakEntity, + Animation, AnimationExt, AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, + Subscription, Task, Transformation, WeakEntity, percentage, }; use inert::{InertEvent, InertState}; +use project::Project; use project::debugger::{dap_store::DapStore, session::Session}; use project::worktree_store::WorktreeStore; -use project::Project; use rpc::proto::{self, PeerId}; use running::RunningState; use starting::{StartingEvent, StartingState}; use task::DebugTaskDefinition; -use ui::{prelude::*, Indicator}; +use ui::{Indicator, prelude::*}; use util::ResultExt; use workspace::{ - item::{self, Item}, FollowableItem, ViewId, Workspace, + item::{self, Item}, }; use crate::debugger_panel::DebugPanel; diff --git a/crates/debugger_ui/src/session/failed.rs b/crates/debugger_ui/src/session/failed.rs index ac3c96ad86..c94f228491 100644 --- a/crates/debugger_ui/src/session/failed.rs +++ b/crates/debugger_ui/src/session/failed.rs @@ -1,6 +1,6 @@ use gpui::{FocusHandle, Focusable}; use ui::{ - h_flex, Color, Context, IntoElement, Label, LabelCommon, ParentElement, Render, Styled, Window, + Color, Context, IntoElement, Label, LabelCommon, ParentElement, Render, Styled, Window, h_flex, }; pub(crate) struct FailedState { diff --git a/crates/debugger_ui/src/session/inert.rs b/crates/debugger_ui/src/session/inert.rs index 4c3861176f..b614ecd82b 100644 --- a/crates/debugger_ui/src/session/inert.rs +++ b/crates/debugger_ui/src/session/inert.rs @@ -7,10 +7,10 @@ use settings::Settings as _; use task::{DebugTaskDefinition, LaunchConfig, TCPHost}; use theme::ThemeSettings; use ui::{ - div, h_flex, relative, v_flex, ActiveTheme as _, ButtonCommon, ButtonLike, Clickable, Context, - ContextMenu, Disableable, DropdownMenu, FluentBuilder, Icon, IconName, IconSize, - InteractiveElement, IntoElement, Label, LabelCommon, LabelSize, ParentElement, PopoverMenu, - PopoverMenuHandle, Render, SharedString, SplitButton, Styled, Window, + ActiveTheme as _, ButtonCommon, ButtonLike, Clickable, Context, ContextMenu, Disableable, + DropdownMenu, FluentBuilder, Icon, IconName, IconSize, InteractiveElement, IntoElement, Label, + LabelCommon, LabelSize, ParentElement, PopoverMenu, PopoverMenuHandle, Render, SharedString, + SplitButton, Styled, Window, div, h_flex, relative, v_flex, }; use workspace::Workspace; diff --git a/crates/debugger_ui/src/session/running.rs b/crates/debugger_ui/src/session/running.rs index 808cb509e0..28137b89fb 100644 --- a/crates/debugger_ui/src/session/running.rs +++ b/crates/debugger_ui/src/session/running.rs @@ -6,7 +6,7 @@ pub mod variable_list; use super::{DebugPanelItemEvent, ThreadItem}; use console::Console; -use dap::{client::SessionId, debugger_settings::DebuggerSettings, Capabilities, Thread}; +use dap::{Capabilities, Thread, client::SessionId, debugger_settings::DebuggerSettings}; use gpui::{AppContext, Entity, EventEmitter, FocusHandle, Focusable, Subscription, WeakEntity}; use loaded_source_list::LoadedSourceList; use module_list::ModuleList; @@ -15,10 +15,10 @@ use rpc::proto::ViewId; use settings::Settings; use stack_frame_list::StackFrameList; use ui::{ - div, h_flex, v_flex, ActiveTheme, AnyElement, App, Button, ButtonCommon, Clickable, Context, - ContextMenu, Disableable, Divider, DropdownMenu, FluentBuilder, IconButton, IconName, IconSize, - Indicator, InteractiveElement, IntoElement, Label, ParentElement, Render, SharedString, - StatefulInteractiveElement, Styled, Tooltip, Window, + ActiveTheme, AnyElement, App, Button, ButtonCommon, Clickable, Context, ContextMenu, + Disableable, Divider, DropdownMenu, FluentBuilder, IconButton, IconName, IconSize, Indicator, + InteractiveElement, IntoElement, Label, ParentElement, Render, SharedString, + StatefulInteractiveElement, Styled, Tooltip, Window, div, h_flex, v_flex, }; use util::ResultExt; use variable_list::VariableList; diff --git a/crates/debugger_ui/src/session/running/console.rs b/crates/debugger_ui/src/session/running/console.rs index d8b452d471..1f8b9582ff 100644 --- a/crates/debugger_ui/src/session/running/console.rs +++ b/crates/debugger_ui/src/session/running/console.rs @@ -11,8 +11,8 @@ use gpui::{Context, Entity, Render, Subscription, Task, TextStyle, WeakEntity}; use language::{Buffer, CodeLabel}; use menu::Confirm; use project::{ - debugger::session::{CompletionsQuery, OutputToken, Session}, Completion, + debugger::session::{CompletionsQuery, OutputToken, Session}, }; use settings::Settings; use std::{cell::RefCell, rc::Rc, usize}; diff --git a/crates/debugger_ui/src/session/running/loaded_source_list.rs b/crates/debugger_ui/src/session/running/loaded_source_list.rs index 4de0e40e82..0c4ad90a75 100644 --- a/crates/debugger_ui/src/session/running/loaded_source_list.rs +++ b/crates/debugger_ui/src/session/running/loaded_source_list.rs @@ -1,4 +1,4 @@ -use gpui::{list, AnyElement, Empty, Entity, FocusHandle, Focusable, ListState, Subscription}; +use gpui::{AnyElement, Empty, Entity, FocusHandle, Focusable, ListState, Subscription, list}; use project::debugger::session::{Session, SessionEvent}; use ui::prelude::*; use util::maybe; diff --git a/crates/debugger_ui/src/session/running/module_list.rs b/crates/debugger_ui/src/session/running/module_list.rs index 0b0c43b0d7..230c92453c 100644 --- a/crates/debugger_ui/src/session/running/module_list.rs +++ b/crates/debugger_ui/src/session/running/module_list.rs @@ -1,10 +1,10 @@ use anyhow::anyhow; use gpui::{ - list, AnyElement, Empty, Entity, FocusHandle, Focusable, ListState, Subscription, WeakEntity, + AnyElement, Empty, Entity, FocusHandle, Focusable, ListState, Subscription, WeakEntity, list, }; use project::{ - debugger::session::{Session, SessionEvent}, ProjectItem as _, ProjectPath, + debugger::session::{Session, SessionEvent}, }; use std::{path::Path, sync::Arc}; use ui::prelude::*; diff --git a/crates/debugger_ui/src/session/running/stack_frame_list.rs b/crates/debugger_ui/src/session/running/stack_frame_list.rs index df0ea9eaaa..1b24c643e7 100644 --- a/crates/debugger_ui/src/session/running/stack_frame_list.rs +++ b/crates/debugger_ui/src/session/running/stack_frame_list.rs @@ -1,17 +1,17 @@ use std::path::Path; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use dap::StackFrameId; use gpui::{ - list, AnyElement, Entity, EventEmitter, FocusHandle, Focusable, ListState, Subscription, Task, - WeakEntity, + AnyElement, Entity, EventEmitter, FocusHandle, Focusable, ListState, Subscription, Task, + WeakEntity, list, }; use language::PointUtf16; use project::debugger::session::{Session, SessionEvent, StackFrame}; use project::{ProjectItem, ProjectPath}; -use ui::{prelude::*, Tooltip}; +use ui::{Tooltip, prelude::*}; use util::ResultExt; use workspace::Workspace; diff --git a/crates/debugger_ui/src/session/running/variable_list.rs b/crates/debugger_ui/src/session/running/variable_list.rs index 8eb5dbaa70..6921024d57 100644 --- a/crates/debugger_ui/src/session/running/variable_list.rs +++ b/crates/debugger_ui/src/session/running/variable_list.rs @@ -2,14 +2,14 @@ use super::stack_frame_list::{StackFrameList, StackFrameListEvent}; use dap::{ScopePresentationHint, StackFrameId, VariablePresentationHintKind, VariableReference}; use editor::Editor; use gpui::{ - actions, anchored, deferred, uniform_list, AnyElement, ClickEvent, ClipboardItem, Context, - DismissEvent, Entity, FocusHandle, Focusable, Hsla, MouseButton, MouseDownEvent, Point, - Stateful, Subscription, TextStyleRefinement, UniformListScrollHandle, + AnyElement, ClickEvent, ClipboardItem, Context, DismissEvent, Entity, FocusHandle, Focusable, + Hsla, MouseButton, MouseDownEvent, Point, Stateful, Subscription, TextStyleRefinement, + UniformListScrollHandle, actions, anchored, deferred, uniform_list, }; use menu::{SelectFirst, SelectLast, SelectNext, SelectPrevious}; use project::debugger::session::{Session, SessionEvent}; use std::{collections::HashMap, ops::Range, sync::Arc}; -use ui::{prelude::*, ContextMenu, ListItem, Scrollbar, ScrollbarState}; +use ui::{ContextMenu, ListItem, Scrollbar, ScrollbarState, prelude::*}; use util::{debug_panic, maybe}; actions!(variable_list, [ExpandSelectedEntry, CollapseSelectedEntry]); diff --git a/crates/debugger_ui/src/session/starting.rs b/crates/debugger_ui/src/session/starting.rs index dfbb7bb947..bdbeee6302 100644 --- a/crates/debugger_ui/src/session/starting.rs +++ b/crates/debugger_ui/src/session/starting.rs @@ -4,11 +4,11 @@ use anyhow::Result; use dap::client::SessionId; use gpui::{ - percentage, Animation, AnimationExt, Entity, EventEmitter, FocusHandle, Focusable, Task, - Transformation, + Animation, AnimationExt, Entity, EventEmitter, FocusHandle, Focusable, Task, Transformation, + percentage, }; use project::debugger::session::Session; -use ui::{v_flex, Color, Context, Icon, IconName, IntoElement, ParentElement, Render, Styled}; +use ui::{Color, Context, Icon, IconName, IntoElement, ParentElement, Render, Styled, v_flex}; pub(crate) struct StartingState { focus_handle: FocusHandle, diff --git a/crates/debugger_ui/src/tests/attach_modal.rs b/crates/debugger_ui/src/tests/attach_modal.rs index 66f402706b..b4b6cb6782 100644 --- a/crates/debugger_ui/src/tests/attach_modal.rs +++ b/crates/debugger_ui/src/tests/attach_modal.rs @@ -1,6 +1,6 @@ use crate::{attach_modal::Candidate, *}; use attach_modal::AttachModal; -use dap::{client::SessionId, FakeAdapter}; +use dap::{FakeAdapter, client::SessionId}; use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext}; use menu::Confirm; use project::{FakeFs, Project}; diff --git a/crates/debugger_ui/src/tests/debugger_panel.rs b/crates/debugger_ui/src/tests/debugger_panel.rs index 72a082f1f1..4ddff9701d 100644 --- a/crates/debugger_ui/src/tests/debugger_panel.rs +++ b/crates/debugger_ui/src/tests/debugger_panel.rs @@ -1,35 +1,35 @@ use crate::*; use dap::{ + ErrorResponse, RunInTerminalRequestArguments, SourceBreakpoint, StartDebuggingRequestArguments, + StartDebuggingRequestArgumentsRequest, client::SessionId, requests::{ Continue, Disconnect, Launch, Next, RunInTerminal, SetBreakpoints, StackTrace, StartDebugging, StepBack, StepIn, StepOut, Threads, }, - ErrorResponse, RunInTerminalRequestArguments, SourceBreakpoint, StartDebuggingRequestArguments, - StartDebuggingRequestArgumentsRequest, }; use editor::{ - actions::{self}, Editor, EditorMode, MultiBuffer, + actions::{self}, }; use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext}; use project::{ - debugger::session::{ThreadId, ThreadStatus}, FakeFs, Project, + debugger::session::{ThreadId, ThreadStatus}, }; use serde_json::json; use std::{ path::Path, sync::{ - atomic::{AtomicBool, Ordering}, Arc, + atomic::{AtomicBool, Ordering}, }, }; use task::LaunchConfig; -use terminal_view::{terminal_panel::TerminalPanel, TerminalView}; +use terminal_view::{TerminalView, terminal_panel::TerminalPanel}; use tests::{active_debug_session_panel, init_test, init_test_workspace}; use util::path; -use workspace::{dock::Panel, Item}; +use workspace::{Item, dock::Panel}; #[gpui::test] async fn test_basic_show_debug_panel(executor: BackgroundExecutor, cx: &mut TestAppContext) { @@ -444,15 +444,17 @@ async fn test_handle_successful_run_in_terminal_reverse_request( let panel = terminal_panel.read(cx).pane().unwrap().read(cx); assert_eq!(1, panel.items_len()); - assert!(panel - .active_item() - .unwrap() - .downcast::() - .unwrap() - .read(cx) - .terminal() - .read(cx) - .debug_terminal()); + assert!( + panel + .active_item() + .unwrap() + .downcast::() + .unwrap() + .read(cx) + .terminal() + .read(cx) + .debug_terminal() + ); }) .unwrap(); @@ -772,15 +774,21 @@ async fn test_shutdown_children_when_parent_session_shutdown( // assert parent session and all children sessions are shutdown dap_store.update(cx, |dap_store, cx| { - assert!(dap_store - .session_by_id(parent_session.read(cx).session_id()) - .is_none()); - assert!(dap_store - .session_by_id(first_child_session.read(cx).session_id()) - .is_none()); - assert!(dap_store - .session_by_id(second_child_session.read(cx).session_id()) - .is_none()); + assert!( + dap_store + .session_by_id(parent_session.read(cx).session_id()) + .is_none() + ); + assert!( + dap_store + .session_by_id(first_child_session.read(cx).session_id()) + .is_none() + ); + assert!( + dap_store + .session_by_id(second_child_session.read(cx).session_id()) + .is_none() + ); }); } @@ -874,15 +882,21 @@ async fn test_shutdown_parent_session_if_all_children_are_shutdown( // assert parent session and second child session still exist dap_store.update(cx, |dap_store, cx| { - assert!(dap_store - .session_by_id(parent_session.read(cx).session_id()) - .is_some()); - assert!(dap_store - .session_by_id(first_child_session.read(cx).session_id()) - .is_none()); - assert!(dap_store - .session_by_id(second_child_session.read(cx).session_id()) - .is_some()); + assert!( + dap_store + .session_by_id(parent_session.read(cx).session_id()) + .is_some() + ); + assert!( + dap_store + .session_by_id(first_child_session.read(cx).session_id()) + .is_none() + ); + assert!( + dap_store + .session_by_id(second_child_session.read(cx).session_id()) + .is_some() + ); }); // shutdown first child session @@ -896,12 +910,16 @@ async fn test_shutdown_parent_session_if_all_children_are_shutdown( // assert parent session got shutdown by second child session // because it was the last child dap_store.update(cx, |dap_store, cx| { - assert!(dap_store - .session_by_id(parent_session.read(cx).session_id()) - .is_none()); - assert!(dap_store - .session_by_id(second_child_session.read(cx).session_id()) - .is_none()); + assert!( + dap_store + .session_by_id(parent_session.read(cx).session_id()) + .is_none() + ); + assert!( + dap_store + .session_by_id(second_child_session.read(cx).session_id()) + .is_none() + ); }); } diff --git a/crates/debugger_ui/src/tests/module_list.rs b/crates/debugger_ui/src/tests/module_list.rs index 91bc195f9f..3aa2000829 100644 --- a/crates/debugger_ui/src/tests/module_list.rs +++ b/crates/debugger_ui/src/tests/module_list.rs @@ -4,14 +4,14 @@ use crate::{ tests::{active_debug_session_panel, init_test, init_test_workspace}, }; use dap::{ - requests::{Modules, StackTrace, Threads}, StoppedEvent, + requests::{Modules, StackTrace, Threads}, }; use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext}; use project::{FakeFs, Project}; use std::sync::{ - atomic::{AtomicBool, AtomicI32, Ordering}, Arc, + atomic::{AtomicBool, AtomicI32, Ordering}, }; use task::LaunchConfig; diff --git a/crates/debugger_ui/src/tests/stack_frame_list.rs b/crates/debugger_ui/src/tests/stack_frame_list.rs index 5f3d3d601b..7fd67e9600 100644 --- a/crates/debugger_ui/src/tests/stack_frame_list.rs +++ b/crates/debugger_ui/src/tests/stack_frame_list.rs @@ -4,8 +4,8 @@ use crate::{ tests::{active_debug_session_panel, init_test, init_test_workspace}, }; use dap::{ - requests::{StackTrace, Threads}, StackFrame, + requests::{StackTrace, Threads}, }; use editor::{Editor, ToPoint as _}; use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext}; diff --git a/crates/debugger_ui/src/tests/variable_list.rs b/crates/debugger_ui/src/tests/variable_list.rs index 958470dd10..ffaaff2003 100644 --- a/crates/debugger_ui/src/tests/variable_list.rs +++ b/crates/debugger_ui/src/tests/variable_list.rs @@ -1,17 +1,17 @@ use std::sync::{ - atomic::{AtomicBool, Ordering}, Arc, + atomic::{AtomicBool, Ordering}, }; use crate::{ + DebugPanel, session::running::variable_list::{CollapseSelectedEntry, ExpandSelectedEntry}, tests::{active_debug_session_panel, init_test, init_test_workspace}, - DebugPanel, }; use collections::HashMap; use dap::{ - requests::{Initialize, Launch, Scopes, StackTrace, Variables}, Scope, StackFrame, Variable, + requests::{Initialize, Launch, Scopes, StackTrace, Variables}, }; use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext}; use menu::{SelectFirst, SelectNext, SelectPrevious}; diff --git a/crates/deepseek/src/deepseek.rs b/crates/deepseek/src/deepseek.rs index 777cf696d8..07f6a959e1 100644 --- a/crates/deepseek/src/deepseek.rs +++ b/crates/deepseek/src/deepseek.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use futures::{ + AsyncBufReadExt, AsyncReadExt, io::BufReader, stream::{BoxStream, StreamExt}, - AsyncBufReadExt, AsyncReadExt, }; use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest}; use serde::{Deserialize, Serialize}; diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index 090ceacdb8..fc8320dc19 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -7,23 +7,22 @@ mod diagnostics_tests; use anyhow::Result; use collections::{BTreeSet, HashSet}; use editor::{ - diagnostic_block_renderer, + Editor, EditorEvent, ExcerptId, ExcerptRange, MultiBuffer, ToOffset, diagnostic_block_renderer, display_map::{BlockPlacement, BlockProperties, BlockStyle, CustomBlockId, RenderBlock}, highlight_diagnostic_message, scroll::Autoscroll, - Editor, EditorEvent, ExcerptId, ExcerptRange, MultiBuffer, ToOffset, }; use gpui::{ - actions, div, svg, AnyElement, AnyView, App, AsyncApp, Context, Entity, EventEmitter, - FocusHandle, Focusable, Global, HighlightStyle, InteractiveElement, IntoElement, ParentElement, - Render, SharedString, Styled, StyledText, Subscription, Task, WeakEntity, Window, + AnyElement, AnyView, App, AsyncApp, Context, Entity, EventEmitter, FocusHandle, Focusable, + Global, HighlightStyle, InteractiveElement, IntoElement, ParentElement, Render, SharedString, + Styled, StyledText, Subscription, Task, WeakEntity, Window, actions, div, svg, }; use language::{ Bias, Buffer, BufferRow, BufferSnapshot, Diagnostic, DiagnosticEntry, DiagnosticSeverity, Point, Selection, SelectionGoal, ToTreeSitterPoint, }; use lsp::LanguageServerId; -use project::{project_settings::ProjectSettings, DiagnosticSummary, Project, ProjectPath}; +use project::{DiagnosticSummary, Project, ProjectPath, project_settings::ProjectSettings}; use settings::Settings; use std::{ any::{Any, TypeId}, @@ -36,12 +35,12 @@ use std::{ }; use theme::ActiveTheme; pub use toolbar_controls::ToolbarControls; -use ui::{h_flex, prelude::*, Icon, IconName, Label}; +use ui::{Icon, IconName, Label, h_flex, prelude::*}; use util::ResultExt; use workspace::{ + ItemNavHistory, ToolbarItemLocation, Workspace, item::{BreadcrumbText, Item, ItemEvent, ItemHandle, TabContentParams}, searchable::SearchableItemHandle, - ItemNavHistory, ToolbarItemLocation, Workspace, }; actions!(diagnostics, [Deploy, ToggleWarnings]); diff --git a/crates/diagnostics/src/diagnostics_tests.rs b/crates/diagnostics/src/diagnostics_tests.rs index e6c1132154..b258676747 100644 --- a/crates/diagnostics/src/diagnostics_tests.rs +++ b/crates/diagnostics/src/diagnostics_tests.rs @@ -1,16 +1,16 @@ use super::*; use collections::HashMap; use editor::{ - display_map::{Block, BlockContext, DisplayRow}, DisplayPoint, GutterDimensions, + display_map::{Block, BlockContext, DisplayRow}, }; -use gpui::{px, AvailableSpace, Stateful, TestAppContext, VisualTestContext}; +use gpui::{AvailableSpace, Stateful, TestAppContext, VisualTestContext, px}; use language::{ Diagnostic, DiagnosticEntry, DiagnosticSeverity, OffsetRangeExt, PointUtf16, Rope, Unclipped, }; use pretty_assertions::assert_eq; use project::FakeFs; -use rand::{rngs::StdRng, seq::IteratorRandom as _, Rng}; +use rand::{Rng, rngs::StdRng, seq::IteratorRandom as _}; use serde_json::json; use settings::SettingsStore; use std::{ @@ -18,7 +18,7 @@ use std::{ path::{Path, PathBuf}, }; use unindent::Unindent as _; -use util::{path, post_inc, RandomCharIter}; +use util::{RandomCharIter, path, post_inc}; #[ctor::ctor] fn init_logger() { diff --git a/crates/diagnostics/src/items.rs b/crates/diagnostics/src/items.rs index ab77ae2f07..781e20fb64 100644 --- a/crates/diagnostics/src/items.rs +++ b/crates/diagnostics/src/items.rs @@ -6,8 +6,8 @@ use gpui::{ WeakEntity, Window, }; use language::Diagnostic; -use ui::{h_flex, prelude::*, Button, ButtonLike, Color, Icon, IconName, Label, Tooltip}; -use workspace::{item::ItemHandle, StatusItemView, ToolbarItemEvent, Workspace}; +use ui::{Button, ButtonLike, Color, Icon, IconName, Label, Tooltip, h_flex, prelude::*}; +use workspace::{StatusItemView, ToolbarItemEvent, Workspace, item::ItemHandle}; use crate::{Deploy, ProjectDiagnosticsEditor}; diff --git a/crates/diagnostics/src/toolbar_controls.rs b/crates/diagnostics/src/toolbar_controls.rs index 26e4ff20f8..69b0ca4f59 100644 --- a/crates/diagnostics/src/toolbar_controls.rs +++ b/crates/diagnostics/src/toolbar_controls.rs @@ -2,7 +2,7 @@ use crate::ProjectDiagnosticsEditor; use gpui::{Context, Entity, EventEmitter, ParentElement, Render, WeakEntity, Window}; use ui::prelude::*; use ui::{IconButton, IconButtonShape, IconName, Tooltip}; -use workspace::{item::ItemHandle, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView}; +use workspace::{ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, item::ItemHandle}; pub struct ToolbarControls { editor: Option>, diff --git a/crates/editor/src/clangd_ext.rs b/crates/editor/src/clangd_ext.rs index aee465a008..6062e7bc77 100644 --- a/crates/editor/src/clangd_ext.rs +++ b/crates/editor/src/clangd_ext.rs @@ -8,7 +8,7 @@ use workspace::{OpenOptions, OpenVisible}; use crate::lsp_ext::find_specific_language_server_in_selection; -use crate::{element::register_action, Editor, SwitchSourceHeader}; +use crate::{Editor, SwitchSourceHeader, element::register_action}; use project::lsp_store::clangd_ext::CLANGD_SERVER_NAME; diff --git a/crates/editor/src/code_context_menus.rs b/crates/editor/src/code_context_menus.rs index 0908ad48fb..cb49123a7b 100644 --- a/crates/editor/src/code_context_menus.rs +++ b/crates/editor/src/code_context_menus.rs @@ -1,34 +1,35 @@ use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - div, px, uniform_list, AnyElement, BackgroundExecutor, Entity, Focusable, FontWeight, - ListSizingBehavior, ScrollStrategy, SharedString, Size, StrikethroughStyle, StyledText, - UniformListScrollHandle, + AnyElement, BackgroundExecutor, Entity, Focusable, FontWeight, ListSizingBehavior, + ScrollStrategy, SharedString, Size, StrikethroughStyle, StyledText, UniformListScrollHandle, + div, px, uniform_list, }; use language::Buffer; use language::CodeLabel; use markdown::Markdown; use multi_buffer::{Anchor, ExcerptId}; use ordered_float::OrderedFloat; -use project::lsp_store::CompletionDocumentation; use project::CompletionSource; +use project::lsp_store::CompletionDocumentation; use project::{CodeAction, Completion, TaskSourceKind}; use std::{ cell::RefCell, - cmp::{min, Reverse}, + cmp::{Reverse, min}, iter, ops::Range, rc::Rc, }; use task::ResolvedTask; -use ui::{prelude::*, Color, IntoElement, ListItem, Pixels, Popover, Styled}; +use ui::{Color, IntoElement, ListItem, Pixels, Popover, Styled, prelude::*}; use util::ResultExt; use crate::hover_popover::{hover_markdown_style, open_markdown_url}; use crate::{ + CodeActionProvider, CompletionId, CompletionProvider, DisplayRow, Editor, EditorStyle, + ResolvedTasks, actions::{ConfirmCodeAction, ConfirmCompletion}, - split_words, styled_runs_for_code_label, CodeActionProvider, CompletionId, CompletionProvider, - DisplayRow, Editor, EditorStyle, ResolvedTasks, + split_words, styled_runs_for_code_label, }; pub const MENU_GAP: Pixels = px(4.); diff --git a/crates/editor/src/commit_tooltip.rs b/crates/editor/src/commit_tooltip.rs index a450ef5ac8..ccd3151fa9 100644 --- a/crates/editor/src/commit_tooltip.rs +++ b/crates/editor/src/commit_tooltip.rs @@ -1,6 +1,6 @@ use futures::Future; -use git::blame::BlameEntry; use git::PullRequest; +use git::blame::BlameEntry; use gpui::{ App, Asset, ClipboardItem, Element, Entity, MouseButton, ParentElement, Render, ScrollHandle, StatefulInteractiveElement, @@ -11,7 +11,7 @@ use std::hash::Hash; use theme::ThemeSettings; use time::{OffsetDateTime, UtcOffset}; use time_format::format_local_timestamp; -use ui::{prelude::*, tooltip_container, Avatar, Divider, IconButtonShape}; +use ui::{Avatar, Divider, IconButtonShape, prelude::*, tooltip_container}; use url::Url; use crate::git::blame::GitRemote; diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs index bde8378ba8..f2135762e2 100644 --- a/crates/editor/src/display_map.rs +++ b/crates/editor/src/display_map.rs @@ -27,7 +27,7 @@ mod tab_map; mod wrap_map; use crate::{ - hover_links::InlayHighlight, movement::TextLayoutDetails, EditorStyle, InlayId, RowExt, + EditorStyle, InlayId, RowExt, hover_links::InlayHighlight, movement::TextLayoutDetails, }; pub use block_map::{ Block, BlockChunks as DisplayChunks, BlockContext, BlockId, BlockMap, BlockPlacement, @@ -45,8 +45,8 @@ use inlay_map::{InlayMap, InlaySnapshot}; pub use inlay_map::{InlayOffset, InlayPoint}; pub use invisibles::{is_invisible, replacement}; use language::{ - language_settings::language_settings, ChunkRenderer, OffsetUtf16, Point, - Subscription as BufferSubscription, + ChunkRenderer, OffsetUtf16, Point, Subscription as BufferSubscription, + language_settings::language_settings, }; use lsp::DiagnosticSeverity; use multi_buffer::{ @@ -66,7 +66,7 @@ use std::{ use sum_tree::{Bias, TreeMap}; use tab_map::{TabMap, TabSnapshot}; use text::{BufferId, LineIndent}; -use ui::{px, SharedString}; +use ui::{SharedString, px}; use unicode_segmentation::UnicodeSegmentation; use wrap_map::{WrapMap, WrapSnapshot}; @@ -1295,7 +1295,7 @@ impl Add for DisplayPoint { type Output = Self; fn add(self, other: Self) -> Self::Output { - DisplayPoint(BlockPoint(self.0 .0 + other.0 .0)) + DisplayPoint(BlockPoint(self.0.0 + other.0.0)) } } @@ -1303,7 +1303,7 @@ impl Sub for DisplayPoint { type Output = Self; fn sub(self, other: Self) -> Self::Output { - DisplayPoint(BlockPoint(self.0 .0 - other.0 .0)) + DisplayPoint(BlockPoint(self.0.0 - other.0.0)) } } @@ -1417,18 +1417,19 @@ pub mod tests { movement, test::{marked_display_snapshot, test_font}, }; + use Bias::*; use block_map::BlockPlacement; use gpui::{ - div, font, observe, px, App, AppContext as _, BorrowAppContext, Element, Hsla, Rgba, + App, AppContext as _, BorrowAppContext, Element, Hsla, Rgba, div, font, observe, px, }; use language::{ - language_settings::{AllLanguageSettings, AllLanguageSettingsContent}, Buffer, Diagnostic, DiagnosticEntry, DiagnosticSet, Language, LanguageConfig, LanguageMatcher, + language_settings::{AllLanguageSettings, AllLanguageSettingsContent}, }; use lsp::LanguageServerId; use project::Project; - use rand::{prelude::*, Rng}; + use rand::{Rng, prelude::*}; use settings::SettingsStore; use smol::stream::StreamExt; use std::{env, sync::Arc}; @@ -1436,7 +1437,6 @@ pub mod tests { use theme::{LoadThemes, SyntaxTheme}; use unindent::Unindent as _; use util::test::{marked_text_ranges, sample_text}; - use Bias::*; #[gpui::test(iterations = 100)] async fn test_random_display_map(cx: &mut gpui::TestAppContext, mut rng: StdRng) { diff --git a/crates/editor/src/display_map/block_map.rs b/crates/editor/src/display_map/block_map.rs index 04c5bf0516..88849c9683 100644 --- a/crates/editor/src/display_map/block_map.rs +++ b/crates/editor/src/display_map/block_map.rs @@ -1,6 +1,6 @@ use super::{ - wrap_map::{self, WrapEdit, WrapPoint, WrapSnapshot}, Highlights, + wrap_map::{self, WrapEdit, WrapPoint, WrapSnapshot}, }; use crate::{EditorStyle, GutterDimensions}; use collections::{Bound, HashMap, HashSet}; @@ -17,8 +17,8 @@ use std::{ fmt::Debug, ops::{Deref, DerefMut, Range, RangeBounds, RangeInclusive}, sync::{ - atomic::{AtomicUsize, Ordering::SeqCst}, Arc, + atomic::{AtomicUsize, Ordering::SeqCst}, }, }; use sum_tree::{Bias, SumTree, Summary, TreeMap}; @@ -1282,8 +1282,8 @@ impl BlockSnapshot { let mut cursor = self.transforms.cursor::<(BlockRow, WrapRow)>(&()); cursor.seek(&BlockRow(rows.start), Bias::Right, &()); - let transform_output_start = cursor.start().0 .0; - let transform_input_start = cursor.start().1 .0; + let transform_output_start = cursor.start().0.0; + let transform_input_start = cursor.start().1.0; let mut input_start = transform_input_start; let mut input_end = transform_input_start; @@ -1441,7 +1441,7 @@ impl BlockSnapshot { let wrap_start_row = input_start.0 + overshoot; let wrap_end_row = cmp::min( input_start.0 + (range.end.0 - output_start.0), - cursor.end(&()).1 .0, + cursor.end(&()).1.0, ); let summary = self .wrap_snapshot @@ -1532,7 +1532,7 @@ impl BlockSnapshot { let max_input_row = WrapRow(self.transforms.summary().input_rows); let mut search_left = - (bias == Bias::Left && cursor.start().1 .0 > 0) || cursor.end(&()).1 == max_input_row; + (bias == Bias::Left && cursor.start().1.0 > 0) || cursor.end(&()).1 == max_input_row; let mut reversed = false; loop { @@ -1591,7 +1591,7 @@ impl BlockSnapshot { cursor.seek(&WrapRow(wrap_point.row()), Bias::Right, &()); if let Some(transform) = cursor.item() { if transform.block.is_some() { - BlockPoint::new(cursor.start().1 .0, 0) + BlockPoint::new(cursor.start().1.0, 0) } else { let (input_start_row, output_start_row) = cursor.start(); let input_start = Point::new(input_start_row.0, 0); @@ -1611,20 +1611,20 @@ impl BlockSnapshot { match transform.block.as_ref() { Some(block) => { if block.place_below() { - let wrap_row = cursor.start().1 .0 - 1; + let wrap_row = cursor.start().1.0 - 1; WrapPoint::new(wrap_row, self.wrap_snapshot.line_len(wrap_row)) } else if block.place_above() { - WrapPoint::new(cursor.start().1 .0, 0) + WrapPoint::new(cursor.start().1.0, 0) } else if bias == Bias::Left { - WrapPoint::new(cursor.start().1 .0, 0) + WrapPoint::new(cursor.start().1.0, 0) } else { - let wrap_row = cursor.end(&()).1 .0 - 1; + let wrap_row = cursor.end(&()).1.0 - 1; WrapPoint::new(wrap_row, self.wrap_snapshot.line_len(wrap_row)) } } None => { - let overshoot = block_point.row - cursor.start().0 .0; - let wrap_row = cursor.start().1 .0 + overshoot; + let overshoot = block_point.row - cursor.start().0.0; + let wrap_row = cursor.start().1.0 + overshoot; WrapPoint::new(wrap_row, block_point.column) } } @@ -1656,11 +1656,11 @@ impl BlockChunks<'_> { .item() .map_or(false, |transform| transform.block.is_none()) { - let start_input_row = self.transforms.start().1 .0; - let start_output_row = self.transforms.start().0 .0; + let start_input_row = self.transforms.start().1.0; + let start_output_row = self.transforms.start().0.0; if start_output_row < self.max_output_row { let end_input_row = cmp::min( - self.transforms.end(&()).1 .0, + self.transforms.end(&()).1.0, start_input_row + (self.max_output_row - start_output_row), ); self.input_chunks.seek(start_input_row..end_input_row); @@ -1683,8 +1683,8 @@ impl<'a> Iterator for BlockChunks<'a> { let transform = self.transforms.item()?; if transform.block.is_some() { - let block_start = self.transforms.start().0 .0; - let mut block_end = self.transforms.end(&()).0 .0; + let block_start = self.transforms.start().0.0; + let mut block_end = self.transforms.end(&()).0.0; self.advance(); if self.transforms.item().is_none() { block_end -= 1; @@ -1719,7 +1719,7 @@ impl<'a> Iterator for BlockChunks<'a> { } } - let transform_end = self.transforms.end(&()).0 .0; + let transform_end = self.transforms.end(&()).0.0; let (prefix_rows, prefix_bytes) = offset_for_row(self.input_chunk.text, transform_end - self.output_row); self.output_row += prefix_rows; @@ -1758,7 +1758,7 @@ impl Iterator for BlockRows<'_> { self.started = true; } - if self.output_row.0 >= self.transforms.end(&()).0 .0 { + if self.output_row.0 >= self.transforms.end(&()).0.0 { self.transforms.next(&()); while let Some(transform) = self.transforms.item() { if transform @@ -1778,7 +1778,7 @@ impl Iterator for BlockRows<'_> { .as_ref() .map_or(true, |block| block.is_replacement()) { - self.input_rows.seek(self.transforms.start().1 .0); + self.input_rows.seek(self.transforms.start().1.0); } } @@ -1913,7 +1913,7 @@ mod tests { display_map::{fold_map::FoldMap, inlay_map::InlayMap, tab_map::TabMap, wrap_map::WrapMap}, test::test_font, }; - use gpui::{div, font, px, App, AppContext as _, Element}; + use gpui::{App, AppContext as _, Element, div, font, px}; use itertools::Itertools; use language::{Buffer, Capability}; use multi_buffer::{ExcerptRange, MultiBuffer}; diff --git a/crates/editor/src/display_map/crease_map.rs b/crates/editor/src/display_map/crease_map.rs index af11a30ea0..ddc354d3e8 100644 --- a/crates/editor/src/display_map/crease_map.rs +++ b/crates/editor/src/display_map/crease_map.rs @@ -389,7 +389,7 @@ impl SeekTarget<'_, ItemSummary, ItemSummary> for Anchor { #[cfg(test)] mod test { use super::*; - use gpui::{div, App}; + use gpui::{App, div}; use multi_buffer::MultiBuffer; #[gpui::test] @@ -419,24 +419,32 @@ mod test { // Verify creases are inserted let crease_snapshot = crease_map.snapshot(); - assert!(crease_snapshot - .query_row(MultiBufferRow(1), &snapshot) - .is_some()); - assert!(crease_snapshot - .query_row(MultiBufferRow(3), &snapshot) - .is_some()); + assert!( + crease_snapshot + .query_row(MultiBufferRow(1), &snapshot) + .is_some() + ); + assert!( + crease_snapshot + .query_row(MultiBufferRow(3), &snapshot) + .is_some() + ); // Remove creases crease_map.remove(crease_ids, &snapshot); // Verify creases are removed let crease_snapshot = crease_map.snapshot(); - assert!(crease_snapshot - .query_row(MultiBufferRow(1), &snapshot) - .is_none()); - assert!(crease_snapshot - .query_row(MultiBufferRow(3), &snapshot) - .is_none()); + assert!( + crease_snapshot + .query_row(MultiBufferRow(1), &snapshot) + .is_none() + ); + assert!( + crease_snapshot + .query_row(MultiBufferRow(3), &snapshot) + .is_none() + ); } #[gpui::test] diff --git a/crates/editor/src/display_map/fold_map.rs b/crates/editor/src/display_map/fold_map.rs index 8461b1973c..b82c15f344 100644 --- a/crates/editor/src/display_map/fold_map.rs +++ b/crates/editor/src/display_map/fold_map.rs @@ -1,6 +1,6 @@ use super::{ - inlay_map::{InlayBufferRows, InlayChunks, InlayEdit, InlayOffset, InlayPoint, InlaySnapshot}, Highlights, + inlay_map::{InlayBufferRows, InlayChunks, InlayEdit, InlayOffset, InlayPoint, InlaySnapshot}, }; use gpui::{AnyElement, App, ElementId}; use language::{Chunk, ChunkRenderer, Edit, Point, TextSummary}; @@ -97,8 +97,8 @@ impl FoldPoint { pub fn to_inlay_point(self, snapshot: &FoldSnapshot) -> InlayPoint { let mut cursor = snapshot.transforms.cursor::<(FoldPoint, InlayPoint)>(&()); cursor.seek(&self, Bias::Right, &()); - let overshoot = self.0 - cursor.start().0 .0; - InlayPoint(cursor.start().1 .0 + overshoot) + let overshoot = self.0 - cursor.start().0.0; + InlayPoint(cursor.start().1.0 + overshoot) } pub fn to_offset(self, snapshot: &FoldSnapshot) -> FoldOffset { @@ -527,7 +527,7 @@ impl FoldMap { edit.old.start = old_transforms.start().0; } let old_start = - old_transforms.start().1 .0 + (edit.old.start - old_transforms.start().0).0; + old_transforms.start().1.0 + (edit.old.start - old_transforms.start().0).0; old_transforms.seek_forward(&edit.old.end, Bias::Right, &()); if old_transforms.item().map_or(false, |t| t.is_fold()) { @@ -535,14 +535,14 @@ impl FoldMap { edit.old.end = old_transforms.start().0; } let old_end = - old_transforms.start().1 .0 + (edit.old.end - old_transforms.start().0).0; + old_transforms.start().1.0 + (edit.old.end - old_transforms.start().0).0; new_transforms.seek(&edit.new.start, Bias::Left, &()); if new_transforms.item().map_or(false, |t| t.is_fold()) { edit.new.start = new_transforms.start().0; } let new_start = - new_transforms.start().1 .0 + (edit.new.start - new_transforms.start().0).0; + new_transforms.start().1.0 + (edit.new.start - new_transforms.start().0).0; new_transforms.seek_forward(&edit.new.end, Bias::Right, &()); if new_transforms.item().map_or(false, |t| t.is_fold()) { @@ -550,7 +550,7 @@ impl FoldMap { edit.new.end = new_transforms.start().0; } let new_end = - new_transforms.start().1 .0 + (edit.new.end - new_transforms.start().0).0; + new_transforms.start().1.0 + (edit.new.end - new_transforms.start().0).0; fold_edits.push(FoldEdit { old: FoldOffset(old_start)..FoldOffset(old_end), @@ -600,8 +600,8 @@ impl FoldSnapshot { let mut cursor = self.transforms.cursor::<(FoldPoint, InlayPoint)>(&()); cursor.seek(&range.start, Bias::Right, &()); if let Some(transform) = cursor.item() { - let start_in_transform = range.start.0 - cursor.start().0 .0; - let end_in_transform = cmp::min(range.end, cursor.end(&()).0).0 - cursor.start().0 .0; + let start_in_transform = range.start.0 - cursor.start().0.0; + let end_in_transform = cmp::min(range.end, cursor.end(&()).0).0 - cursor.start().0.0; if let Some(placeholder) = transform.placeholder.as_ref() { summary = TextSummary::from( &placeholder.text @@ -610,10 +610,10 @@ impl FoldSnapshot { } else { let inlay_start = self .inlay_snapshot - .to_offset(InlayPoint(cursor.start().1 .0 + start_in_transform)); + .to_offset(InlayPoint(cursor.start().1.0 + start_in_transform)); let inlay_end = self .inlay_snapshot - .to_offset(InlayPoint(cursor.start().1 .0 + end_in_transform)); + .to_offset(InlayPoint(cursor.start().1.0 + end_in_transform)); summary = self .inlay_snapshot .text_summary_for_range(inlay_start..inlay_end); @@ -626,7 +626,7 @@ impl FoldSnapshot { .summary::<_, TransformSummary>(&range.end, Bias::Right, &()) .output; if let Some(transform) = cursor.item() { - let end_in_transform = range.end.0 - cursor.start().0 .0; + let end_in_transform = range.end.0 - cursor.start().0.0; if let Some(placeholder) = transform.placeholder.as_ref() { summary += TextSummary::from(&placeholder.text[..end_in_transform.column as usize]); @@ -634,7 +634,7 @@ impl FoldSnapshot { let inlay_start = self.inlay_snapshot.to_offset(cursor.start().1); let inlay_end = self .inlay_snapshot - .to_offset(InlayPoint(cursor.start().1 .0 + end_in_transform)); + .to_offset(InlayPoint(cursor.start().1.0 + end_in_transform)); summary += self .inlay_snapshot .text_summary_for_range(inlay_start..inlay_end); @@ -655,10 +655,10 @@ impl FoldSnapshot { cursor.end(&()).1 } } else { - let overshoot = point.0 - cursor.start().0 .0; + let overshoot = point.0 - cursor.start().0.0; FoldPoint(cmp::min( - cursor.start().1 .0 + overshoot, - cursor.end(&()).1 .0, + cursor.start().1.0 + overshoot, + cursor.end(&()).1.0, )) } } @@ -686,8 +686,8 @@ impl FoldSnapshot { let mut cursor = self.transforms.cursor::<(FoldPoint, InlayPoint)>(&()); cursor.seek(&fold_point, Bias::Left, &()); - let overshoot = fold_point.0 - cursor.start().0 .0; - let inlay_point = InlayPoint(cursor.start().1 .0 + overshoot); + let overshoot = fold_point.0 - cursor.start().0.0; + let inlay_point = InlayPoint(cursor.start().1.0 + overshoot); let input_rows = self.inlay_snapshot.row_infos(inlay_point.row()); FoldRows { @@ -769,7 +769,7 @@ impl FoldSnapshot { transform_cursor.seek(&range.start, Bias::Right, &()); let inlay_start = { - let overshoot = range.start.0 - transform_cursor.start().0 .0; + let overshoot = range.start.0 - transform_cursor.start().0.0; transform_cursor.start().1 + InlayOffset(overshoot) }; @@ -781,7 +781,7 @@ impl FoldSnapshot { { inlay_start } else if range.end < transform_end.0 { - let overshoot = range.end.0 - transform_cursor.start().0 .0; + let overshoot = range.end.0 - transform_cursor.start().0.0; transform_cursor.start().1 + InlayOffset(overshoot) } else { transform_end.1 @@ -823,18 +823,18 @@ impl FoldSnapshot { let mut cursor = self.transforms.cursor::<(FoldPoint, InlayPoint)>(&()); cursor.seek(&point, Bias::Right, &()); if let Some(transform) = cursor.item() { - let transform_start = cursor.start().0 .0; + let transform_start = cursor.start().0.0; if transform.placeholder.is_some() { if point.0 == transform_start || matches!(bias, Bias::Left) { FoldPoint(transform_start) } else { - FoldPoint(cursor.end(&()).0 .0) + FoldPoint(cursor.end(&()).0.0) } } else { let overshoot = InlayPoint(point.0 - transform_start); let inlay_point = cursor.start().1 + overshoot; let clipped_inlay_point = self.inlay_snapshot.clip_point(inlay_point, bias); - FoldPoint(cursor.start().0 .0 + (clipped_inlay_point - cursor.start().1).0) + FoldPoint(cursor.start().0.0 + (clipped_inlay_point - cursor.start().1).0) } } else { FoldPoint(self.transforms.summary().output.lines) @@ -1148,8 +1148,8 @@ impl FoldRows<'_> { pub(crate) fn seek(&mut self, row: u32) { let fold_point = FoldPoint::new(row, 0); self.cursor.seek(&fold_point, Bias::Left, &()); - let overshoot = fold_point.0 - self.cursor.start().0 .0; - let inlay_point = InlayPoint(self.cursor.start().1 .0 + overshoot); + let overshoot = fold_point.0 - self.cursor.start().0.0; + let inlay_point = InlayPoint(self.cursor.start().1.0 + overshoot); self.input_rows.seek(inlay_point.row()); self.fold_point = fold_point; } @@ -1170,7 +1170,7 @@ impl Iterator for FoldRows<'_> { if self.cursor.item().is_some() { if traversed_fold { - self.input_rows.seek(self.cursor.start().1 .0.row); + self.input_rows.seek(self.cursor.start().1.0.row); self.input_rows.next(); } *self.fold_point.row_mut() += 1; @@ -1195,7 +1195,7 @@ impl FoldChunks<'_> { self.transform_cursor.seek(&range.start, Bias::Right, &()); let inlay_start = { - let overshoot = range.start.0 - self.transform_cursor.start().0 .0; + let overshoot = range.start.0 - self.transform_cursor.start().0.0; self.transform_cursor.start().1 + InlayOffset(overshoot) }; @@ -1208,7 +1208,7 @@ impl FoldChunks<'_> { { inlay_start } else if range.end < transform_end.0 { - let overshoot = range.end.0 - self.transform_cursor.start().0 .0; + let overshoot = range.end.0 - self.transform_cursor.start().0.0; self.transform_cursor.start().1 + InlayOffset(overshoot) } else { transform_end.1 @@ -1260,7 +1260,7 @@ impl<'a> Iterator for FoldChunks<'a> { let transform_start = self.transform_cursor.start(); let transform_end = self.transform_cursor.end(&()); let inlay_end = if self.max_output_offset < transform_end.0 { - let overshoot = self.max_output_offset.0 - transform_start.0 .0; + let overshoot = self.max_output_offset.0 - transform_start.0.0; transform_start.1 + InlayOffset(overshoot) } else { transform_end.1 @@ -1309,9 +1309,9 @@ impl FoldOffset { .cursor::<(FoldOffset, TransformSummary)>(&()); cursor.seek(&self, Bias::Right, &()); let overshoot = if cursor.item().map_or(true, |t| t.is_fold()) { - Point::new(0, (self.0 - cursor.start().0 .0) as u32) + Point::new(0, (self.0 - cursor.start().0.0) as u32) } else { - let inlay_offset = cursor.start().1.input.len + self.0 - cursor.start().0 .0; + let inlay_offset = cursor.start().1.input.len + self.0 - cursor.start().0.0; let inlay_point = snapshot.inlay_snapshot.to_point(InlayOffset(inlay_offset)); inlay_point.0 - cursor.start().1.input.lines }; @@ -1322,8 +1322,8 @@ impl FoldOffset { pub fn to_inlay_offset(self, snapshot: &FoldSnapshot) -> InlayOffset { let mut cursor = snapshot.transforms.cursor::<(FoldOffset, InlayOffset)>(&()); cursor.seek(&self, Bias::Right, &()); - let overshoot = self.0 - cursor.start().0 .0; - InlayOffset(cursor.start().1 .0 + overshoot) + let overshoot = self.0 - cursor.start().0.0; + InlayOffset(cursor.start().1.0 + overshoot) } } @@ -1384,15 +1384,15 @@ pub type FoldEdit = Edit; #[cfg(test)] mod tests { use super::*; - use crate::{display_map::inlay_map::InlayMap, MultiBuffer, ToPoint}; + use crate::{MultiBuffer, ToPoint, display_map::inlay_map::InlayMap}; + use Bias::{Left, Right}; use collections::HashSet; use rand::prelude::*; use settings::SettingsStore; use std::{env, mem}; use text::Patch; - use util::test::sample_text; use util::RandomCharIter; - use Bias::{Left, Right}; + use util::test::sample_text; #[gpui::test] fn test_basic_folds(cx: &mut gpui::App) { diff --git a/crates/editor/src/display_map/inlay_map.rs b/crates/editor/src/display_map/inlay_map.rs index 899f8741f1..925b7a6d4b 100644 --- a/crates/editor/src/display_map/inlay_map.rs +++ b/crates/editor/src/display_map/inlay_map.rs @@ -11,7 +11,7 @@ use std::{ use sum_tree::{Bias, Cursor, SumTree}; use text::{Patch, Rope}; -use super::{custom_highlights::CustomHighlightsChunks, Highlights}; +use super::{Highlights, custom_highlights::CustomHighlightsChunks}; /// Decides where the [`Inlay`]s should be displayed. /// @@ -254,7 +254,7 @@ impl<'a> Iterator for InlayChunks<'a> { chunk .text .len() - .min(self.transforms.end(&()).0 .0 - self.output_offset.0), + .min(self.transforms.end(&()).0.0 - self.output_offset.0), ); chunk.text = suffix; @@ -352,7 +352,7 @@ impl InlayBufferRows<'_> { } else { match self.transforms.item() { Some(Transform::Isomorphic(_)) => { - buffer_point += inlay_point.0 - self.transforms.start().0 .0; + buffer_point += inlay_point.0 - self.transforms.start().0.0; buffer_point.row } _ => cmp::min(buffer_point.row + 1, self.max_buffer_row.0), @@ -664,18 +664,18 @@ impl InlaySnapshot { .transforms .cursor::<(InlayOffset, (InlayPoint, usize))>(&()); cursor.seek(&offset, Bias::Right, &()); - let overshoot = offset.0 - cursor.start().0 .0; + let overshoot = offset.0 - cursor.start().0.0; match cursor.item() { Some(Transform::Isomorphic(_)) => { - let buffer_offset_start = cursor.start().1 .1; + let buffer_offset_start = cursor.start().1.1; let buffer_offset_end = buffer_offset_start + overshoot; let buffer_start = self.buffer.offset_to_point(buffer_offset_start); let buffer_end = self.buffer.offset_to_point(buffer_offset_end); - InlayPoint(cursor.start().1 .0 .0 + (buffer_end - buffer_start)) + InlayPoint(cursor.start().1.0.0 + (buffer_end - buffer_start)) } Some(Transform::Inlay(inlay)) => { let overshoot = inlay.text.offset_to_point(overshoot); - InlayPoint(cursor.start().1 .0 .0 + overshoot) + InlayPoint(cursor.start().1.0.0 + overshoot) } None => self.max_point(), } @@ -694,18 +694,18 @@ impl InlaySnapshot { .transforms .cursor::<(InlayPoint, (InlayOffset, Point))>(&()); cursor.seek(&point, Bias::Right, &()); - let overshoot = point.0 - cursor.start().0 .0; + let overshoot = point.0 - cursor.start().0.0; match cursor.item() { Some(Transform::Isomorphic(_)) => { - let buffer_point_start = cursor.start().1 .1; + let buffer_point_start = cursor.start().1.1; let buffer_point_end = buffer_point_start + overshoot; let buffer_offset_start = self.buffer.point_to_offset(buffer_point_start); let buffer_offset_end = self.buffer.point_to_offset(buffer_point_end); - InlayOffset(cursor.start().1 .0 .0 + (buffer_offset_end - buffer_offset_start)) + InlayOffset(cursor.start().1.0.0 + (buffer_offset_end - buffer_offset_start)) } Some(Transform::Inlay(inlay)) => { let overshoot = inlay.text.point_to_offset(overshoot); - InlayOffset(cursor.start().1 .0 .0 + overshoot) + InlayOffset(cursor.start().1.0.0 + overshoot) } None => self.len(), } @@ -715,7 +715,7 @@ impl InlaySnapshot { cursor.seek(&point, Bias::Right, &()); match cursor.item() { Some(Transform::Isomorphic(_)) => { - let overshoot = point.0 - cursor.start().0 .0; + let overshoot = point.0 - cursor.start().0.0; cursor.start().1 + overshoot } Some(Transform::Inlay(_)) => cursor.start().1, @@ -752,7 +752,7 @@ impl InlaySnapshot { return cursor.end(&()).1; } else { let overshoot = offset - cursor.start().0; - return InlayOffset(cursor.start().1 .0 + overshoot); + return InlayOffset(cursor.start().1.0 + overshoot); } } Some(Transform::Inlay(inlay)) => { @@ -785,7 +785,7 @@ impl InlaySnapshot { return cursor.end(&()).1; } else { let overshoot = point - cursor.start().0; - return InlayPoint(cursor.start().1 .0 + overshoot); + return InlayPoint(cursor.start().1.0 + overshoot); } } Some(Transform::Inlay(inlay)) => { @@ -838,11 +838,11 @@ impl InlaySnapshot { return point; } } else { - let overshoot = point.0 - cursor.start().0 .0; + let overshoot = point.0 - cursor.start().0.0; let buffer_point = cursor.start().1 + overshoot; let clipped_buffer_point = self.buffer.clip_point(buffer_point, bias); let clipped_overshoot = clipped_buffer_point - cursor.start().1; - let clipped_point = InlayPoint(cursor.start().0 .0 + clipped_overshoot); + let clipped_point = InlayPoint(cursor.start().0.0 + clipped_overshoot); if clipped_point == point { return clipped_point; } else { @@ -903,19 +903,19 @@ impl InlaySnapshot { let mut cursor = self.transforms.cursor::<(InlayOffset, usize)>(&()); cursor.seek(&range.start, Bias::Right, &()); - let overshoot = range.start.0 - cursor.start().0 .0; + let overshoot = range.start.0 - cursor.start().0.0; match cursor.item() { Some(Transform::Isomorphic(_)) => { let buffer_start = cursor.start().1; let suffix_start = buffer_start + overshoot; let suffix_end = - buffer_start + (cmp::min(cursor.end(&()).0, range.end).0 - cursor.start().0 .0); + buffer_start + (cmp::min(cursor.end(&()).0, range.end).0 - cursor.start().0.0); summary = self.buffer.text_summary_for_range(suffix_start..suffix_end); cursor.next(&()); } Some(Transform::Inlay(inlay)) => { let suffix_start = overshoot; - let suffix_end = cmp::min(cursor.end(&()).0, range.end).0 - cursor.start().0 .0; + let suffix_end = cmp::min(cursor.end(&()).0, range.end).0 - cursor.start().0.0; summary = inlay.text.cursor(suffix_start).summary(suffix_end); cursor.next(&()); } @@ -927,7 +927,7 @@ impl InlaySnapshot { .summary::<_, TransformSummary>(&range.end, Bias::Right, &()) .output; - let overshoot = range.end.0 - cursor.start().0 .0; + let overshoot = range.end.0 - cursor.start().0.0; match cursor.item() { Some(Transform::Isomorphic(_)) => { let prefix_start = cursor.start().1; @@ -959,7 +959,7 @@ impl InlaySnapshot { } else { match cursor.item() { Some(Transform::Isomorphic(_)) => { - buffer_point += inlay_point.0 - cursor.start().0 .0; + buffer_point += inlay_point.0 - cursor.start().0.0; MultiBufferRow(buffer_point.row) } _ => cmp::min(MultiBufferRow(buffer_point.row + 1), max_buffer_row), @@ -1066,9 +1066,9 @@ fn push_isomorphic(sum_tree: &mut SumTree, summary: TextSummary) { mod tests { use super::*; use crate::{ + InlayId, MultiBuffer, display_map::{InlayHighlights, TextHighlights}, hover_links::InlayHighlight, - InlayId, MultiBuffer, }; use gpui::{App, HighlightStyle}; use project::{InlayHint, InlayHintLabel, ResolveState}; diff --git a/crates/editor/src/display_map/tab_map.rs b/crates/editor/src/display_map/tab_map.rs index e4832ff7f8..ae8697e634 100644 --- a/crates/editor/src/display_map/tab_map.rs +++ b/crates/editor/src/display_map/tab_map.rs @@ -1,6 +1,6 @@ use super::{ - fold_map::{self, FoldChunks, FoldEdit, FoldPoint, FoldSnapshot}, Highlights, + fold_map::{self, FoldChunks, FoldEdit, FoldPoint, FoldSnapshot}, }; use language::{Chunk, Point}; use multi_buffer::MultiBufferSnapshot; @@ -602,10 +602,10 @@ impl<'a> Iterator for TabChunks<'a> { mod tests { use super::*; use crate::{ - display_map::{fold_map::FoldMap, inlay_map::InlayMap}, MultiBuffer, + display_map::{fold_map::FoldMap, inlay_map::InlayMap}, }; - use rand::{prelude::StdRng, Rng}; + use rand::{Rng, prelude::StdRng}; #[gpui::test] fn test_expand_tabs(cx: &mut gpui::App) { diff --git a/crates/editor/src/display_map/wrap_map.rs b/crates/editor/src/display_map/wrap_map.rs index 858275c4a7..342cf83537 100644 --- a/crates/editor/src/display_map/wrap_map.rs +++ b/crates/editor/src/display_map/wrap_map.rs @@ -1,7 +1,7 @@ use super::{ + Highlights, fold_map::FoldRows, tab_map::{self, TabEdit, TabPoint, TabSnapshot}, - Highlights, }; use gpui::{App, AppContext as _, Context, Entity, Font, LineWrapper, Pixels, Task}; use language::{Chunk, Point}; @@ -593,9 +593,9 @@ impl WrapSnapshot { let output_end = WrapPoint::new(rows.end, 0); let mut transforms = self.transforms.cursor::<(WrapPoint, TabPoint)>(&()); transforms.seek(&output_start, Bias::Right, &()); - let mut input_start = TabPoint(transforms.start().1 .0); + let mut input_start = TabPoint(transforms.start().1.0); if transforms.item().map_or(false, |t| t.is_isomorphic()) { - input_start.0 += output_start.0 - transforms.start().0 .0; + input_start.0 += output_start.0 - transforms.start().0.0; } let input_end = self .to_tab_point(output_end) @@ -647,11 +647,11 @@ impl WrapSnapshot { let mut cursor = self.transforms.cursor::<(WrapPoint, TabPoint)>(&()); cursor.seek(&start, Bias::Right, &()); if let Some(transform) = cursor.item() { - let start_in_transform = start.0 - cursor.start().0 .0; - let end_in_transform = cmp::min(end, cursor.end(&()).0).0 - cursor.start().0 .0; + let start_in_transform = start.0 - cursor.start().0.0; + let end_in_transform = cmp::min(end, cursor.end(&()).0).0 - cursor.start().0.0; if transform.is_isomorphic() { - let tab_start = TabPoint(cursor.start().1 .0 + start_in_transform); - let tab_end = TabPoint(cursor.start().1 .0 + end_in_transform); + let tab_start = TabPoint(cursor.start().1.0 + start_in_transform); + let tab_end = TabPoint(cursor.start().1.0 + end_in_transform); summary += &self.tab_snapshot.text_summary_for_range(tab_start..tab_end); } else { debug_assert_eq!(start_in_transform.row, end_in_transform.row); @@ -674,7 +674,7 @@ impl WrapSnapshot { .output; if let Some(transform) = cursor.item() { - let end_in_transform = end.0 - cursor.start().0 .0; + let end_in_transform = end.0 - cursor.start().0.0; if transform.is_isomorphic() { let char_start = cursor.start().1; let char_end = TabPoint(char_start.0 + end_in_transform); @@ -736,9 +736,9 @@ impl WrapSnapshot { pub fn to_tab_point(&self, point: WrapPoint) -> TabPoint { let mut cursor = self.transforms.cursor::<(WrapPoint, TabPoint)>(&()); cursor.seek(&point, Bias::Right, &()); - let mut tab_point = cursor.start().1 .0; + let mut tab_point = cursor.start().1.0; if cursor.item().map_or(false, |t| t.is_isomorphic()) { - tab_point += point.0 - cursor.start().0 .0; + tab_point += point.0 - cursor.start().0.0; } TabPoint(tab_point) } @@ -754,7 +754,7 @@ impl WrapSnapshot { pub fn tab_point_to_wrap_point(&self, point: TabPoint) -> WrapPoint { let mut cursor = self.transforms.cursor::<(TabPoint, WrapPoint)>(&()); cursor.seek(&point, Bias::Right, &()); - WrapPoint(cursor.start().1 .0 + (point.0 - cursor.start().0 .0)) + WrapPoint(cursor.start().1.0 + (point.0 - cursor.start().0.0)) } pub fn clip_point(&self, mut point: WrapPoint, bias: Bias) -> WrapPoint { @@ -877,9 +877,9 @@ impl WrapChunks<'_> { let output_start = WrapPoint::new(rows.start, 0); let output_end = WrapPoint::new(rows.end, 0); self.transforms.seek(&output_start, Bias::Right, &()); - let mut input_start = TabPoint(self.transforms.start().1 .0); + let mut input_start = TabPoint(self.transforms.start().1.0); if self.transforms.item().map_or(false, |t| t.is_isomorphic()) { - input_start.0 += output_start.0 - self.transforms.start().0 .0; + input_start.0 += output_start.0 - self.transforms.start().0.0; } let input_end = self .snapshot @@ -1169,9 +1169,9 @@ fn consolidate_wrap_edits(edits: Vec) -> Vec { mod tests { use super::*; use crate::{ + MultiBuffer, display_map::{fold_map::FoldMap, inlay_map::InlayMap, tab_map::TabMap}, test::test_font, - MultiBuffer, }; use gpui::{px, test::observe}; use rand::prelude::*; diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index e5be44d553..1a1fe6926c 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -51,7 +51,7 @@ pub mod test; pub(crate) use actions::*; pub use actions::{AcceptEditPrediction, OpenExcerpts, OpenExcerptsSplit}; use aho_corasick::AhoCorasick; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use blink_manager::BlinkManager; use buffer_diff::DiffHunkStatus; use client::{Collaborator, ParticipantIndex}; @@ -66,14 +66,14 @@ pub use editor_settings::{ ShowScrollbar, }; pub use editor_settings_controls::*; -use element::{layout_line, AcceptEditPredictionBinding, LineWithInvisibles, PositionMap}; +use element::{AcceptEditPredictionBinding, LineWithInvisibles, PositionMap, layout_line}; pub use element::{ CursorLayout, EditorElement, HighlightedRange, HighlightedRangeLine, PointForPosition, }; use feature_flags::{Debugger, FeatureFlagAppExt}; use futures::{ - future::{self, join, Shared}, FutureExt, + future::{self, Shared, join}, }; use fuzzy::StringMatchCandidate; @@ -84,18 +84,18 @@ use code_context_menus::{ }; use git::blame::GitBlame; use gpui::{ - div, impl_actions, point, prelude::*, pulsating_between, px, relative, size, Action, Animation, - AnimationExt, AnyElement, App, AppContext, AsyncWindowContext, AvailableSpace, Background, - Bounds, ClickEvent, ClipboardEntry, ClipboardItem, Context, DispatchPhase, Edges, Entity, - EntityInputHandler, EventEmitter, FocusHandle, FocusOutEvent, Focusable, FontId, FontWeight, - Global, HighlightStyle, Hsla, KeyContext, Modifiers, MouseButton, MouseDownEvent, PaintQuad, - ParentElement, Pixels, Render, SharedString, Size, Stateful, Styled, StyledText, Subscription, - Task, TextStyle, TextStyleRefinement, UTF16Selection, UnderlineStyle, UniformListScrollHandle, - WeakEntity, WeakFocusHandle, Window, + Action, Animation, AnimationExt, AnyElement, App, AppContext, AsyncWindowContext, + AvailableSpace, Background, Bounds, ClickEvent, ClipboardEntry, ClipboardItem, Context, + DispatchPhase, Edges, Entity, EntityInputHandler, EventEmitter, FocusHandle, FocusOutEvent, + Focusable, FontId, FontWeight, Global, HighlightStyle, Hsla, KeyContext, Modifiers, + MouseButton, MouseDownEvent, PaintQuad, ParentElement, Pixels, Render, SharedString, Size, + Stateful, Styled, StyledText, Subscription, Task, TextStyle, TextStyleRefinement, + UTF16Selection, UnderlineStyle, UniformListScrollHandle, WeakEntity, WeakFocusHandle, Window, + div, impl_actions, point, prelude::*, pulsating_between, px, relative, size, }; use highlight_matching_bracket::refresh_matching_bracket_highlights; -use hover_links::{find_file, HoverLink, HoveredLinkState, InlayHighlight}; -use hover_popover::{hide_hover, HoverState}; +use hover_links::{HoverLink, HoveredLinkState, InlayHighlight, find_file}; +use hover_popover::{HoverState, hide_hover}; use indent_guides::ActiveIndentGuidesState; use inlay_hint_cache::{InlayHintCache, InlaySplice, InvalidationStrategy}; pub use inline_completion::Direction; @@ -103,24 +103,25 @@ use inline_completion::{EditPredictionProvider, InlineCompletionProviderHandle}; pub use items::MAX_TAB_TITLE_LEN; use itertools::Itertools; use language::{ + AutoindentMode, BracketMatch, BracketPair, Buffer, Capability, CharKind, CodeLabel, + CursorShape, Diagnostic, DiffOptions, EditPredictionsMode, EditPreview, HighlightedText, + IndentKind, IndentSize, Language, OffsetRangeExt, Point, Selection, SelectionGoal, TextObject, + TransactionId, TreeSitterOptions, WordsQuery, language_settings::{ - self, all_language_settings, language_settings, InlayHintSettings, RewrapBehavior, - WordsCompletionMode, + self, InlayHintSettings, RewrapBehavior, WordsCompletionMode, all_language_settings, + language_settings, }, - point_from_lsp, text_diff_with_options, AutoindentMode, BracketMatch, BracketPair, Buffer, - Capability, CharKind, CodeLabel, CursorShape, Diagnostic, DiffOptions, EditPredictionsMode, - EditPreview, HighlightedText, IndentKind, IndentSize, Language, OffsetRangeExt, Point, - Selection, SelectionGoal, TextObject, TransactionId, TreeSitterOptions, WordsQuery, + point_from_lsp, text_diff_with_options, }; -use language::{point_to_lsp, BufferRow, CharClassifier, Runnable, RunnableRange}; +use language::{BufferRow, CharClassifier, Runnable, RunnableRange, point_to_lsp}; use linked_editing_ranges::refresh_linked_ranges; use mouse_context_menu::MouseContextMenu; use persistence::DB; use project::{ + ProjectPath, debugger::breakpoint_store::{ BreakpointEditAction, BreakpointState, BreakpointStore, BreakpointStoreEvent, }, - ProjectPath, }; pub use proposed_changes_editor::{ @@ -148,21 +149,21 @@ use multi_buffer::{ }; use parking_lot::Mutex; use project::{ - debugger::breakpoint_store::Breakpoint, - lsp_store::{CompletionDocumentation, FormatTrigger, LspFormatTarget, OpenLspBufferHandle}, - project_settings::{GitGutterSetting, ProjectSettings}, CodeAction, Completion, CompletionIntent, CompletionSource, DocumentHighlight, InlayHint, Location, LocationLink, PrepareRenameResponse, Project, ProjectItem, ProjectTransaction, TaskSourceKind, + debugger::breakpoint_store::Breakpoint, + lsp_store::{CompletionDocumentation, FormatTrigger, LspFormatTarget, OpenLspBufferHandle}, + project_settings::{GitGutterSetting, ProjectSettings}, }; use rand::prelude::*; -use rpc::{proto::*, ErrorExt}; +use rpc::{ErrorExt, proto::*}; use scroll::{Autoscroll, OngoingScroll, ScrollAnchor, ScrollManager, ScrollbarAutoHide}; use selections_collection::{ - resolve_selections, MutableSelectionsCollection, SelectionsCollection, + MutableSelectionsCollection, SelectionsCollection, resolve_selections, }; use serde::{Deserialize, Serialize}; -use settings::{update_settings_file, Settings, SettingsLocation, SettingsStore}; +use settings::{Settings, SettingsLocation, SettingsStore, update_settings_file}; use smallvec::SmallVec; use snippet::Snippet; use std::sync::Arc; @@ -182,21 +183,21 @@ pub use sum_tree::Bias; use sum_tree::TreeMap; use text::{BufferId, OffsetUtf16, Rope}; use theme::{ - observe_buffer_font_size_adjustment, ActiveTheme, PlayerColor, StatusColors, SyntaxTheme, - ThemeColors, ThemeSettings, + ActiveTheme, PlayerColor, StatusColors, SyntaxTheme, ThemeColors, ThemeSettings, + observe_buffer_font_size_adjustment, }; use ui::{ - h_flex, prelude::*, ButtonSize, ButtonStyle, Disclosure, IconButton, IconButtonShape, IconName, - IconSize, Key, Tooltip, + ButtonSize, ButtonStyle, Disclosure, IconButton, IconButtonShape, IconName, IconSize, Key, + Tooltip, h_flex, prelude::*, }; -use util::{maybe, post_inc, RangeExt, ResultExt, TryFutureExt}; +use util::{RangeExt, ResultExt, TryFutureExt, maybe, post_inc}; use workspace::{ + Item as WorkspaceItem, ItemId, ItemNavHistory, OpenInTerminal, OpenTerminal, + RestoreOnStartupBehavior, SERIALIZATION_THROTTLE_TIME, SplitDirection, TabBarSettings, Toast, + ViewId, Workspace, WorkspaceId, WorkspaceSettings, item::{ItemHandle, PreviewTabsSettings}, notifications::{DetachAndPromptErr, NotificationId, NotifyTaskExt}, searchable::SearchEvent, - Item as WorkspaceItem, ItemId, ItemNavHistory, OpenInTerminal, OpenTerminal, - RestoreOnStartupBehavior, SplitDirection, TabBarSettings, Toast, ViewId, Workspace, - WorkspaceId, WorkspaceSettings, SERIALIZATION_THROTTLE_TIME, }; use crate::hover_links::{find_url, find_url_from_range}; @@ -271,11 +272,7 @@ pub enum Navigated { impl Navigated { pub fn from_bool(yes: bool) -> Navigated { - if yes { - Navigated::Yes - } else { - Navigated::No - } + if yes { Navigated::Yes } else { Navigated::No } } } @@ -1969,12 +1966,12 @@ impl Editor { pub fn set_custom_context_menu( &mut self, f: impl 'static - + Fn( - &mut Self, - DisplayPoint, - &mut Window, - &mut Context, - ) -> Option>, + + Fn( + &mut Self, + DisplayPoint, + &mut Window, + &mut Context, + ) -> Option>, ) { self.custom_context_menu = Some(Box::new(f)) } @@ -12474,11 +12471,7 @@ impl Editor { best_in_bracket_range = in_bracket_range; best_destination = Some( if close.contains(&selection.start) && close.contains(&selection.end) { - if inside { - open.end - } else { - open.start - } + if inside { open.end } else { open.start } } else if inside { *close.start() } else { diff --git a/crates/editor/src/editor_settings_controls.rs b/crates/editor/src/editor_settings_controls.rs index 9e22c64393..54bb865520 100644 --- a/crates/editor/src/editor_settings_controls.rs +++ b/crates/editor/src/editor_settings_controls.rs @@ -5,8 +5,8 @@ use project::project_settings::{InlineBlameSettings, ProjectSettings}; use settings::{EditableSettingControl, Settings}; use theme::{FontFamilyCache, ThemeSettings}; use ui::{ - prelude::*, CheckboxWithLabel, ContextMenu, DropdownMenu, NumericStepper, SettingsContainer, - SettingsGroup, + CheckboxWithLabel, ContextMenu, DropdownMenu, NumericStepper, SettingsContainer, SettingsGroup, + prelude::*, }; use crate::EditorSettings; diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index c5199c7003..6dac9e26a4 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -1,30 +1,30 @@ use super::*; use crate::{ + JoinLines, scroll::scroll_amount::ScrollAmount, test::{ assert_text_with_selections, build_editor, - editor_lsp_test_context::{git_commit_lang, EditorLspTestContext}, + editor_lsp_test_context::{EditorLspTestContext, git_commit_lang}, editor_test_context::EditorTestContext, select_ranges, }, - JoinLines, }; use buffer_diff::{BufferDiff, DiffHunkSecondaryStatus, DiffHunkStatus, DiffHunkStatusKind}; use futures::StreamExt; use gpui::{ - div, BackgroundExecutor, SemanticVersion, TestAppContext, UpdateGlobal, VisualTestContext, - WindowBounds, WindowOptions, + BackgroundExecutor, SemanticVersion, TestAppContext, UpdateGlobal, VisualTestContext, + WindowBounds, WindowOptions, div, }; use indoc::indoc; use language::{ - language_settings::{ - AllLanguageSettings, AllLanguageSettingsContent, CompletionSettings, - LanguageSettingsContent, PrettierSettings, - }, BracketPairConfig, Capability::ReadWrite, FakeLspAdapter, LanguageConfig, LanguageConfigOverride, LanguageMatcher, LanguageName, Override, Point, + language_settings::{ + AllLanguageSettings, AllLanguageSettingsContent, CompletionSettings, + LanguageSettingsContent, PrettierSettings, + }, }; use language_settings::{Formatter, FormatterList, IndentGuideSettings}; use lsp::CompletionParams; @@ -32,9 +32,9 @@ use multi_buffer::{IndentGuide, PathKey}; use parking_lot::Mutex; use pretty_assertions::{assert_eq, assert_ne}; use project::{ + FakeFs, debugger::breakpoint_store::{BreakpointState, SourceBreakpoint}, project_settings::{LspSettings, ProjectSettings}, - FakeFs, }; use serde_json::{self, json}; use std::{cell::RefCell, future::Future, rc::Rc, sync::atomic::AtomicBool, time::Instant}; @@ -47,12 +47,12 @@ use text::ToPoint as _; use unindent::Unindent; use util::{ assert_set_eq, path, - test::{marked_text_ranges, marked_text_ranges_by, sample_text, TextRangeMarker}, + test::{TextRangeMarker, marked_text_ranges, marked_text_ranges_by, sample_text}, uri, }; use workspace::{ - item::{FollowEvent, FollowableItem, Item, ItemHandle}, CloseAllItems, CloseInactiveItems, NavigationEntry, ViewId, + item::{FollowEvent, FollowableItem, Item, ItemHandle}, }; #[gpui::test] diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 30e9775b57..ede1df1e1e 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1,6 +1,15 @@ use crate::{ + BlockId, COLUMNAR_SELECTION_MODIFIERS, CURSORS_VISIBLE_FOR, ChunkReplacement, + ContextMenuPlacement, CursorShape, CustomBlockId, DisplayDiffHunk, DisplayPoint, DisplayRow, + DocumentHighlightRead, DocumentHighlightWrite, EditDisplayMode, Editor, EditorMode, + EditorSettings, EditorSnapshot, EditorStyle, FILE_HEADER_HEIGHT, FocusedBlock, + GIT_BLAME_MAX_AUTHOR_CHARS_DISPLAYED, GutterDimensions, HalfPageDown, HalfPageUp, HandleInput, + HoveredCursor, InlayHintRefreshReason, InlineCompletion, JumpData, LineDown, LineHighlight, + LineUp, MAX_LINE_LEN, MIN_LINE_NUMBER_DIGITS, MULTI_BUFFER_EXCERPT_HEADER_HEIGHT, OpenExcerpts, + PageDown, PageUp, Point, RowExt, RowRangeExt, SelectPhase, SelectedTextHighlight, Selection, + SoftWrap, StickyHeaderExcerpt, ToPoint, ToggleFold, code_context_menus::{CodeActionsMenu, MENU_ASIDE_MAX_WIDTH, MENU_ASIDE_MIN_WIDTH, MENU_GAP}, - commit_tooltip::{blame_entry_relative_timestamp, CommitTooltip, ParsedCommitMessage}, + commit_tooltip::{CommitTooltip, ParsedCommitMessage, blame_entry_relative_timestamp}, display_map::{ Block, BlockContext, BlockStyle, DisplaySnapshot, HighlightedChunk, ToDisplayPoint, }, @@ -10,46 +19,37 @@ use crate::{ }, git::blame::GitBlame, hover_popover::{ - self, hover_at, HOVER_POPOVER_GAP, MIN_POPOVER_CHARACTER_WIDTH, MIN_POPOVER_LINE_HEIGHT, + self, HOVER_POPOVER_GAP, MIN_POPOVER_CHARACTER_WIDTH, MIN_POPOVER_LINE_HEIGHT, hover_at, }, inlay_hint_settings, items::BufferSearchHighlights, mouse_context_menu::{self, MenuPosition, MouseContextMenu}, scroll::scroll_amount::ScrollAmount, - BlockId, ChunkReplacement, ContextMenuPlacement, CursorShape, CustomBlockId, DisplayDiffHunk, - DisplayPoint, DisplayRow, DocumentHighlightRead, DocumentHighlightWrite, EditDisplayMode, - Editor, EditorMode, EditorSettings, EditorSnapshot, EditorStyle, FocusedBlock, - GutterDimensions, HalfPageDown, HalfPageUp, HandleInput, HoveredCursor, InlayHintRefreshReason, - InlineCompletion, JumpData, LineDown, LineHighlight, LineUp, OpenExcerpts, PageDown, PageUp, - Point, RowExt, RowRangeExt, SelectPhase, SelectedTextHighlight, Selection, SoftWrap, - StickyHeaderExcerpt, ToPoint, ToggleFold, COLUMNAR_SELECTION_MODIFIERS, CURSORS_VISIBLE_FOR, - FILE_HEADER_HEIGHT, GIT_BLAME_MAX_AUTHOR_CHARS_DISPLAYED, MAX_LINE_LEN, MIN_LINE_NUMBER_DIGITS, - MULTI_BUFFER_EXCERPT_HEADER_HEIGHT, }; use buffer_diff::{DiffHunkStatus, DiffHunkStatusKind}; use client::ParticipantIndex; use collections::{BTreeMap, HashMap, HashSet}; use feature_flags::{Debugger, FeatureFlagAppExt}; use file_icons::FileIcons; -use git::{blame::BlameEntry, status::FileStatus, Oid}; +use git::{Oid, blame::BlameEntry, status::FileStatus}; use gpui::{ - anchored, deferred, div, fill, linear_color_stop, linear_gradient, outline, point, px, quad, - relative, size, solid_background, transparent_black, Action, Along, AnyElement, App, - AvailableSpace, Axis as ScrollbarAxis, BorderStyle, Bounds, ClickEvent, ClipboardItem, - ContentMask, Context, Corner, Corners, CursorStyle, DispatchPhase, Edges, Element, - ElementInputHandler, Entity, Focusable as _, FontId, GlobalElementId, Hitbox, Hsla, - InteractiveElement, IntoElement, Keystroke, Length, ModifiersChangedEvent, MouseButton, + Action, Along, AnyElement, App, AvailableSpace, Axis as ScrollbarAxis, BorderStyle, Bounds, + ClickEvent, ClipboardItem, ContentMask, Context, Corner, Corners, CursorStyle, DispatchPhase, + Edges, Element, ElementInputHandler, Entity, Focusable as _, FontId, GlobalElementId, Hitbox, + Hsla, InteractiveElement, IntoElement, Keystroke, Length, ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, PaintQuad, ParentElement, Pixels, ScrollDelta, ScrollWheelEvent, ShapedLine, SharedString, Size, StatefulInteractiveElement, Style, Styled, - Subscription, TextRun, TextStyleRefinement, Window, + Subscription, TextRun, TextStyleRefinement, Window, anchored, deferred, div, fill, + linear_color_stop, linear_gradient, outline, point, px, quad, relative, size, solid_background, + transparent_black, }; use itertools::Itertools; use language::{ + ChunkRendererContext, language_settings::{ IndentGuideBackgroundColoring, IndentGuideColoring, IndentGuideSettings, ShowWhitespaceSetting, }, - ChunkRendererContext, }; use lsp::DiagnosticSeverity; use multi_buffer::{ @@ -61,7 +61,7 @@ use project::{ project_settings::{self, GitGutterSetting, GitHunkStyleSetting, ProjectSettings}, }; use settings::Settings; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use std::{ any::TypeId, borrow::Cow, @@ -76,9 +76,9 @@ use std::{ use sum_tree::Bias; use text::BufferId; use theme::{ActiveTheme, Appearance, BufferLineHeight, PlayerColor}; -use ui::{h_flex, prelude::*, ButtonLike, ContextMenu, KeyBinding, Tooltip, POPOVER_Y_PADDING}; +use ui::{ButtonLike, ContextMenu, KeyBinding, POPOVER_Y_PADDING, Tooltip, h_flex, prelude::*}; use unicode_segmentation::UnicodeSegmentation; -use util::{debug_panic, RangeExt, ResultExt}; +use util::{RangeExt, ResultExt, debug_panic}; use workspace::{item::Item, notifications::NotifyTaskExt}; const INLINE_BLAME_PADDING_EM_WIDTHS: f32 = 7.; @@ -8490,9 +8490,9 @@ fn compute_auto_height_layout( mod tests { use super::*; use crate::{ + Editor, MultiBuffer, display_map::{BlockPlacement, BlockProperties}, editor_tests::{init_test, update_test_language_settings}, - Editor, MultiBuffer, }; use gpui::{TestAppContext, VisualTestContext}; use language::language_settings; diff --git a/crates/editor/src/git/blame.rs b/crates/editor/src/git/blame.rs index 6a87cdec71..7b1b1692bd 100644 --- a/crates/editor/src/git/blame.rs +++ b/crates/editor/src/git/blame.rs @@ -1,8 +1,9 @@ use anyhow::Result; use collections::HashMap; use git::{ + GitHostingProvider, GitHostingProviderRegistry, Oid, blame::{Blame, BlameEntry}, - parse_git_remote_url, GitHostingProvider, GitHostingProviderRegistry, Oid, + parse_git_remote_url, }; use gpui::{App, AppContext as _, Context, Entity, Subscription, Task}; use http_client::HttpClient; @@ -529,7 +530,7 @@ mod tests { use std::{cmp, env, ops::Range, path::Path}; use text::BufferId; use unindent::Unindent as _; - use util::{path, RandomCharIter}; + use util::{RandomCharIter, path}; // macro_rules! assert_blame_rows { // ($blame:expr, $rows:expr, $expected:expr, $cx:expr) => { diff --git a/crates/editor/src/hover_links.rs b/crates/editor/src/hover_links.rs index 004c7863b8..fbab3fd8ff 100644 --- a/crates/editor/src/hover_links.rs +++ b/crates/editor/src/hover_links.rs @@ -1,11 +1,11 @@ use crate::{ + Anchor, Editor, EditorSettings, EditorSnapshot, FindAllReferences, GoToDefinition, + GoToTypeDefinition, GotoDefinitionKind, InlayId, Navigated, PointForPosition, SelectPhase, editor_settings::{GoToDefinitionFallback, MultiCursorModifier}, hover_popover::{self, InlayHover}, scroll::ScrollAmount, - Anchor, Editor, EditorSettings, EditorSnapshot, FindAllReferences, GoToDefinition, - GoToTypeDefinition, GotoDefinitionKind, InlayId, Navigated, PointForPosition, SelectPhase, }; -use gpui::{px, App, AsyncWindowContext, Context, Entity, Modifiers, Task, Window}; +use gpui::{App, AsyncWindowContext, Context, Entity, Modifiers, Task, Window, px}; use language::{Bias, ToOffset}; use linkify::{LinkFinder, LinkKind}; use lsp::LanguageServerId; @@ -16,7 +16,7 @@ use project::{ use settings::Settings; use std::ops::Range; use theme::ActiveTheme as _; -use util::{maybe, ResultExt, TryFutureExt as _}; +use util::{ResultExt, TryFutureExt as _, maybe}; #[derive(Debug)] pub struct HoveredLinkState { @@ -920,11 +920,11 @@ fn surrounding_filename( mod tests { use super::*; use crate::{ + DisplayPoint, display_map::ToDisplayPoint, editor_tests::init_test, inlay_hint_cache::tests::{cached_hint_labels, visible_hint_labels}, test::editor_lsp_test_context::EditorLspTestContext, - DisplayPoint, }; use futures::StreamExt; use gpui::Modifiers; @@ -1633,12 +1633,14 @@ mod tests { cx.simulate_mouse_move(screen_coord, None, Modifiers::secondary_key()); // No highlight cx.update_editor(|editor, window, cx| { - assert!(editor - .snapshot(window, cx) - .text_highlight_ranges::() - .unwrap_or_default() - .1 - .is_empty()); + assert!( + editor + .snapshot(window, cx) + .text_highlight_ranges::() + .unwrap_or_default() + .1 + .is_empty() + ); }); // Moving the mouse over a file that does exist should highlight it. @@ -1838,12 +1840,14 @@ mod tests { // No highlight cx.update_editor(|editor, window, cx| { - assert!(editor - .snapshot(window, cx) - .text_highlight_ranges::() - .unwrap_or_default() - .1 - .is_empty()); + assert!( + editor + .snapshot(window, cx) + .text_highlight_ranges::() + .unwrap_or_default() + .1 + .is_empty() + ); }); // Does not open the directory diff --git a/crates/editor/src/hover_popover.rs b/crates/editor/src/hover_popover.rs index e15b0681e7..1d322118b6 100644 --- a/crates/editor/src/hover_popover.rs +++ b/crates/editor/src/hover_popover.rs @@ -1,15 +1,15 @@ use crate::{ - display_map::{invisibles::is_invisible, InlayOffset, ToDisplayPoint}, - hover_links::{InlayHighlight, RangeInEditor}, - scroll::{Autoscroll, ScrollAmount}, Anchor, AnchorRangeExt, DisplayPoint, DisplayRow, Editor, EditorSettings, EditorSnapshot, Hover, + display_map::{InlayOffset, ToDisplayPoint, invisibles::is_invisible}, + hover_links::{InlayHighlight, RangeInEditor}, + scroll::{Autoscroll, ScrollAmount}, }; use gpui::{ - div, px, AnyElement, AsyncWindowContext, Context, Entity, Focusable as _, FontWeight, Hsla, + AnyElement, AsyncWindowContext, Context, Entity, Focusable as _, FontWeight, Hsla, InteractiveElement, IntoElement, MouseButton, ParentElement, Pixels, ScrollHandle, Size, Stateful, StatefulInteractiveElement, StyleRefinement, Styled, Task, TextStyleRefinement, - Window, + Window, div, px, }; use itertools::Itertools; use language::{DiagnosticEntry, Language, LanguageRegistry}; @@ -22,7 +22,7 @@ use std::{borrow::Cow, cell::RefCell}; use std::{ops::Range, sync::Arc, time::Duration}; use std::{path::PathBuf, rc::Rc}; use theme::ThemeSettings; -use ui::{prelude::*, theme_is_transparent, Scrollbar, ScrollbarState}; +use ui::{Scrollbar, ScrollbarState, prelude::*, theme_is_transparent}; use url::Url; use util::TryFutureExt; use workspace::{OpenOptions, OpenVisible, Workspace}; @@ -918,17 +918,17 @@ impl DiagnosticPopover { mod tests { use super::*; use crate::{ + InlayId, PointForPosition, actions::ConfirmCompletion, editor_tests::{handle_completion_request, init_test}, hover_links::update_inlay_link_and_hover_points, inlay_hint_cache::tests::{cached_hint_labels, visible_hint_labels}, test::editor_lsp_test_context::EditorLspTestContext, - InlayId, PointForPosition, }; use collections::BTreeSet; use gpui::App; use indoc::indoc; - use language::{language_settings::InlayHintSettings, Diagnostic, DiagnosticSet}; + use language::{Diagnostic, DiagnosticSet, language_settings::InlayHintSettings}; use lsp::LanguageServerId; use markdown::parser::MarkdownEvent; use smol::stream::StreamExt; diff --git a/crates/editor/src/inlay_hint_cache.rs b/crates/editor/src/inlay_hint_cache.rs index 750e5c682f..d0a3133591 100644 --- a/crates/editor/src/inlay_hint_cache.rs +++ b/crates/editor/src/inlay_hint_cache.rs @@ -14,22 +14,22 @@ use std::{ }; use crate::{ - display_map::Inlay, Anchor, Editor, ExcerptId, InlayId, MultiBuffer, MultiBufferSnapshot, + Anchor, Editor, ExcerptId, InlayId, MultiBuffer, MultiBufferSnapshot, display_map::Inlay, }; use anyhow::Context as _; use clock::Global; use futures::future; use gpui::{AppContext as _, AsyncApp, Context, Entity, Task, Window}; -use language::{language_settings::InlayHintKind, Buffer, BufferSnapshot}; +use language::{Buffer, BufferSnapshot, language_settings::InlayHintKind}; use parking_lot::RwLock; use project::{InlayHint, ResolveState}; -use collections::{hash_map, HashMap, HashSet}; +use collections::{HashMap, HashSet, hash_map}; use language::language_settings::InlayHintSettings; use smol::lock::Semaphore; use sum_tree::Bias; use text::{BufferId, ToOffset, ToPoint}; -use util::{post_inc, ResultExt}; +use util::{ResultExt, post_inc}; pub struct InlayHintCache { hints: HashMap>>, @@ -1292,11 +1292,11 @@ fn apply_hint_update( pub mod tests { use crate::editor_tests::update_test_language_settings; use crate::scroll::ScrollAmount; - use crate::{scroll::Autoscroll, test::editor_lsp_test_context::rust_lang, ExcerptRange}; + use crate::{ExcerptRange, scroll::Autoscroll, test::editor_lsp_test_context::rust_lang}; use futures::StreamExt; use gpui::{AppContext as _, Context, SemanticVersion, TestAppContext, WindowHandle}; use itertools::Itertools as _; - use language::{language_settings::AllLanguageSettingsContent, Capability, FakeLspAdapter}; + use language::{Capability, FakeLspAdapter, language_settings::AllLanguageSettingsContent}; use language::{Language, LanguageConfig, LanguageMatcher}; use lsp::FakeLanguageServer; use parking_lot::Mutex; diff --git a/crates/editor/src/inline_completion_tests.rs b/crates/editor/src/inline_completion_tests.rs index 10736adda6..05d15302d1 100644 --- a/crates/editor/src/inline_completion_tests.rs +++ b/crates/editor/src/inline_completion_tests.rs @@ -1,4 +1,4 @@ -use gpui::{prelude::*, Entity}; +use gpui::{Entity, prelude::*}; use indoc::indoc; use inline_completion::EditPredictionProvider; use multi_buffer::{Anchor, MultiBufferSnapshot, ToPoint}; @@ -7,7 +7,7 @@ use std::ops::Range; use text::{Point, ToOffset}; use crate::{ - editor_tests::init_test, test::editor_test_context::EditorTestContext, InlineCompletion, + InlineCompletion, editor_tests::init_test, test::editor_test_context::EditorTestContext, }; #[gpui::test] diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index b89b0df975..bc70a6db92 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -1,30 +1,30 @@ use crate::{ - editor_settings::SeedQuerySetting, - persistence::{SerializedEditor, DB}, - scroll::ScrollAnchor, Anchor, Autoscroll, Editor, EditorEvent, EditorSettings, ExcerptId, ExcerptRange, FormatTarget, MultiBuffer, MultiBufferSnapshot, NavigationData, SearchWithinRange, ToPoint as _, + editor_settings::SeedQuerySetting, + persistence::{DB, SerializedEditor}, + scroll::ScrollAnchor, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use clock::Global; use collections::{HashMap, HashSet}; use file_icons::FileIcons; use futures::future::try_join_all; use git::status::GitSummary; use gpui::{ - point, AnyElement, App, AsyncWindowContext, Context, Entity, EntityId, EventEmitter, - IntoElement, ParentElement, Pixels, SharedString, Styled, Task, WeakEntity, Window, + AnyElement, App, AsyncWindowContext, Context, Entity, EntityId, EventEmitter, IntoElement, + ParentElement, Pixels, SharedString, Styled, Task, WeakEntity, Window, point, }; use language::{ - proto::serialize_anchor as serialize_text_anchor, Bias, Buffer, CharKind, DiskState, Point, - SelectionGoal, + Bias, Buffer, CharKind, DiskState, Point, SelectionGoal, + proto::serialize_anchor as serialize_text_anchor, }; use lsp::DiagnosticSeverity; use project::{ - lsp_store::FormatTrigger, project_settings::ProjectSettings, search::SearchQuery, Project, - ProjectEntryId, ProjectItem as _, ProjectPath, + Project, ProjectEntryId, ProjectItem as _, ProjectPath, lsp_store::FormatTrigger, + project_settings::ProjectSettings, search::SearchQuery, }; -use rpc::proto::{self, update_view, PeerId}; +use rpc::proto::{self, PeerId, update_view}; use settings::Settings; use std::{ any::TypeId, @@ -38,21 +38,21 @@ use std::{ }; use text::{BufferId, Selection}; use theme::{Theme, ThemeSettings}; -use ui::{prelude::*, IconDecorationKind}; -use util::{paths::PathExt, ResultExt, TryFutureExt}; -use workspace::{ - item::{BreadcrumbText, FollowEvent, ProjectItemKind}, - searchable::SearchOptions, - OpenVisible, Pane, WorkspaceSettings, -}; -use workspace::{ - item::{Dedup, ItemSettings, SerializableItem, TabContentParams}, - OpenOptions, -}; +use ui::{IconDecorationKind, prelude::*}; +use util::{ResultExt, TryFutureExt, paths::PathExt}; use workspace::{ + ItemId, ItemNavHistory, ToolbarItemLocation, ViewId, Workspace, WorkspaceId, item::{FollowableItem, Item, ItemEvent, ProjectItem}, searchable::{Direction, SearchEvent, SearchableItem, SearchableItemHandle}, - ItemId, ItemNavHistory, ToolbarItemLocation, ViewId, Workspace, WorkspaceId, +}; +use workspace::{ + OpenOptions, + item::{Dedup, ItemSettings, SerializableItem, TabContentParams}, +}; +use workspace::{ + OpenVisible, Pane, WorkspaceSettings, + item::{BreadcrumbText, FollowEvent, ProjectItemKind}, + searchable::SearchOptions, }; pub const MAX_TAB_TITLE_LEN: usize = 24; diff --git a/crates/editor/src/jsx_tag_auto_close.rs b/crates/editor/src/jsx_tag_auto_close.rs index 9e932b5b89..3278d5dc7e 100644 --- a/crates/editor/src/jsx_tag_auto_close.rs +++ b/crates/editor/src/jsx_tag_auto_close.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::HashMap; use gpui::{Context, Entity, Window}; use multi_buffer::{MultiBuffer, ToOffset}; diff --git a/crates/editor/src/mouse_context_menu.rs b/crates/editor/src/mouse_context_menu.rs index 3148e03084..3c282d8253 100644 --- a/crates/editor/src/mouse_context_menu.rs +++ b/crates/editor/src/mouse_context_menu.rs @@ -1,10 +1,10 @@ -use crate::actions::FormatSelections; use crate::CopyAndTrim; +use crate::actions::FormatSelections; use crate::{ - actions::Format, selections_collection::SelectionsCollection, Copy, CopyPermalinkToLine, Cut, - DisplayPoint, DisplaySnapshot, Editor, EditorMode, FindAllReferences, GoToDeclaration, - GoToDefinition, GoToImplementation, GoToTypeDefinition, Paste, Rename, RevealInFileManager, - SelectMode, ToDisplayPoint, ToggleCodeActions, + Copy, CopyPermalinkToLine, Cut, DisplayPoint, DisplaySnapshot, Editor, EditorMode, + FindAllReferences, GoToDeclaration, GoToDefinition, GoToImplementation, GoToTypeDefinition, + Paste, Rename, RevealInFileManager, SelectMode, ToDisplayPoint, ToggleCodeActions, + actions::Format, selections_collection::SelectionsCollection, }; use gpui::prelude::FluentBuilder; use gpui::{Context, DismissEvent, Entity, Focusable as _, Pixels, Point, Subscription, Window}; diff --git a/crates/editor/src/movement.rs b/crates/editor/src/movement.rs index d5feb27718..bcb42350f7 100644 --- a/crates/editor/src/movement.rs +++ b/crates/editor/src/movement.rs @@ -2,7 +2,7 @@ //! in editor given a given motion (e.g. it handles converting a "move left" command into coordinates in editor). It is exposed mostly for use by vim crate. use super::{Bias, DisplayPoint, DisplaySnapshot, SelectionGoal, ToDisplayPoint}; -use crate::{scroll::ScrollAnchor, CharKind, DisplayRow, EditorStyle, ToOffset, ToPoint}; +use crate::{CharKind, DisplayRow, EditorStyle, ToOffset, ToPoint, scroll::ScrollAnchor}; use gpui::{Pixels, WindowTextSystem}; use language::Point; use multi_buffer::{MultiBufferRow, MultiBufferSnapshot}; @@ -766,11 +766,11 @@ pub fn split_display_range_by_lines( mod tests { use super::*; use crate::{ + Buffer, DisplayMap, DisplayRow, ExcerptRange, FoldPlaceholder, InlayId, MultiBuffer, display_map::Inlay, test::{editor_test_context::EditorTestContext, marked_display_snapshot}, - Buffer, DisplayMap, DisplayRow, ExcerptRange, FoldPlaceholder, InlayId, MultiBuffer, }; - use gpui::{font, px, AppContext as _}; + use gpui::{AppContext as _, font, px}; use language::Capability; use project::Project; use settings::SettingsStore; diff --git a/crates/editor/src/proposed_changes_editor.rs b/crates/editor/src/proposed_changes_editor.rs index bb6ac55bdf..1ce61805ac 100644 --- a/crates/editor/src/proposed_changes_editor.rs +++ b/crates/editor/src/proposed_changes_editor.rs @@ -9,10 +9,10 @@ use project::Project; use smol::stream::StreamExt; use std::{any::TypeId, ops::Range, rc::Rc, time::Duration}; use text::ToOffset; -use ui::{prelude::*, ButtonLike, KeyBinding}; +use ui::{ButtonLike, KeyBinding, prelude::*}; use workspace::{ - searchable::SearchableItemHandle, Item, ItemHandle as _, ToolbarItemEvent, ToolbarItemLocation, - ToolbarItemView, Workspace, + Item, ItemHandle as _, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, + searchable::SearchableItemHandle, }; pub struct ProposedChangesEditor { diff --git a/crates/editor/src/rust_analyzer_ext.rs b/crates/editor/src/rust_analyzer_ext.rs index 86483051cf..412a59b840 100644 --- a/crates/editor/src/rust_analyzer_ext.rs +++ b/crates/editor/src/rust_analyzer_ext.rs @@ -2,7 +2,7 @@ use std::{fs, path::Path}; use anyhow::Context as _; use gpui::{App, AppContext as _, Context, Entity, Window}; -use language::{proto::serialize_anchor, Capability, Language}; +use language::{Capability, Language, proto::serialize_anchor}; use multi_buffer::MultiBuffer; use project::lsp_store::{ lsp_ext_command::{DocsUrls, ExpandMacro, ExpandedMacro}, @@ -12,8 +12,8 @@ use rpc::proto; use text::ToPointUtf16; use crate::{ - element::register_action, lsp_ext::find_specific_language_server_in_selection, Editor, - ExpandMacroRecursively, OpenDocs, + Editor, ExpandMacroRecursively, OpenDocs, element::register_action, + lsp_ext::find_specific_language_server_in_selection, }; fn is_rust_language(language: &Language) -> bool { diff --git a/crates/editor/src/scroll.rs b/crates/editor/src/scroll.rs index 81c1e1a665..a7c209bdff 100644 --- a/crates/editor/src/scroll.rs +++ b/crates/editor/src/scroll.rs @@ -4,15 +4,15 @@ pub(crate) mod scroll_amount; use crate::editor_settings::ScrollBeyondLastLine; use crate::{ + Anchor, DisplayPoint, DisplayRow, Editor, EditorEvent, EditorMode, EditorSettings, + InlayHintRefreshReason, MultiBufferSnapshot, RowExt, ToPoint, display_map::{DisplaySnapshot, ToDisplayPoint}, hover_popover::hide_hover, persistence::DB, - Anchor, DisplayPoint, DisplayRow, Editor, EditorEvent, EditorMode, EditorSettings, - InlayHintRefreshReason, MultiBufferSnapshot, RowExt, ToPoint, }; pub use autoscroll::{Autoscroll, AutoscrollStrategy}; use core::fmt::Debug; -use gpui::{point, px, App, Axis, Context, Global, Pixels, Task, Window}; +use gpui::{App, Axis, Context, Global, Pixels, Task, Window, point, px}; use language::{Bias, Point}; pub use scroll_amount::ScrollAmount; use settings::Settings; diff --git a/crates/editor/src/scroll/actions.rs b/crates/editor/src/scroll/actions.rs index 652670dd50..72827b2fee 100644 --- a/crates/editor/src/scroll/actions.rs +++ b/crates/editor/src/scroll/actions.rs @@ -1,8 +1,8 @@ use super::Axis; use crate::{ - display_map::DisplayRow, Autoscroll, Editor, EditorMode, NextScreen, - NextScrollCursorCenterTopBottom, ScrollCursorBottom, ScrollCursorCenter, - ScrollCursorCenterTopBottom, ScrollCursorTop, SCROLL_CENTER_TOP_BOTTOM_DEBOUNCE_TIMEOUT, + Autoscroll, Editor, EditorMode, NextScreen, NextScrollCursorCenterTopBottom, + SCROLL_CENTER_TOP_BOTTOM_DEBOUNCE_TIMEOUT, ScrollCursorBottom, ScrollCursorCenter, + ScrollCursorCenterTopBottom, ScrollCursorTop, display_map::DisplayRow, }; use gpui::{Context, Point, Window}; diff --git a/crates/editor/src/scroll/autoscroll.rs b/crates/editor/src/scroll/autoscroll.rs index eae2706a38..7c022e62a4 100644 --- a/crates/editor/src/scroll/autoscroll.rs +++ b/crates/editor/src/scroll/autoscroll.rs @@ -1,7 +1,7 @@ use crate::{ - display_map::ToDisplayPoint, DisplayRow, Editor, EditorMode, LineWithInvisibles, RowExt, + DisplayRow, Editor, EditorMode, LineWithInvisibles, RowExt, display_map::ToDisplayPoint, }; -use gpui::{px, Bounds, Context, Pixels, Window}; +use gpui::{Bounds, Context, Pixels, Window, px}; use language::Point; use multi_buffer::Anchor; use std::{cmp, f32}; diff --git a/crates/editor/src/scroll/scroll_amount.rs b/crates/editor/src/scroll/scroll_amount.rs index ee80b3d86f..0c0319b821 100644 --- a/crates/editor/src/scroll/scroll_amount.rs +++ b/crates/editor/src/scroll/scroll_amount.rs @@ -1,5 +1,5 @@ use serde::Deserialize; -use ui::{px, Pixels}; +use ui::{Pixels, px}; #[derive(Debug)] pub enum ScrollDirection { diff --git a/crates/editor/src/selections_collection.rs b/crates/editor/src/selections_collection.rs index 9a2d800b3a..32dcd4412a 100644 --- a/crates/editor/src/selections_collection.rs +++ b/crates/editor/src/selections_collection.rs @@ -12,10 +12,10 @@ use language::{Bias, Point, Selection, SelectionGoal, TextDimension}; use util::post_inc; use crate::{ - display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint}, - movement::TextLayoutDetails, Anchor, DisplayPoint, DisplayRow, ExcerptId, MultiBuffer, MultiBufferSnapshot, SelectMode, ToOffset, ToPoint, + display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint}, + movement::TextLayoutDetails, }; #[derive(Debug, Clone)] diff --git a/crates/editor/src/signature_help.rs b/crates/editor/src/signature_help.rs index 51e85582e3..949f90b0b9 100644 --- a/crates/editor/src/signature_help.rs +++ b/crates/editor/src/signature_help.rs @@ -1,8 +1,8 @@ use crate::actions::ShowSignatureHelp; use crate::{Editor, EditorSettings, ToggleAutoSignatureHelp}; use gpui::{ - combine_highlights, App, Context, HighlightStyle, MouseButton, Size, StyledText, Task, - TextStyle, Window, + App, Context, HighlightStyle, MouseButton, Size, StyledText, Task, TextStyle, Window, + combine_highlights, }; use language::BufferSnapshot; use multi_buffer::{Anchor, ToOffset}; @@ -11,8 +11,8 @@ use std::ops::Range; use text::Rope; use theme::ThemeSettings; use ui::{ - div, relative, ActiveTheme, AnyElement, InteractiveElement, IntoElement, ParentElement, Pixels, - SharedString, StatefulInteractiveElement, Styled, StyledExt, + ActiveTheme, AnyElement, InteractiveElement, IntoElement, ParentElement, Pixels, SharedString, + StatefulInteractiveElement, Styled, StyledExt, div, relative, }; // Language-specific settings may define quotes as "brackets", so filter them out separately. diff --git a/crates/editor/src/test.rs b/crates/editor/src/test.rs index f853aba877..fb38d6e104 100644 --- a/crates/editor/src/test.rs +++ b/crates/editor/src/test.rs @@ -4,12 +4,12 @@ pub mod editor_test_context; use std::sync::LazyLock; use crate::{ - display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint}, DisplayPoint, Editor, EditorMode, FoldPlaceholder, MultiBuffer, + display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint}, }; use gpui::{ - font, AppContext as _, Context, Entity, Font, FontFeatures, FontStyle, FontWeight, Pixels, - Window, + AppContext as _, Context, Entity, Font, FontFeatures, FontStyle, FontWeight, Pixels, Window, + font, }; use project::Project; use util::test::{marked_text_offsets, marked_text_ranges}; diff --git a/crates/editor/src/test/editor_lsp_test_context.rs b/crates/editor/src/test/editor_lsp_test_context.rs index 7031139ca6..1f625b4510 100644 --- a/crates/editor/src/test/editor_lsp_test_context.rs +++ b/crates/editor/src/test/editor_lsp_test_context.rs @@ -14,7 +14,7 @@ use futures::Future; use gpui::{Context, Entity, Focusable as _, VisualTestContext, Window}; use indoc::indoc; use language::{ - point_to_lsp, FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, LanguageQueries, + FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, LanguageQueries, point_to_lsp, }; use lsp::{notification, request}; use multi_buffer::ToPointUtf16; diff --git a/crates/editor/src/test/editor_test_context.rs b/crates/editor/src/test/editor_test_context.rs index 565bac336f..2a2712bf30 100644 --- a/crates/editor/src/test/editor_test_context.rs +++ b/crates/editor/src/test/editor_test_context.rs @@ -1,14 +1,14 @@ use crate::{ - display_map::ToDisplayPoint, AnchorRangeExt, Autoscroll, DisplayPoint, Editor, MultiBuffer, - RowExt, + AnchorRangeExt, Autoscroll, DisplayPoint, Editor, MultiBuffer, RowExt, + display_map::ToDisplayPoint, }; use buffer_diff::DiffHunkStatusKind; use collections::BTreeMap; use futures::Future; use gpui::{ - prelude::*, AnyWindowHandle, App, Context, Entity, Focusable as _, Keystroke, Pixels, Point, - VisualTestContext, Window, WindowHandle, + AnyWindowHandle, App, Context, Entity, Focusable as _, Keystroke, Pixels, Point, + VisualTestContext, Window, WindowHandle, prelude::*, }; use itertools::Itertools; use language::{Buffer, BufferSnapshot, LanguageRegistry}; @@ -20,8 +20,8 @@ use std::{ ops::{Deref, DerefMut, Range}, path::Path, sync::{ - atomic::{AtomicUsize, Ordering}, Arc, + atomic::{AtomicUsize, Ordering}, }, }; use util::{ diff --git a/crates/evals/src/eval.rs b/crates/evals/src/eval.rs index 2c8f05c86d..05b4eae33f 100644 --- a/crates/evals/src/eval.rs +++ b/crates/evals/src/eval.rs @@ -18,19 +18,19 @@ use semantic_index::{ }; use serde::{Deserialize, Serialize}; use settings::SettingsStore; +use smol::Timer; use smol::channel::bounded; use smol::io::AsyncReadExt; -use smol::Timer; use std::ops::RangeInclusive; use std::path::PathBuf; use std::time::Duration; use std::{ fs, path::Path, - process::{exit, Stdio}, + process::{Stdio, exit}, sync::{ - atomic::{AtomicUsize, Ordering::SeqCst}, Arc, + atomic::{AtomicUsize, Ordering::SeqCst}, }, }; diff --git a/crates/extension/src/extension.rs b/crates/extension/src/extension.rs index 95c2049194..1955c9f3d0 100644 --- a/crates/extension/src/extension.rs +++ b/crates/extension/src/extension.rs @@ -8,7 +8,7 @@ use std::path::{Path, PathBuf}; use std::sync::Arc; use ::lsp::LanguageServerName; -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use async_trait::async_trait; use fs::normalize_path; use gpui::{App, Task}; diff --git a/crates/extension/src/extension_builder.rs b/crates/extension/src/extension_builder.rs index 48e224d8b5..f2c8a6a65a 100644 --- a/crates/extension/src/extension_builder.rs +++ b/crates/extension/src/extension_builder.rs @@ -1,12 +1,12 @@ use crate::{ - parse_wasm_extension_version, ExtensionLibraryKind, ExtensionManifest, GrammarManifestEntry, + ExtensionLibraryKind, ExtensionManifest, GrammarManifestEntry, parse_wasm_extension_version, }; -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use convert_case::{Case, Casing as _}; -use futures::io::BufReader; use futures::AsyncReadExt; +use futures::io::BufReader; use http_client::{self, AsyncBody, HttpClient}; use serde::Deserialize; use std::{ diff --git a/crates/extension/src/extension_manifest.rs b/crates/extension/src/extension_manifest.rs index e93767246e..799b30861f 100644 --- a/crates/extension/src/extension_manifest.rs +++ b/crates/extension/src/extension_manifest.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use collections::{BTreeMap, HashMap}; use fs::Fs; use language::LanguageName; @@ -347,9 +347,11 @@ mod tests { assert!(manifest.allow_exec("cargo", &["test"]).is_ok()); assert!(manifest.allow_exec("cargo", &["test", "--all"]).is_ok()); - assert!(manifest - .allow_exec("cargo", &["test", "--all", "--no-fail-fast"]) - .is_ok()); + assert!( + manifest + .allow_exec("cargo", &["test", "--all", "--no-fail-fast"]) + .is_ok() + ); assert!(manifest.allow_exec("cargo", &["build"]).is_err()); // wrong first arg } @@ -365,12 +367,16 @@ mod tests { assert!(manifest.allow_exec("docker", &["run", "nginx"]).is_ok()); assert!(manifest.allow_exec("docker", &["run"]).is_err()); - assert!(manifest - .allow_exec("docker", &["run", "ubuntu", "bash"]) - .is_ok()); - assert!(manifest - .allow_exec("docker", &["run", "alpine", "sh", "-c", "echo hello"]) - .is_ok()); + assert!( + manifest + .allow_exec("docker", &["run", "ubuntu", "bash"]) + .is_ok() + ); + assert!( + manifest + .allow_exec("docker", &["run", "alpine", "sh", "-c", "echo hello"]) + .is_ok() + ); assert!(manifest.allow_exec("docker", &["ps"]).is_err()); // wrong first arg } } diff --git a/crates/extension_api/src/extension_api.rs b/crates/extension_api/src/extension_api.rs index 80eb1f447c..e7a012439f 100644 --- a/crates/extension_api/src/extension_api.rs +++ b/crates/extension_api/src/extension_api.rs @@ -15,21 +15,21 @@ pub use serde_json; // We explicitly enumerate the symbols we want to re-export, as there are some // that we may want to shadow to provide a cleaner Rust API. pub use wit::{ - download_file, make_file_executable, + CodeLabel, CodeLabelSpan, CodeLabelSpanLiteral, Command, DownloadedFileType, EnvVars, + KeyValueStore, LanguageServerInstallationStatus, Project, Range, Worktree, download_file, + make_file_executable, zed::extension::github::{ - github_release_by_tag_name, latest_github_release, GithubRelease, GithubReleaseAsset, - GithubReleaseOptions, + GithubRelease, GithubReleaseAsset, GithubReleaseOptions, github_release_by_tag_name, + latest_github_release, }, zed::extension::nodejs::{ node_binary_path, npm_install_package, npm_package_installed_version, npm_package_latest_version, }, - zed::extension::platform::{current_platform, Architecture, Os}, + zed::extension::platform::{Architecture, Os, current_platform}, zed::extension::slash_command::{ SlashCommand, SlashCommandArgumentCompletion, SlashCommandOutput, SlashCommandOutputSection, }, - CodeLabel, CodeLabelSpan, CodeLabelSpanLiteral, Command, DownloadedFileType, EnvVars, - KeyValueStore, LanguageServerInstallationStatus, Project, Range, Worktree, }; // Undocumented WIT re-exports. @@ -210,7 +210,7 @@ fn extension() -> &'static mut dyn Extension { static mut EXTENSION: Option> = None; #[cfg(target_arch = "wasm32")] -#[link_section = "zed:api-version"] +#[unsafe(link_section = "zed:api-version")] #[doc(hidden)] pub static ZED_API_VERSION: [u8; 6] = *include_bytes!(concat!(env!("OUT_DIR"), "/version_bytes")); diff --git a/crates/extension_api/src/http_client.rs b/crates/extension_api/src/http_client.rs index 9953ba42b3..9e30da8db4 100644 --- a/crates/extension_api/src/http_client.rs +++ b/crates/extension_api/src/http_client.rs @@ -1,7 +1,7 @@ //! An HTTP client. pub use crate::wit::zed::extension::http_client::{ - fetch, fetch_stream, HttpMethod, HttpRequest, HttpResponse, HttpResponseStream, RedirectPolicy, + HttpMethod, HttpRequest, HttpResponse, HttpResponseStream, RedirectPolicy, fetch, fetch_stream, }; impl HttpRequest { diff --git a/crates/extension_api/src/settings.rs b/crates/extension_api/src/settings.rs index aea4db1a72..a133a8027a 100644 --- a/crates/extension_api/src/settings.rs +++ b/crates/extension_api/src/settings.rs @@ -3,7 +3,7 @@ #[path = "../wit/since_v0.2.0/settings.rs"] mod types; -use crate::{wit, Project, Result, SettingsLocation, Worktree}; +use crate::{Project, Result, SettingsLocation, Worktree, wit}; use serde_json; pub use types::*; diff --git a/crates/extension_cli/src/main.rs b/crates/extension_cli/src/main.rs index c753138007..5c2ba8569b 100644 --- a/crates/extension_cli/src/main.rs +++ b/crates/extension_cli/src/main.rs @@ -5,11 +5,11 @@ use std::path::{Path, PathBuf}; use std::process::Command; use std::sync::Arc; -use ::fs::{copy_recursive, CopyOptions, Fs, RealFs}; -use anyhow::{anyhow, bail, Context, Result}; +use ::fs::{CopyOptions, Fs, RealFs, copy_recursive}; +use anyhow::{Context, Result, anyhow, bail}; use clap::Parser; -use extension::extension_builder::{CompileExtensionOptions, ExtensionBuilder}; use extension::ExtensionManifest; +use extension::extension_builder::{CompileExtensionOptions, ExtensionBuilder}; use language::LanguageConfig; use reqwest_client::ReqwestClient; use rpc::ExtensionProvides; diff --git a/crates/extension_host/src/extension_host.rs b/crates/extension_host/src/extension_host.rs index 3334944858..3be714fc95 100644 --- a/crates/extension_host/src/extension_host.rs +++ b/crates/extension_host/src/extension_host.rs @@ -5,14 +5,14 @@ pub mod wasm_host; #[cfg(test)] mod extension_store_test; -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use client::ExtensionProvides; -use client::{proto, telemetry::Telemetry, Client, ExtensionMetadata, GetExtensionsResponse}; -use collections::{btree_map, BTreeMap, BTreeSet, HashMap, HashSet}; -use extension::extension_builder::{CompileExtensionOptions, ExtensionBuilder}; +use client::{Client, ExtensionMetadata, GetExtensionsResponse, proto, telemetry::Telemetry}; +use collections::{BTreeMap, BTreeSet, HashMap, HashSet, btree_map}; pub use extension::ExtensionManifest; +use extension::extension_builder::{CompileExtensionOptions, ExtensionBuilder}; use extension::{ ExtensionContextServerProxy, ExtensionEvents, ExtensionGrammarProxy, ExtensionHostProxy, ExtensionIndexedDocsProviderProxy, ExtensionLanguageProxy, ExtensionLanguageServerProxy, @@ -20,21 +20,22 @@ use extension::{ }; use fs::{Fs, RemoveOptions}; use futures::{ + AsyncReadExt as _, Future, FutureExt as _, StreamExt as _, channel::{ - mpsc::{unbounded, UnboundedSender}, + mpsc::{UnboundedSender, unbounded}, oneshot, }, io::BufReader, - select_biased, AsyncReadExt as _, Future, FutureExt as _, StreamExt as _, + select_biased, }; use gpui::{ - actions, App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, Task, - WeakEntity, + App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, Task, WeakEntity, + actions, }; use http_client::{AsyncBody, HttpClient, HttpClientWithUrl}; use language::{ - LanguageConfig, LanguageMatcher, LanguageName, LanguageQueries, LoadedLanguage, Rope, - QUERY_FILENAME_PREFIXES, + LanguageConfig, LanguageMatcher, LanguageName, LanguageQueries, LoadedLanguage, + QUERY_FILENAME_PREFIXES, Rope, }; use node_runtime::NodeRuntime; use project::ContextProviderWithTasks; @@ -54,8 +55,8 @@ use std::{ use url::Url; use util::ResultExt; use wasm_host::{ - wit::{is_supported_wasm_api_version, wasm_api_version_range}, WasmExtension, WasmHost, + wit::{is_supported_wasm_api_version, wasm_api_version_range}, }; pub use extension::{ diff --git a/crates/extension_host/src/extension_store_test.rs b/crates/extension_host/src/extension_store_test.rs index def82110f2..2acc01cb03 100644 --- a/crates/extension_host/src/extension_store_test.rs +++ b/crates/extension_host/src/extension_store_test.rs @@ -1,20 +1,20 @@ use crate::{ Event, ExtensionIndex, ExtensionIndexEntry, ExtensionIndexLanguageEntry, ExtensionIndexThemeEntry, ExtensionManifest, ExtensionSettings, ExtensionStore, - GrammarManifestEntry, SchemaVersion, RELOAD_DEBOUNCE_DURATION, + GrammarManifestEntry, RELOAD_DEBOUNCE_DURATION, SchemaVersion, }; use async_compression::futures::bufread::GzipEncoder; use collections::BTreeMap; use extension::ExtensionHostProxy; use fs::{FakeFs, Fs, RealFs}; -use futures::{io::BufReader, AsyncReadExt, StreamExt}; +use futures::{AsyncReadExt, StreamExt, io::BufReader}; use gpui::{AppContext as _, SemanticVersion, SharedString, TestAppContext}; use http_client::{FakeHttpClient, Response}; use language::{BinaryStatus, LanguageMatcher, LanguageRegistry}; use lsp::LanguageServerName; use node_runtime::NodeRuntime; use parking_lot::Mutex; -use project::{Project, DEFAULT_COMPLETION_CONTEXT}; +use project::{DEFAULT_COMPLETION_CONTEXT, Project}; use release_channel::AppVersion; use reqwest_client::ReqwestClient; use serde_json::json; diff --git a/crates/extension_host/src/headless_host.rs b/crates/extension_host/src/headless_host.rs index 3aaf610b85..076f03e204 100644 --- a/crates/extension_host/src/headless_host.rs +++ b/crates/extension_host/src/headless_host.rs @@ -1,7 +1,7 @@ use std::{path::PathBuf, sync::Arc}; -use anyhow::{anyhow, Context as _, Result}; -use client::{proto, TypedEnvelope}; +use anyhow::{Context as _, Result, anyhow}; +use client::{TypedEnvelope, proto}; use collections::{HashMap, HashSet}; use extension::{ Extension, ExtensionHostProxy, ExtensionLanguageProxy, ExtensionLanguageServerProxy, diff --git a/crates/extension_host/src/wasm_host.rs b/crates/extension_host/src/wasm_host.rs index a01662f63f..1308b8e421 100644 --- a/crates/extension_host/src/wasm_host.rs +++ b/crates/extension_host/src/wasm_host.rs @@ -1,21 +1,21 @@ pub mod wit; use crate::ExtensionManifest; -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use async_trait::async_trait; use extension::{ CodeLabel, Command, Completion, ExtensionHostProxy, KeyValueStoreDelegate, ProjectDelegate, SlashCommand, SlashCommandArgumentCompletion, SlashCommandOutput, Symbol, WorktreeDelegate, }; -use fs::{normalize_path, Fs}; +use fs::{Fs, normalize_path}; use futures::future::LocalBoxFuture; use futures::{ + Future, FutureExt, StreamExt as _, channel::{ mpsc::{self, UnboundedSender}, oneshot, }, future::BoxFuture, - Future, FutureExt, StreamExt as _, }; use gpui::{App, AsyncApp, BackgroundExecutor, Task}; use http_client::HttpClient; @@ -29,8 +29,8 @@ use std::{ sync::{Arc, OnceLock}, }; use wasmtime::{ - component::{Component, ResourceTable}, Engine, Store, + component::{Component, ResourceTable}, }; use wasmtime_wasi::{self as wasi, WasiView}; use wit::Extension; diff --git a/crates/extension_host/src/wasm_host/wit.rs b/crates/extension_host/src/wasm_host/wit.rs index 93fb911ac0..612d99cd8b 100644 --- a/crates/extension_host/src/wasm_host/wit.rs +++ b/crates/extension_host/src/wasm_host/wit.rs @@ -11,23 +11,23 @@ use lsp::LanguageServerName; use release_channel::ReleaseChannel; use since_v0_4_0 as latest; -use super::{wasm_engine, WasmState}; -use anyhow::{anyhow, Context as _, Result}; +use super::{WasmState, wasm_engine}; +use anyhow::{Context as _, Result, anyhow}; use semantic_version::SemanticVersion; use std::{ops::RangeInclusive, sync::Arc}; use wasmtime::{ - component::{Component, Linker, Resource}, Store, + component::{Component, Linker, Resource}, }; #[cfg(test)] pub use latest::CodeLabelSpanLiteral; pub use latest::{ + CodeLabel, CodeLabelSpan, Command, ExtensionProject, Range, SlashCommand, zed::extension::lsp::{ Completion, CompletionKind, CompletionLabelDetails, InsertTextFormat, Symbol, SymbolKind, }, zed::extension::slash_command::{SlashCommandArgumentCompletion, SlashCommandOutput}, - CodeLabel, CodeLabelSpan, Command, ExtensionProject, Range, SlashCommand, }; pub use since_v0_0_4::LanguageServerConfig; diff --git a/crates/extension_host/src/wasm_host/wit/since_v0_0_1.rs b/crates/extension_host/src/wasm_host/wit/since_v0_0_1.rs index 5210726a56..b5532005f5 100644 --- a/crates/extension_host/src/wasm_host/wit/since_v0_0_1.rs +++ b/crates/extension_host/src/wasm_host/wit/since_v0_0_1.rs @@ -1,6 +1,6 @@ use super::latest; -use crate::wasm_host::wit::since_v0_0_4; use crate::wasm_host::WasmState; +use crate::wasm_host::wit::since_v0_0_4; use anyhow::Result; use extension::{ExtensionLanguageServerProxy, WorktreeDelegate}; use language::BinaryStatus; diff --git a/crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs b/crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs index 95c6ed0037..8962122261 100644 --- a/crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs +++ b/crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs @@ -1,14 +1,14 @@ -use crate::wasm_host::{wit::ToWasmtimeResult, WasmState}; +use crate::wasm_host::{WasmState, wit::ToWasmtimeResult}; use ::http_client::{AsyncBody, HttpRequestExt}; use ::settings::{Settings, WorktreeId}; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use extension::{ExtensionLanguageServerProxy, KeyValueStoreDelegate, WorktreeDelegate}; -use futures::{io::BufReader, FutureExt as _}; -use futures::{lock::Mutex, AsyncReadExt}; +use futures::{AsyncReadExt, lock::Mutex}; +use futures::{FutureExt as _, io::BufReader}; use language::LanguageName; -use language::{language_settings::AllLanguageSettings, BinaryStatus}; +use language::{BinaryStatus, language_settings::AllLanguageSettings}; use project::project_settings::ProjectSettings; use semantic_version::SemanticVersion; use std::{ diff --git a/crates/extension_host/src/wasm_host/wit/since_v0_4_0.rs b/crates/extension_host/src/wasm_host/wit/since_v0_4_0.rs index 4e246dea16..13181aace3 100644 --- a/crates/extension_host/src/wasm_host/wit/since_v0_4_0.rs +++ b/crates/extension_host/src/wasm_host/wit/since_v0_4_0.rs @@ -1,9 +1,9 @@ use crate::wasm_host::wit::since_v0_4_0::slash_command::SlashCommandOutputSection; use crate::wasm_host::wit::{CompletionKind, CompletionLabelDetails, InsertTextFormat, SymbolKind}; -use crate::wasm_host::{wit::ToWasmtimeResult, WasmState}; +use crate::wasm_host::{WasmState, wit::ToWasmtimeResult}; use ::http_client::{AsyncBody, HttpRequestExt}; use ::settings::{Settings, WorktreeId}; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use async_trait::async_trait; @@ -11,9 +11,9 @@ use context_server_settings::ContextServerSettings; use extension::{ ExtensionLanguageServerProxy, KeyValueStoreDelegate, ProjectDelegate, WorktreeDelegate, }; -use futures::{io::BufReader, FutureExt as _}; -use futures::{lock::Mutex, AsyncReadExt}; -use language::{language_settings::AllLanguageSettings, BinaryStatus, LanguageName}; +use futures::{AsyncReadExt, lock::Mutex}; +use futures::{FutureExt as _, io::BufReader}; +use language::{BinaryStatus, LanguageName, language_settings::AllLanguageSettings}; use project::project_settings::ProjectSettings; use semantic_version::SemanticVersion; use std::{ diff --git a/crates/extensions_ui/src/components/extension_card.rs b/crates/extensions_ui/src/components/extension_card.rs index 4e6ab6a623..75223df96f 100644 --- a/crates/extensions_ui/src/components/extension_card.rs +++ b/crates/extensions_ui/src/components/extension_card.rs @@ -1,4 +1,4 @@ -use gpui::{prelude::*, AnyElement}; +use gpui::{AnyElement, prelude::*}; use smallvec::SmallVec; use ui::prelude::*; diff --git a/crates/extensions_ui/src/components/feature_upsell.rs b/crates/extensions_ui/src/components/feature_upsell.rs index be650ff6e0..d2d86937ff 100644 --- a/crates/extensions_ui/src/components/feature_upsell.rs +++ b/crates/extensions_ui/src/components/feature_upsell.rs @@ -1,6 +1,6 @@ use gpui::{AnyElement, Div, StyleRefinement}; use smallvec::SmallVec; -use ui::{prelude::*, ButtonLike}; +use ui::{ButtonLike, prelude::*}; #[derive(IntoElement)] pub struct FeatureUpsell { diff --git a/crates/extensions_ui/src/extension_suggest.rs b/crates/extensions_ui/src/extension_suggest.rs index 32e61de6ef..85296ab800 100644 --- a/crates/extensions_ui/src/extension_suggest.rs +++ b/crates/extensions_ui/src/extension_suggest.rs @@ -9,7 +9,7 @@ use gpui::{AppContext as _, Context, Entity, SharedString, Window}; use language::Buffer; use ui::prelude::*; use workspace::notifications::simple_message_notification::MessageNotification; -use workspace::{notifications::NotificationId, Workspace}; +use workspace::{Workspace, notifications::NotificationId}; const SUGGESTIONS_BY_EXTENSION_ID: &[(&str, &[&str])] = &[ ("astro", &["astro"]), diff --git a/crates/extensions_ui/src/extension_version_selector.rs b/crates/extensions_ui/src/extension_version_selector.rs index 8e9b85c860..3cb3f0e424 100644 --- a/crates/extensions_ui/src/extension_version_selector.rs +++ b/crates/extensions_ui/src/extension_version_selector.rs @@ -4,13 +4,13 @@ use std::sync::Arc; use client::ExtensionMetadata; use extension_host::{ExtensionSettings, ExtensionStore}; use fs::Fs; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; -use gpui::{prelude::*, App, DismissEvent, Entity, EventEmitter, Focusable, Task, WeakEntity}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; +use gpui::{App, DismissEvent, Entity, EventEmitter, Focusable, Task, WeakEntity, prelude::*}; use picker::{Picker, PickerDelegate}; use release_channel::ReleaseChannel; use semantic_version::SemanticVersion; use settings::update_settings_file; -use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; +use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::ModalView; diff --git a/crates/extensions_ui/src/extensions_ui.rs b/crates/extensions_ui/src/extensions_ui.rs index ffe5552995..92570f72c9 100644 --- a/crates/extensions_ui/src/extensions_ui.rs +++ b/crates/extensions_ui/src/extensions_ui.rs @@ -10,11 +10,11 @@ use client::{ExtensionMetadata, ExtensionProvides}; use collections::{BTreeMap, BTreeSet}; use editor::{Editor, EditorElement, EditorStyle}; use extension_host::{ExtensionManifest, ExtensionOperation, ExtensionStore}; -use fuzzy::{match_strings, StringMatchCandidate}; +use fuzzy::{StringMatchCandidate, match_strings}; use gpui::{ - actions, point, uniform_list, Action, App, ClipboardItem, Context, Entity, EventEmitter, - Flatten, Focusable, InteractiveElement, KeyContext, ParentElement, Render, Styled, Task, - TextStyle, UniformListScrollHandle, WeakEntity, Window, + Action, App, ClipboardItem, Context, Entity, EventEmitter, Flatten, Focusable, + InteractiveElement, KeyContext, ParentElement, Render, Styled, Task, TextStyle, + UniformListScrollHandle, WeakEntity, Window, actions, point, uniform_list, }; use num_format::{Locale, ToFormattedString}; use project::DirectoryLister; @@ -23,13 +23,13 @@ use settings::Settings; use strum::IntoEnumIterator as _; use theme::ThemeSettings; use ui::{ - prelude::*, CheckboxWithLabel, ContextMenu, PopoverMenu, ScrollableHandle, Scrollbar, - ScrollbarState, ToggleButton, Tooltip, + CheckboxWithLabel, ContextMenu, PopoverMenu, ScrollableHandle, Scrollbar, ScrollbarState, + ToggleButton, Tooltip, prelude::*, }; use vim_mode_setting::VimModeSetting; use workspace::{ - item::{Item, ItemEvent}, Workspace, WorkspaceId, + item::{Item, ItemEvent}, }; use zed_actions::ExtensionCategoryFilter; diff --git a/crates/feature_flags/src/feature_flags.rs b/crates/feature_flags/src/feature_flags.rs index 8981f08095..effb3cda31 100644 --- a/crates/feature_flags/src/feature_flags.rs +++ b/crates/feature_flags/src/feature_flags.rs @@ -1,5 +1,5 @@ use futures::channel::oneshot; -use futures::{select_biased, FutureExt}; +use futures::{FutureExt, select_biased}; use gpui::{App, Context, Global, Subscription, Task, Window}; use std::cell::RefCell; use std::rc::Rc; diff --git a/crates/feedback/src/feedback.rs b/crates/feedback/src/feedback.rs index 69f98f8611..23811c2bfa 100644 --- a/crates/feedback/src/feedback.rs +++ b/crates/feedback/src/feedback.rs @@ -1,4 +1,4 @@ -use gpui::{actions, App, ClipboardItem, PromptLevel}; +use gpui::{App, ClipboardItem, PromptLevel, actions}; use system_specs::SystemSpecs; use util::ResultExt; use workspace::Workspace; diff --git a/crates/feedback/src/feedback_modal.rs b/crates/feedback/src/feedback_modal.rs index 45d656c174..beb879efe7 100644 --- a/crates/feedback/src/feedback_modal.rs +++ b/crates/feedback/src/feedback_modal.rs @@ -1,5 +1,5 @@ use gpui::{App, Context, DismissEvent, EventEmitter, FocusHandle, Focusable, Render, Window}; -use ui::{prelude::*, IconPosition}; +use ui::{IconPosition, prelude::*}; use workspace::{ModalView, Workspace}; use zed_actions::feedback::GiveFeedback; diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index a796de6f3b..b2a27047bb 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -16,9 +16,9 @@ use file_finder_settings::{FileFinderSettings, FileFinderWidth}; use file_icons::FileIcons; use fuzzy::{CharBag, PathMatch, PathMatchCandidate}; use gpui::{ - actions, Action, AnyElement, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, - Focusable, KeyContext, Modifiers, ModifiersChangedEvent, ParentElement, Render, Styled, Task, - WeakEntity, Window, + Action, AnyElement, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, + KeyContext, Modifiers, ModifiersChangedEvent, ParentElement, Render, Styled, Task, WeakEntity, + Window, actions, }; use new_path_prompt::NewPathPrompt; use open_path_prompt::OpenPathPrompt; @@ -31,19 +31,19 @@ use std::{ ops::Range, path::{Component, Path, PathBuf}, sync::{ - atomic::{self, AtomicBool}, Arc, + atomic::{self, AtomicBool}, }, }; use text::Point; use ui::{ - prelude::*, ContextMenu, HighlightedLabel, ListItem, ListItemSpacing, PopoverMenu, - PopoverMenuHandle, + ContextMenu, HighlightedLabel, ListItem, ListItemSpacing, PopoverMenu, PopoverMenuHandle, + prelude::*, }; -use util::{maybe, paths::PathWithPosition, post_inc, ResultExt}; +use util::{ResultExt, maybe, paths::PathWithPosition, post_inc}; use workspace::{ - item::PreviewTabsSettings, notifications::NotifyResultExt, pane, ModalView, OpenOptions, - OpenVisible, SplitDirection, Workspace, + ModalView, OpenOptions, OpenVisible, SplitDirection, Workspace, item::PreviewTabsSettings, + notifications::NotifyResultExt, pane, }; actions!(file_finder, [SelectPrevious, ToggleMenu]); diff --git a/crates/file_finder/src/file_finder_tests.rs b/crates/file_finder/src/file_finder_tests.rs index 65058c6b24..d37e3d9cb7 100644 --- a/crates/file_finder/src/file_finder_tests.rs +++ b/crates/file_finder/src/file_finder_tests.rs @@ -4,7 +4,7 @@ use super::*; use editor::Editor; use gpui::{Entity, TestAppContext, VisualTestContext}; use menu::{Confirm, SelectNext, SelectPrevious}; -use project::{RemoveOptions, FS_WATCH_LATENCY}; +use project::{FS_WATCH_LATENCY, RemoveOptions}; use serde_json::json; use util::path; use workspace::{AppState, OpenOptions, ToggleFileFinder, Workspace}; diff --git a/crates/file_finder/src/new_path_prompt.rs b/crates/file_finder/src/new_path_prompt.rs index cf6789a3e6..87075ebb0c 100644 --- a/crates/file_finder/src/new_path_prompt.rs +++ b/crates/file_finder/src/new_path_prompt.rs @@ -6,12 +6,12 @@ use project::{Entry, PathMatchCandidateSet, Project, ProjectPath, WorktreeId}; use std::{ path::{Path, PathBuf}, sync::{ - atomic::{self, AtomicBool}, Arc, + atomic::{self, AtomicBool}, }, }; -use ui::{highlight_ranges, prelude::*, LabelLike, ListItemSpacing}; use ui::{Context, ListItem, Window}; +use ui::{LabelLike, ListItemSpacing, highlight_ranges, prelude::*}; use util::ResultExt; use workspace::Workspace; diff --git a/crates/file_finder/src/open_path_prompt.rs b/crates/file_finder/src/open_path_prompt.rs index aeb774176d..2d18d60d2d 100644 --- a/crates/file_finder/src/open_path_prompt.rs +++ b/crates/file_finder/src/open_path_prompt.rs @@ -3,14 +3,14 @@ use fuzzy::{StringMatch, StringMatchCandidate}; use picker::{Picker, PickerDelegate}; use project::DirectoryLister; use std::{ - path::{Path, PathBuf, MAIN_SEPARATOR_STR}, + path::{MAIN_SEPARATOR_STR, Path, PathBuf}, sync::{ - atomic::{self, AtomicBool}, Arc, + atomic::{self, AtomicBool}, }, }; -use ui::{prelude::*, HighlightedLabel, ListItemSpacing}; use ui::{Context, ListItem, Window}; +use ui::{HighlightedLabel, ListItemSpacing, prelude::*}; use util::{maybe, paths::compare_paths}; use workspace::Workspace; diff --git a/crates/fs/src/fake_git_repo.rs b/crates/fs/src/fake_git_repo.rs index 6d1a19faf2..eaed99f7e0 100644 --- a/crates/fs/src/fake_git_repo.rs +++ b/crates/fs/src/fake_git_repo.rs @@ -1,5 +1,5 @@ use crate::FakeFs; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::{HashMap, HashSet}; use futures::future::{self, BoxFuture}; use git::{ diff --git a/crates/fs/src/fs.rs b/crates/fs/src/fs.rs index d30228a4ea..5c75c3cacb 100644 --- a/crates/fs/src/fs.rs +++ b/crates/fs/src/fs.rs @@ -4,7 +4,7 @@ mod mac_watcher; #[cfg(not(target_os = "macos"))] pub mod fs_watcher; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; #[cfg(any(target_os = "linux", target_os = "freebsd"))] use ashpd::desktop::trash; use gpui::App; @@ -21,7 +21,7 @@ use std::os::fd::{AsFd, AsRawFd}; use std::os::unix::fs::{FileTypeExt, MetadataExt}; use async_tar::Archive; -use futures::{future::BoxFuture, AsyncRead, Stream, StreamExt}; +use futures::{AsyncRead, Stream, StreamExt, future::BoxFuture}; use git::repository::{GitRepository, RealGitRepository}; use rope::Rope; use serde::{Deserialize, Serialize}; @@ -39,7 +39,7 @@ use text::LineEnding; #[cfg(any(test, feature = "test-support"))] mod fake_git_repo; #[cfg(any(test, feature = "test-support"))] -use collections::{btree_map, BTreeMap}; +use collections::{BTreeMap, btree_map}; #[cfg(any(test, feature = "test-support"))] use fake_git_repo::FakeGitRepositoryState; #[cfg(any(test, feature = "test-support"))] @@ -466,8 +466,8 @@ impl Fs for RealFs { async fn trash_file(&self, path: &Path, _options: RemoveOptions) -> Result<()> { use util::paths::SanitizedPath; use windows::{ - core::HSTRING, Storage::{StorageDeleteOption, StorageFile}, + core::HSTRING, }; // todo(windows) // When new version of `windows-rs` release, make this operation `async` @@ -492,8 +492,8 @@ impl Fs for RealFs { async fn trash_dir(&self, path: &Path, _options: RemoveOptions) -> Result<()> { use util::paths::SanitizedPath; use windows::{ - core::HSTRING, Storage::{StorageDeleteOption, StorageFolder}, + core::HSTRING, }; // todo(windows) @@ -710,7 +710,7 @@ impl Fs for RealFs { Arc, ) { use parking_lot::Mutex; - use util::{paths::SanitizedPath, ResultExt as _}; + use util::{ResultExt as _, paths::SanitizedPath}; let (tx, rx) = smol::channel::unbounded(); let pending_paths: Arc>> = Default::default(); @@ -2300,7 +2300,7 @@ async fn file_id(path: impl AsRef) -> Result { use windows::Win32::{ Foundation::HANDLE, Storage::FileSystem::{ - GetFileInformationByHandle, BY_HANDLE_FILE_INFORMATION, FILE_FLAG_BACKUP_SEMANTICS, + BY_HANDLE_FILE_INFORMATION, FILE_FLAG_BACKUP_SEMANTICS, GetFileInformationByHandle, }, }; diff --git a/crates/fs/src/fs_watcher.rs b/crates/fs/src/fs_watcher.rs index b0e6a94b81..4b03c87157 100644 --- a/crates/fs/src/fs_watcher.rs +++ b/crates/fs/src/fs_watcher.rs @@ -1,7 +1,7 @@ use notify::EventKind; use parking_lot::Mutex; use std::sync::{Arc, OnceLock}; -use util::{paths::SanitizedPath, ResultExt}; +use util::{ResultExt, paths::SanitizedPath}; use crate::{PathEvent, PathEventKind, Watcher}; diff --git a/crates/fsevent/src/fsevent.rs b/crates/fsevent/src/fsevent.rs index 99cafb42c2..81ca0a4114 100644 --- a/crates/fsevent/src/fsevent.rs +++ b/crates/fsevent/src/fsevent.rs @@ -5,7 +5,7 @@ use fsevent_sys::{self as fs, core_foundation as cf}; use parking_lot::Mutex; use std::{ convert::AsRef, - ffi::{c_void, CStr, OsStr}, + ffi::{CStr, OsStr, c_void}, os::unix::ffi::OsStrExt, path::{Path, PathBuf}, ptr, slice, diff --git a/crates/fuzzy/src/fuzzy.rs b/crates/fuzzy/src/fuzzy.rs index b9595df61f..2d8c318c9f 100644 --- a/crates/fuzzy/src/fuzzy.rs +++ b/crates/fuzzy/src/fuzzy.rs @@ -5,6 +5,6 @@ mod strings; pub use char_bag::CharBag; pub use paths::{ - match_fixed_path_set, match_path_sets, PathMatch, PathMatchCandidate, PathMatchCandidateSet, + PathMatch, PathMatchCandidate, PathMatchCandidateSet, match_fixed_path_set, match_path_sets, }; -pub use strings::{match_strings, StringMatch, StringMatchCandidate}; +pub use strings::{StringMatch, StringMatchCandidate, match_strings}; diff --git a/crates/fuzzy/src/paths.rs b/crates/fuzzy/src/paths.rs index cb3d131b38..79628240eb 100644 --- a/crates/fuzzy/src/paths.rs +++ b/crates/fuzzy/src/paths.rs @@ -4,14 +4,14 @@ use std::{ cmp::{self, Ordering}, path::Path, sync::{ - atomic::{self, AtomicBool}, Arc, + atomic::{self, AtomicBool}, }, }; use crate::{ - matcher::{MatchCandidate, Matcher}, CharBag, + matcher::{MatchCandidate, Matcher}, }; #[derive(Clone, Debug)] diff --git a/crates/fuzzy/src/strings.rs b/crates/fuzzy/src/strings.rs index bb5db63fd2..2180a9b7b6 100644 --- a/crates/fuzzy/src/strings.rs +++ b/crates/fuzzy/src/strings.rs @@ -1,6 +1,6 @@ use crate::{ - matcher::{MatchCandidate, Matcher}, CharBag, + matcher::{MatchCandidate, Matcher}, }; use gpui::BackgroundExecutor; use std::{ diff --git a/crates/git/src/blame.rs b/crates/git/src/blame.rs index 8bdf92aa72..e207576c88 100644 --- a/crates/git/src/blame.rs +++ b/crates/git/src/blame.rs @@ -1,15 +1,15 @@ -use crate::commit::get_messages; use crate::Oid; -use anyhow::{anyhow, Context as _, Result}; +use crate::commit::get_messages; +use anyhow::{Context as _, Result, anyhow}; use collections::{HashMap, HashSet}; use futures::AsyncWriteExt; use serde::{Deserialize, Serialize}; use std::process::Stdio; use std::{ops::Range, path::Path}; use text::Rope; -use time::macros::format_description; use time::OffsetDateTime; use time::UtcOffset; +use time::macros::format_description; pub use git2 as libgit; @@ -301,8 +301,8 @@ fn parse_git_blame(output: &str) -> Result> { mod tests { use std::path::PathBuf; - use super::parse_git_blame; use super::BlameEntry; + use super::parse_git_blame; fn read_test_data(filename: &str) -> String { let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); diff --git a/crates/git/src/commit.rs b/crates/git/src/commit.rs index 0c2feb9af2..74ed6854f6 100644 --- a/crates/git/src/commit.rs +++ b/crates/git/src/commit.rs @@ -1,5 +1,5 @@ use crate::Oid; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::HashMap; use std::path::Path; diff --git a/crates/git/src/git.rs b/crates/git/src/git.rs index aeb075c1fe..615d807c38 100644 --- a/crates/git/src/git.rs +++ b/crates/git/src/git.rs @@ -7,7 +7,7 @@ pub mod status; pub use crate::hosting_provider::*; pub use crate::remote::*; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; pub use git2 as libgit; use gpui::action_with_deprecated_aliases; use gpui::actions; diff --git a/crates/git/src/repository.rs b/crates/git/src/repository.rs index 5e508b023b..0af0e49336 100644 --- a/crates/git/src/repository.rs +++ b/crates/git/src/repository.rs @@ -1,9 +1,9 @@ use crate::status::GitStatus; use crate::{Oid, SHORT_SHA_LENGTH}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::HashMap; use futures::future::BoxFuture; -use futures::{select_biased, AsyncWriteExt, FutureExt as _}; +use futures::{AsyncWriteExt, FutureExt as _, select_biased}; use git2::BranchType; use gpui::{AsyncApp, BackgroundExecutor, SharedString}; use parking_lot::Mutex; @@ -23,8 +23,8 @@ use std::{ }; use sum_tree::MapSeekTarget; use thiserror::Error; -use util::command::{new_smol_command, new_std_command}; use util::ResultExt; +use util::command::{new_smol_command, new_std_command}; use uuid::Uuid; pub use askpass::{AskPassDelegate, AskPassResult, AskPassSession}; @@ -1843,16 +1843,19 @@ mod tests { .unwrap(); let checkpoint2 = repo.checkpoint().await.unwrap(); - assert!(!repo - .compare_checkpoints(checkpoint1, checkpoint2.clone()) - .await - .unwrap()); + assert!( + !repo + .compare_checkpoints(checkpoint1, checkpoint2.clone()) + .await + .unwrap() + ); let checkpoint3 = repo.checkpoint().await.unwrap(); - assert!(repo - .compare_checkpoints(checkpoint2, checkpoint3) - .await - .unwrap()); + assert!( + repo.compare_checkpoints(checkpoint2, checkpoint3) + .await + .unwrap() + ); } #[test] diff --git a/crates/git/src/status.rs b/crates/git/src/status.rs index 528bcec01f..872a1a373b 100644 --- a/crates/git/src/status.rs +++ b/crates/git/src/status.rs @@ -1,5 +1,5 @@ use crate::repository::RepoPath; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use serde::{Deserialize, Serialize}; use std::{path::Path, str::FromStr, sync::Arc}; use util::ResultExt; diff --git a/crates/git_hosting_providers/src/git_hosting_providers.rs b/crates/git_hosting_providers/src/git_hosting_providers.rs index 441136aa1f..11ac890eab 100644 --- a/crates/git_hosting_providers/src/git_hosting_providers.rs +++ b/crates/git_hosting_providers/src/git_hosting_providers.rs @@ -3,9 +3,9 @@ mod settings; use std::sync::Arc; -use anyhow::{anyhow, Result}; -use git::repository::GitRepository; +use anyhow::{Result, anyhow}; use git::GitHostingProviderRegistry; +use git::repository::GitRepository; use gpui::App; use url::Url; use util::maybe; diff --git a/crates/git_hosting_providers/src/providers/chromium.rs b/crates/git_hosting_providers/src/providers/chromium.rs index b651144b66..735c836730 100644 --- a/crates/git_hosting_providers/src/providers/chromium.rs +++ b/crates/git_hosting_providers/src/providers/chromium.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use std::sync::{Arc, LazyLock}; -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use async_trait::async_trait; use futures::AsyncReadExt; use git::{ diff --git a/crates/git_hosting_providers/src/providers/codeberg.rs b/crates/git_hosting_providers/src/providers/codeberg.rs index 0e01331278..2953280781 100644 --- a/crates/git_hosting_providers/src/providers/codeberg.rs +++ b/crates/git_hosting_providers/src/providers/codeberg.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use std::sync::Arc; -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use async_trait::async_trait; use futures::AsyncReadExt; use gpui::SharedString; diff --git a/crates/git_hosting_providers/src/providers/github.rs b/crates/git_hosting_providers/src/providers/github.rs index 160cbc8f6c..a5ffac762a 100644 --- a/crates/git_hosting_providers/src/providers/github.rs +++ b/crates/git_hosting_providers/src/providers/github.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use std::sync::{Arc, LazyLock}; -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use async_trait::async_trait; use futures::AsyncReadExt; use gpui::SharedString; diff --git a/crates/git_hosting_providers/src/providers/gitlab.rs b/crates/git_hosting_providers/src/providers/gitlab.rs index e4b296b92a..969a2ff1d5 100644 --- a/crates/git_hosting_providers/src/providers/gitlab.rs +++ b/crates/git_hosting_providers/src/providers/gitlab.rs @@ -1,6 +1,6 @@ use std::str::FromStr; -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use url::Url; use git::{ diff --git a/crates/git_ui/src/askpass_modal.rs b/crates/git_ui/src/askpass_modal.rs index 6a3700018d..149833ad35 100644 --- a/crates/git_ui/src/askpass_modal.rs +++ b/crates/git_ui/src/askpass_modal.rs @@ -2,9 +2,9 @@ use editor::Editor; use futures::channel::oneshot; use gpui::{AppContext, DismissEvent, Entity, EventEmitter, Focusable, Styled}; use ui::{ - div, h_flex, v_flex, ActiveTheme, App, Context, DynamicSpacing, Headline, HeadlineSize, Icon, - IconName, IconSize, InteractiveElement, IntoElement, ParentElement, Render, SharedString, - StyledExt, StyledTypography, Window, + ActiveTheme, App, Context, DynamicSpacing, Headline, HeadlineSize, Icon, IconName, IconSize, + InteractiveElement, IntoElement, ParentElement, Render, SharedString, StyledExt, + StyledTypography, Window, div, h_flex, v_flex, }; use workspace::ModalView; diff --git a/crates/git_ui/src/branch_picker.rs b/crates/git_ui/src/branch_picker.rs index 9ba55f9ed9..4e380d74c6 100644 --- a/crates/git_ui/src/branch_picker.rs +++ b/crates/git_ui/src/branch_picker.rs @@ -1,18 +1,18 @@ -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use fuzzy::StringMatchCandidate; use git::repository::Branch; use gpui::{ - rems, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, - InteractiveElement, IntoElement, Modifiers, ModifiersChangedEvent, ParentElement, Render, - SharedString, Styled, Subscription, Task, Window, + App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, + IntoElement, Modifiers, ModifiersChangedEvent, ParentElement, Render, SharedString, Styled, + Subscription, Task, Window, rems, }; use picker::{Picker, PickerDelegate, PickerEditorPosition}; use project::git_store::Repository; use std::sync::Arc; use time::OffsetDateTime; use time_format::format_local_timestamp; -use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; +use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::notifications::DetachAndPromptErr; use workspace::{ModalView, Workspace}; diff --git a/crates/git_ui/src/commit_modal.rs b/crates/git_ui/src/commit_modal.rs index 9a5b7dfc29..77be960612 100644 --- a/crates/git_ui/src/commit_modal.rs +++ b/crates/git_ui/src/commit_modal.rs @@ -1,15 +1,15 @@ use crate::branch_picker::{self, BranchList}; -use crate::git_panel::{commit_message_editor, GitPanel}; +use crate::git_panel::{GitPanel, commit_message_editor}; use git::{Commit, GenerateCommitMessage}; use panel::{panel_button, panel_editor_style, panel_filled_button}; -use ui::{prelude::*, KeybindingHint, PopoverMenu, PopoverMenuHandle, Tooltip}; +use ui::{KeybindingHint, PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*}; use editor::{Editor, EditorElement}; use gpui::*; use util::ResultExt; use workspace::{ - dock::{Dock, PanelHandle}, ModalView, Workspace, + dock::{Dock, PanelHandle}, }; // nate: It is a pain to get editors to size correctly and not overflow. diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index bf01d22cfa..f087897bcb 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -4,11 +4,11 @@ use crate::git_panel_settings::StatusStyle; use crate::project_diff::Diff; use crate::remote_output::{self, RemoteAction, SuccessMessage}; +use crate::{ProjectDiff, picker_prompt, project_diff}; use crate::{branch_picker, render_remote_button}; use crate::{ git_panel_settings::GitPanelSettings, git_status_icon, repository_selector::RepositorySelector, }; -use crate::{picker_prompt, project_diff, ProjectDiff}; use anyhow::Result; use askpass::AskPassDelegate; use assistant_settings::AssistantSettings; @@ -16,8 +16,8 @@ use db::kvp::KEY_VALUE_STORE; use editor::commit_tooltip::CommitTooltip; use editor::{ - scroll::ScrollbarAutoHide, Editor, EditorElement, EditorMode, EditorSettings, MultiBuffer, - ShowScrollbar, + Editor, EditorElement, EditorMode, EditorSettings, MultiBuffer, ShowScrollbar, + scroll::ScrollbarAutoHide, }; use futures::StreamExt as _; use git::repository::{ @@ -25,14 +25,14 @@ use git::repository::{ ResetMode, Upstream, UpstreamTracking, UpstreamTrackingStatus, }; use git::status::StageStatus; -use git::{repository::RepoPath, status::FileStatus, Commit, ToggleStaged}; +use git::{Commit, ToggleStaged, repository::RepoPath, status::FileStatus}; use git::{ExpandCommitEditor, RestoreTrackedFiles, StageAll, TrashUntrackedFiles, UnstageAll}; use gpui::{ - actions, anchored, deferred, percentage, uniform_list, Action, Animation, AnimationExt as _, - Axis, ClickEvent, Corner, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, - KeyContext, ListHorizontalSizingBehavior, ListSizingBehavior, Modifiers, ModifiersChangedEvent, - MouseButton, MouseDownEvent, Point, PromptLevel, ScrollStrategy, Subscription, Task, - Transformation, UniformListScrollHandle, WeakEntity, + Action, Animation, AnimationExt as _, Axis, ClickEvent, Corner, DismissEvent, Entity, + EventEmitter, FocusHandle, Focusable, KeyContext, ListHorizontalSizingBehavior, + ListSizingBehavior, Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent, Point, + PromptLevel, ScrollStrategy, Subscription, Task, Transformation, UniformListScrollHandle, + WeakEntity, actions, anchored, deferred, percentage, uniform_list, }; use itertools::Itertools; use language::{Buffer, File}; @@ -42,12 +42,12 @@ use language_model::{ use menu::{Confirm, SecondaryConfirm, SelectFirst, SelectLast, SelectNext, SelectPrevious}; use multi_buffer::ExcerptInfo; use panel::{ - panel_button, panel_editor_container, panel_editor_style, panel_filled_button, - panel_icon_button, PanelHeader, + PanelHeader, panel_button, panel_editor_container, panel_editor_style, panel_filled_button, + panel_icon_button, }; use project::{ - git_store::{GitEvent, Repository}, Fs, Project, ProjectPath, + git_store::{GitEvent, Repository}, }; use serde::{Deserialize, Serialize}; use settings::{Settings as _, SettingsStore}; @@ -59,17 +59,17 @@ use std::{collections::HashSet, sync::Arc, time::Duration, usize}; use strum::{IntoEnumIterator, VariantNames}; use time::OffsetDateTime; use ui::{ - prelude::*, Checkbox, ContextMenu, ElevationIndex, PopoverMenu, Scrollbar, ScrollbarState, - Tooltip, + Checkbox, ContextMenu, ElevationIndex, PopoverMenu, Scrollbar, ScrollbarState, Tooltip, + prelude::*, }; -use util::{maybe, post_inc, ResultExt, TryFutureExt}; +use util::{ResultExt, TryFutureExt, maybe, post_inc}; use workspace::AppState; use notifications::status_toast::{StatusToast, ToastIcon}; use workspace::{ + Workspace, dock::{DockPosition, Panel, PanelEvent}, notifications::DetachAndPromptErr, - Workspace, }; actions!( @@ -4244,182 +4244,186 @@ impl ComponentPreview for PanelRepoFooter { .gap_6() .w_full() .flex_none() - .children(vec![example_group_with_title( - "Action Button States", - vec![ - single_example( - "No Branch", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - active_repository(1).clone(), - None, - )) - .into_any_element(), - ) - .grow(), - single_example( - "Remote status unknown", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - active_repository(2).clone(), - Some(branch(unknown_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "No Remote Upstream", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - active_repository(3).clone(), - Some(branch(no_remote_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Not Ahead or Behind", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - active_repository(4).clone(), - Some(branch(not_ahead_or_behind_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Behind remote", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - active_repository(5).clone(), - Some(branch(behind_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Ahead of remote", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - active_repository(6).clone(), - Some(branch(ahead_of_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Ahead and behind remote", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - active_repository(7).clone(), - Some(branch(ahead_and_behind_upstream)), - )) - .into_any_element(), - ) - .grow(), - ], - ) - .grow() - .vertical()]) - .children(vec![example_group_with_title( - "Labels", - vec![ - single_example( - "Short Branch & Repo", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - SharedString::from("zed"), - Some(custom("main", behind_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Long Branch", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - SharedString::from("zed"), - Some(custom( - "redesign-and-update-git-ui-list-entry-style", - behind_upstream, - )), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Long Repo", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - SharedString::from("zed-industries-community-examples"), - Some(custom("gpui", ahead_of_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Long Repo & Branch", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - SharedString::from("zed-industries-community-examples"), - Some(custom( - "redesign-and-update-git-ui-list-entry-style", - behind_upstream, - )), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Uppercase Repo", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - SharedString::from("LICENSES"), - Some(custom("main", ahead_of_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Uppercase Branch", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - SharedString::from("zed"), - Some(custom("update-README", behind_upstream)), - )) - .into_any_element(), - ) - .grow(), - ], - ) - .grow() - .vertical()]) + .children(vec![ + example_group_with_title( + "Action Button States", + vec![ + single_example( + "No Branch", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + active_repository(1).clone(), + None, + )) + .into_any_element(), + ) + .grow(), + single_example( + "Remote status unknown", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + active_repository(2).clone(), + Some(branch(unknown_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "No Remote Upstream", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + active_repository(3).clone(), + Some(branch(no_remote_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Not Ahead or Behind", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + active_repository(4).clone(), + Some(branch(not_ahead_or_behind_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Behind remote", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + active_repository(5).clone(), + Some(branch(behind_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Ahead of remote", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + active_repository(6).clone(), + Some(branch(ahead_of_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Ahead and behind remote", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + active_repository(7).clone(), + Some(branch(ahead_and_behind_upstream)), + )) + .into_any_element(), + ) + .grow(), + ], + ) + .grow() + .vertical(), + ]) + .children(vec![ + example_group_with_title( + "Labels", + vec![ + single_example( + "Short Branch & Repo", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + SharedString::from("zed"), + Some(custom("main", behind_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Long Branch", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + SharedString::from("zed"), + Some(custom( + "redesign-and-update-git-ui-list-entry-style", + behind_upstream, + )), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Long Repo", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + SharedString::from("zed-industries-community-examples"), + Some(custom("gpui", ahead_of_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Long Repo & Branch", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + SharedString::from("zed-industries-community-examples"), + Some(custom( + "redesign-and-update-git-ui-list-entry-style", + behind_upstream, + )), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Uppercase Repo", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + SharedString::from("LICENSES"), + Some(custom("main", ahead_of_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Uppercase Branch", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + SharedString::from("zed"), + Some(custom("update-README", behind_upstream)), + )) + .into_any_element(), + ) + .grow(), + ], + ) + .grow() + .vertical(), + ]) .into_any_element() } } diff --git a/crates/git_ui/src/git_ui.rs b/crates/git_ui/src/git_ui.rs index ab10791405..63e397d335 100644 --- a/crates/git_ui/src/git_ui.rs +++ b/crates/git_ui/src/git_ui.rs @@ -8,7 +8,7 @@ use git::{ status::{FileStatus, StatusCode, UnmergedStatus, UnmergedStatusCode}, }; use git_panel_settings::GitPanelSettings; -use gpui::{actions, App, FocusHandle}; +use gpui::{App, FocusHandle, actions}; use onboarding::GitOnboardingModal; use project_diff::ProjectDiff; use ui::prelude::*; @@ -165,9 +165,9 @@ fn render_remote_button( mod remote_button { use gpui::{Action, AnyView, ClickEvent, Corner, FocusHandle}; use ui::{ - div, h_flex, rems, App, ButtonCommon, Clickable, ContextMenu, ElementId, FluentBuilder, - Icon, IconName, IconSize, IntoElement, Label, LabelCommon, LabelSize, LineHeightStyle, - ParentElement, PopoverMenu, SharedString, SplitButton, Styled, Tooltip, Window, + App, ButtonCommon, Clickable, ContextMenu, ElementId, FluentBuilder, Icon, IconName, + IconSize, IntoElement, Label, LabelCommon, LabelSize, LineHeightStyle, ParentElement, + PopoverMenu, SharedString, SplitButton, Styled, Tooltip, Window, div, h_flex, rems, }; pub fn render_fetch_button( diff --git a/crates/git_ui/src/onboarding.rs b/crates/git_ui/src/onboarding.rs index c51de8f5ef..d721b21a2a 100644 --- a/crates/git_ui/src/onboarding.rs +++ b/crates/git_ui/src/onboarding.rs @@ -1,8 +1,8 @@ use gpui::{ - svg, ClickEvent, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, MouseDownEvent, - Render, + ClickEvent, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, MouseDownEvent, Render, + svg, }; -use ui::{prelude::*, TintColor}; +use ui::{TintColor, prelude::*}; use workspace::{ModalView, Workspace}; use crate::git_panel::GitPanel; diff --git a/crates/git_ui/src/picker_prompt.rs b/crates/git_ui/src/picker_prompt.rs index ea67268668..ec530bf5d3 100644 --- a/crates/git_ui/src/picker_prompt.rs +++ b/crates/git_ui/src/picker_prompt.rs @@ -3,13 +3,13 @@ use fuzzy::{StringMatch, StringMatchCandidate}; use core::cmp; use gpui::{ - rems, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, - InteractiveElement, IntoElement, ParentElement, Render, SharedString, Styled, Subscription, - Task, WeakEntity, Window, + App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, + IntoElement, ParentElement, Render, SharedString, Styled, Subscription, Task, WeakEntity, + Window, rems, }; use picker::{Picker, PickerDelegate}; use std::sync::Arc; -use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; +use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::{ModalView, Workspace}; diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs index 815dfbdfb6..010154f8ef 100644 --- a/crates/git_ui/src/project_diff.rs +++ b/crates/git_ui/src/project_diff.rs @@ -6,35 +6,35 @@ use anyhow::Result; use buffer_diff::{BufferDiff, DiffHunkSecondaryStatus}; use collections::HashSet; use editor::{ + Editor, EditorEvent, actions::{GoToHunk, GoToPreviousHunk}, scroll::Autoscroll, - Editor, EditorEvent, }; use futures::StreamExt; use git::{ + Commit, StageAll, StageAndNext, ToggleStaged, UnstageAll, UnstageAndNext, repository::{Branch, Upstream, UpstreamTracking, UpstreamTrackingStatus}, status::FileStatus, - Commit, StageAll, StageAndNext, ToggleStaged, UnstageAll, UnstageAndNext, }; use gpui::{ - actions, Action, AnyElement, AnyView, App, AppContext as _, AsyncWindowContext, Entity, - EventEmitter, FocusHandle, Focusable, Render, Subscription, Task, WeakEntity, + Action, AnyElement, AnyView, App, AppContext as _, AsyncWindowContext, Entity, EventEmitter, + FocusHandle, Focusable, Render, Subscription, Task, WeakEntity, actions, }; use language::{Anchor, Buffer, Capability, OffsetRangeExt}; use multi_buffer::{MultiBuffer, PathKey}; use project::{ - git_store::{GitEvent, GitStore}, Project, ProjectPath, + git_store::{GitEvent, GitStore}, }; use std::any::{Any, TypeId}; use theme::ActiveTheme; -use ui::{prelude::*, vertical_divider, KeyBinding, Tooltip}; +use ui::{KeyBinding, Tooltip, prelude::*, vertical_divider}; use util::ResultExt as _; use workspace::{ - item::{BreadcrumbText, Item, ItemEvent, ItemHandle, TabContentParams}, - searchable::SearchableItemHandle, CloseActiveItem, ItemNavHistory, SerializableItem, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, + item::{BreadcrumbText, Item, ItemEvent, ItemHandle, TabContentParams}, + searchable::SearchableItemHandle, }; actions!(git, [Diff, Add]); @@ -1249,41 +1249,43 @@ mod preview { v_flex() .gap_6() - .children(vec![example_group(vec![ - single_example( - "No Repo", - div() - .w(width) - .h(height) - .child(no_repo_state) - .into_any_element(), - ), - single_example( - "No Changes", - div() - .w(width) - .h(height) - .child(no_changes_state) - .into_any_element(), - ), - single_example( - "Unknown Upstream", - div() - .w(width) - .h(height) - .child(unknown_upstream_state) - .into_any_element(), - ), - single_example( - "Ahead of Remote", - div() - .w(width) - .h(height) - .child(ahead_of_upstream_state) - .into_any_element(), - ), + .children(vec![ + example_group(vec![ + single_example( + "No Repo", + div() + .w(width) + .h(height) + .child(no_repo_state) + .into_any_element(), + ), + single_example( + "No Changes", + div() + .w(width) + .h(height) + .child(no_changes_state) + .into_any_element(), + ), + single_example( + "Unknown Upstream", + div() + .w(width) + .h(height) + .child(unknown_upstream_state) + .into_any_element(), + ), + single_example( + "Ahead of Remote", + div() + .w(width) + .h(height) + .child(ahead_of_upstream_state) + .into_any_element(), + ), + ]) + .vertical(), ]) - .vertical()]) .into_any_element() } } @@ -1293,7 +1295,7 @@ mod preview { #[cfg(test)] mod tests { use db::indoc; - use editor::test::editor_test_context::{assert_state_with_diff, EditorTestContext}; + use editor::test::editor_test_context::{EditorTestContext, assert_state_with_diff}; use gpui::TestAppContext; use project::FakeFs; use serde_json::json; diff --git a/crates/git_ui/src/repository_selector.rs b/crates/git_ui/src/repository_selector.rs index 1608b6dad8..322e623e60 100644 --- a/crates/git_ui/src/repository_selector.rs +++ b/crates/git_ui/src/repository_selector.rs @@ -3,9 +3,9 @@ use gpui::{ }; use itertools::Itertools; use picker::{Picker, PickerDelegate}; -use project::{git_store::Repository, Project}; +use project::{Project, git_store::Repository}; use std::sync::Arc; -use ui::{prelude::*, ListItem, ListItemSpacing}; +use ui::{ListItem, ListItemSpacing, prelude::*}; use workspace::{ModalView, Workspace}; pub fn register(workspace: &mut Workspace) { diff --git a/crates/go_to_line/src/cursor_position.rs b/crates/go_to_line/src/cursor_position.rs index 6910926de8..0314126a80 100644 --- a/crates/go_to_line/src/cursor_position.rs +++ b/crates/go_to_line/src/cursor_position.rs @@ -6,11 +6,11 @@ use settings::{Settings, SettingsSources}; use std::{fmt::Write, num::NonZeroU32, time::Duration}; use text::{Point, Selection}; use ui::{ - div, Button, ButtonCommon, Clickable, Context, FluentBuilder, IntoElement, LabelSize, - ParentElement, Render, Tooltip, Window, + Button, ButtonCommon, Clickable, Context, FluentBuilder, IntoElement, LabelSize, ParentElement, + Render, Tooltip, Window, div, }; use util::paths::FILE_ROW_COLUMN_DELIMITER; -use workspace::{item::ItemHandle, StatusItemView, Workspace}; +use workspace::{StatusItemView, Workspace, item::ItemHandle}; #[derive(Copy, Clone, Debug, Default, PartialOrd, PartialEq)] pub(crate) struct SelectionStats { diff --git a/crates/go_to_line/src/go_to_line.rs b/crates/go_to_line/src/go_to_line.rs index 8a6294ab88..83aaf5d861 100644 --- a/crates/go_to_line/src/go_to_line.rs +++ b/crates/go_to_line/src/go_to_line.rs @@ -2,11 +2,11 @@ pub mod cursor_position; use cursor_position::{LineIndicatorFormat, UserCaretPosition}; use editor::{ - actions::Tab, scroll::Autoscroll, Anchor, Editor, MultiBufferSnapshot, ToOffset, ToPoint, + Anchor, Editor, MultiBufferSnapshot, ToOffset, ToPoint, actions::Tab, scroll::Autoscroll, }; use gpui::{ - div, prelude::*, App, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Render, - SharedString, Styled, Subscription, + App, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Render, SharedString, Styled, + Subscription, div, prelude::*, }; use language::Buffer; use settings::Settings; diff --git a/crates/google_ai/src/google_ai.rs b/crates/google_ai/src/google_ai.rs index 05f8d4345c..8d4f97dcc4 100644 --- a/crates/google_ai/src/google_ai.rs +++ b/crates/google_ai/src/google_ai.rs @@ -1,7 +1,7 @@ mod supported_countries; -use anyhow::{anyhow, bail, Result}; -use futures::{io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, Stream, StreamExt}; +use anyhow::{Result, anyhow, bail}; +use futures::{AsyncBufReadExt, AsyncReadExt, Stream, StreamExt, io::BufReader, stream::BoxStream}; use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest}; use serde::{Deserialize, Serialize}; diff --git a/crates/gpui/examples/animation.rs b/crates/gpui/examples/animation.rs index 6e7db7b7bf..6bfe75dd0a 100644 --- a/crates/gpui/examples/animation.rs +++ b/crates/gpui/examples/animation.rs @@ -2,9 +2,9 @@ use std::time::Duration; use anyhow::Result; use gpui::{ - black, bounce, div, ease_in_out, percentage, prelude::*, px, rgb, size, svg, Animation, - AnimationExt as _, App, Application, AssetSource, Bounds, Context, SharedString, - Transformation, Window, WindowBounds, WindowOptions, + Animation, AnimationExt as _, App, Application, AssetSource, Bounds, Context, SharedString, + Transformation, Window, WindowBounds, WindowOptions, black, bounce, div, ease_in_out, + percentage, prelude::*, px, rgb, size, svg, }; struct Assets {} diff --git a/crates/gpui/examples/data_table.rs b/crates/gpui/examples/data_table.rs index 1341915ce0..3f3286680b 100644 --- a/crates/gpui/examples/data_table.rs +++ b/crates/gpui/examples/data_table.rs @@ -5,9 +5,9 @@ use std::{ }; use gpui::{ - canvas, div, point, prelude::*, px, rgb, size, uniform_list, App, Application, Bounds, Context, - MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, Render, SharedString, - UniformListScrollHandle, Window, WindowBounds, WindowOptions, + App, Application, Bounds, Context, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, + Render, SharedString, UniformListScrollHandle, Window, WindowBounds, WindowOptions, canvas, + div, point, prelude::*, px, rgb, size, uniform_list, }; const TOTAL_ITEMS: usize = 10000; diff --git a/crates/gpui/examples/gif_viewer.rs b/crates/gpui/examples/gif_viewer.rs index 79e618fa55..3206a2fb7a 100644 --- a/crates/gpui/examples/gif_viewer.rs +++ b/crates/gpui/examples/gif_viewer.rs @@ -1,4 +1,4 @@ -use gpui::{div, img, prelude::*, App, Application, Context, Render, Window, WindowOptions}; +use gpui::{App, Application, Context, Render, Window, WindowOptions, div, img, prelude::*}; use std::path::PathBuf; struct GifViewer { diff --git a/crates/gpui/examples/gradient.rs b/crates/gpui/examples/gradient.rs index ec4cdf9bfc..4a84d2319d 100644 --- a/crates/gpui/examples/gradient.rs +++ b/crates/gpui/examples/gradient.rs @@ -1,6 +1,6 @@ use gpui::{ - canvas, div, linear_color_stop, linear_gradient, point, prelude::*, px, size, App, Application, - Bounds, ColorSpace, Context, Half, Render, Window, WindowOptions, + App, Application, Bounds, ColorSpace, Context, Half, Render, Window, WindowOptions, canvas, + div, linear_color_stop, linear_gradient, point, prelude::*, px, size, }; struct GradientViewer { diff --git a/crates/gpui/examples/hello_world.rs b/crates/gpui/examples/hello_world.rs index ca77eae70c..7011093474 100644 --- a/crates/gpui/examples/hello_world.rs +++ b/crates/gpui/examples/hello_world.rs @@ -1,6 +1,6 @@ use gpui::{ - div, prelude::*, px, rgb, size, App, Application, Bounds, Context, SharedString, Window, - WindowBounds, WindowOptions, + App, Application, Bounds, Context, SharedString, Window, WindowBounds, WindowOptions, div, + prelude::*, px, rgb, size, }; struct HelloWorld { diff --git a/crates/gpui/examples/image/image.rs b/crates/gpui/examples/image/image.rs index 0aa17ccede..bd1708e8c4 100644 --- a/crates/gpui/examples/image/image.rs +++ b/crates/gpui/examples/image/image.rs @@ -4,9 +4,9 @@ use std::sync::Arc; use anyhow::Result; use gpui::{ - actions, div, img, prelude::*, px, rgb, size, App, AppContext, Application, AssetSource, - Bounds, Context, ImageSource, KeyBinding, Menu, MenuItem, Point, SharedString, SharedUri, - TitlebarOptions, Window, WindowBounds, WindowOptions, + App, AppContext, Application, AssetSource, Bounds, Context, ImageSource, KeyBinding, Menu, + MenuItem, Point, SharedString, SharedUri, TitlebarOptions, Window, WindowBounds, WindowOptions, + actions, div, img, prelude::*, px, rgb, size, }; use reqwest_client::ReqwestClient; diff --git a/crates/gpui/examples/image_loading.rs b/crates/gpui/examples/image_loading.rs index 0ca27c07b4..8c86eaa0e4 100644 --- a/crates/gpui/examples/image_loading.rs +++ b/crates/gpui/examples/image_loading.rs @@ -2,10 +2,10 @@ use std::{path::Path, sync::Arc, time::Duration}; use anyhow::anyhow; use gpui::{ - black, div, img, prelude::*, pulsating_between, px, red, size, Animation, AnimationExt, App, - Application, Asset, AssetLogger, AssetSource, Bounds, Context, Hsla, ImageAssetLoader, - ImageCacheError, ImgResourceLoader, Length, Pixels, RenderImage, Resource, SharedString, - Window, WindowBounds, WindowOptions, LOADING_DELAY, + Animation, AnimationExt, App, Application, Asset, AssetLogger, AssetSource, Bounds, Context, + Hsla, ImageAssetLoader, ImageCacheError, ImgResourceLoader, LOADING_DELAY, Length, Pixels, + RenderImage, Resource, SharedString, Window, WindowBounds, WindowOptions, black, div, img, + prelude::*, pulsating_between, px, red, size, }; struct Assets {} diff --git a/crates/gpui/examples/input.rs b/crates/gpui/examples/input.rs index af2ec85003..7b280d7cae 100644 --- a/crates/gpui/examples/input.rs +++ b/crates/gpui/examples/input.rs @@ -1,12 +1,12 @@ use std::ops::Range; use gpui::{ - actions, black, div, fill, hsla, opaque_grey, point, prelude::*, px, relative, rgb, rgba, size, - white, yellow, App, Application, Bounds, ClipboardItem, Context, CursorStyle, ElementId, - ElementInputHandler, Entity, EntityInputHandler, FocusHandle, Focusable, GlobalElementId, - KeyBinding, Keystroke, LayoutId, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, - PaintQuad, Pixels, Point, ShapedLine, SharedString, Style, TextRun, UTF16Selection, - UnderlineStyle, Window, WindowBounds, WindowOptions, + App, Application, Bounds, ClipboardItem, Context, CursorStyle, ElementId, ElementInputHandler, + Entity, EntityInputHandler, FocusHandle, Focusable, GlobalElementId, KeyBinding, Keystroke, + LayoutId, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, PaintQuad, Pixels, Point, + ShapedLine, SharedString, Style, TextRun, UTF16Selection, UnderlineStyle, Window, WindowBounds, + WindowOptions, actions, black, div, fill, hsla, opaque_grey, point, prelude::*, px, relative, + rgb, rgba, size, white, yellow, }; use unicode_segmentation::*; diff --git a/crates/gpui/examples/on_window_close_quit.rs b/crates/gpui/examples/on_window_close_quit.rs index 9aaaeb6b77..8fe2400144 100644 --- a/crates/gpui/examples/on_window_close_quit.rs +++ b/crates/gpui/examples/on_window_close_quit.rs @@ -1,6 +1,6 @@ use gpui::{ - actions, div, prelude::*, px, rgb, size, App, Application, Bounds, Context, FocusHandle, - KeyBinding, Window, WindowBounds, WindowOptions, + App, Application, Bounds, Context, FocusHandle, KeyBinding, Window, WindowBounds, + WindowOptions, actions, div, prelude::*, px, rgb, size, }; actions!(example, [CloseWindow]); diff --git a/crates/gpui/examples/opacity.rs b/crates/gpui/examples/opacity.rs index 796ae08c5f..68e2a3fbd0 100644 --- a/crates/gpui/examples/opacity.rs +++ b/crates/gpui/examples/opacity.rs @@ -2,8 +2,9 @@ use std::{fs, path::PathBuf, time::Duration}; use anyhow::Result; use gpui::{ - div, hsla, img, point, prelude::*, px, rgb, size, svg, App, Application, AssetSource, Bounds, - BoxShadow, ClickEvent, Context, SharedString, Task, Timer, Window, WindowBounds, WindowOptions, + App, Application, AssetSource, Bounds, BoxShadow, ClickEvent, Context, SharedString, Task, + Timer, Window, WindowBounds, WindowOptions, div, hsla, img, point, prelude::*, px, rgb, size, + svg, }; struct Assets { @@ -50,23 +51,25 @@ impl HelloWorld { self.opacity = 0.0; cx.notify(); - self._task = Some(cx.spawn_in(window, async move |view, cx| loop { - Timer::after(Duration::from_secs_f32(0.05)).await; - let mut stop = false; - let _ = cx.update(|_, cx| { - view.update(cx, |view, cx| { - if view.opacity >= 1.0 { - stop = true; - return; - } + self._task = Some(cx.spawn_in(window, async move |view, cx| { + loop { + Timer::after(Duration::from_secs_f32(0.05)).await; + let mut stop = false; + let _ = cx.update(|_, cx| { + view.update(cx, |view, cx| { + if view.opacity >= 1.0 { + stop = true; + return; + } - view.opacity += 0.1; - cx.notify(); - }) - }); + view.opacity += 0.1; + cx.notify(); + }) + }); - if stop { - break; + if stop { + break; + } } })); } diff --git a/crates/gpui/examples/ownership_post.rs b/crates/gpui/examples/ownership_post.rs index cd1316ed9d..e690de54a8 100644 --- a/crates/gpui/examples/ownership_post.rs +++ b/crates/gpui/examples/ownership_post.rs @@ -1,4 +1,4 @@ -use gpui::{prelude::*, App, Application, Context, Entity, EventEmitter}; +use gpui::{App, Application, Context, Entity, EventEmitter, prelude::*}; struct Counter { count: usize, diff --git a/crates/gpui/examples/painting.rs b/crates/gpui/examples/painting.rs index 7c1a6a367d..bca9256bc5 100644 --- a/crates/gpui/examples/painting.rs +++ b/crates/gpui/examples/painting.rs @@ -1,7 +1,7 @@ use gpui::{ - canvas, div, linear_color_stop, linear_gradient, point, prelude::*, px, rgb, size, Application, - Background, Bounds, ColorSpace, Context, MouseDownEvent, Path, PathBuilder, PathStyle, Pixels, - Point, Render, StrokeOptions, Window, WindowOptions, + Application, Background, Bounds, ColorSpace, Context, MouseDownEvent, Path, PathBuilder, + PathStyle, Pixels, Point, Render, StrokeOptions, Window, WindowOptions, canvas, div, + linear_color_stop, linear_gradient, point, prelude::*, px, rgb, size, }; struct PaintingViewer { diff --git a/crates/gpui/examples/pattern.rs b/crates/gpui/examples/pattern.rs index 9b19af02be..8be6642fda 100644 --- a/crates/gpui/examples/pattern.rs +++ b/crates/gpui/examples/pattern.rs @@ -1,6 +1,6 @@ use gpui::{ - div, linear_color_stop, linear_gradient, pattern_slash, prelude::*, px, rgb, size, App, - AppContext, Application, Bounds, Context, Window, WindowBounds, WindowOptions, + App, AppContext, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, + linear_color_stop, linear_gradient, pattern_slash, prelude::*, px, rgb, size, }; struct PatternExample; diff --git a/crates/gpui/examples/set_menus.rs b/crates/gpui/examples/set_menus.rs index 2de8e87250..2b302f78f2 100644 --- a/crates/gpui/examples/set_menus.rs +++ b/crates/gpui/examples/set_menus.rs @@ -1,5 +1,5 @@ use gpui::{ - actions, div, prelude::*, rgb, App, Application, Context, Menu, MenuItem, Window, WindowOptions, + App, Application, Context, Menu, MenuItem, Window, WindowOptions, actions, div, prelude::*, rgb, }; struct SetMenus; diff --git a/crates/gpui/examples/shadow.rs b/crates/gpui/examples/shadow.rs index cfb8e6b4f1..4fa44ca623 100644 --- a/crates/gpui/examples/shadow.rs +++ b/crates/gpui/examples/shadow.rs @@ -1,6 +1,6 @@ use gpui::{ - div, hsla, point, prelude::*, px, relative, rgb, size, App, Application, Bounds, BoxShadow, - Context, Div, SharedString, Window, WindowBounds, WindowOptions, + App, Application, Bounds, BoxShadow, Context, Div, SharedString, Window, WindowBounds, + WindowOptions, div, hsla, point, prelude::*, px, relative, rgb, size, }; use smallvec::smallvec; diff --git a/crates/gpui/examples/svg/svg.rs b/crates/gpui/examples/svg/svg.rs index 62ce04e1ce..5d938998e8 100644 --- a/crates/gpui/examples/svg/svg.rs +++ b/crates/gpui/examples/svg/svg.rs @@ -3,8 +3,8 @@ use std::path::PathBuf; use anyhow::Result; use gpui::{ - div, prelude::*, px, rgb, size, svg, App, Application, AssetSource, Bounds, Context, - SharedString, Window, WindowBounds, WindowOptions, + App, Application, AssetSource, Bounds, Context, SharedString, Window, WindowBounds, + WindowOptions, div, prelude::*, px, rgb, size, svg, }; struct Assets { diff --git a/crates/gpui/examples/text_layout.rs b/crates/gpui/examples/text_layout.rs index 993a718528..c4cbcd4e5e 100644 --- a/crates/gpui/examples/text_layout.rs +++ b/crates/gpui/examples/text_layout.rs @@ -1,6 +1,6 @@ use gpui::{ - div, prelude::*, px, size, App, Application, Bounds, Context, Window, WindowBounds, - WindowOptions, + App, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px, + size, }; struct HelloWorld {} diff --git a/crates/gpui/examples/text_wrapper.rs b/crates/gpui/examples/text_wrapper.rs index 6753fc4ae9..dfc2456bc6 100644 --- a/crates/gpui/examples/text_wrapper.rs +++ b/crates/gpui/examples/text_wrapper.rs @@ -1,6 +1,6 @@ use gpui::{ - div, prelude::*, px, size, App, Application, Bounds, Context, TextOverflow, Window, - WindowBounds, WindowOptions, + App, Application, Bounds, Context, TextOverflow, Window, WindowBounds, WindowOptions, div, + prelude::*, px, size, }; struct HelloWorld {} diff --git a/crates/gpui/examples/uniform_list.rs b/crates/gpui/examples/uniform_list.rs index 00a98182c3..221de44bd9 100644 --- a/crates/gpui/examples/uniform_list.rs +++ b/crates/gpui/examples/uniform_list.rs @@ -1,6 +1,6 @@ use gpui::{ - div, prelude::*, px, rgb, size, uniform_list, App, Application, Bounds, Context, Window, - WindowBounds, WindowOptions, + App, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px, + rgb, size, uniform_list, }; struct UniformListExample {} diff --git a/crates/gpui/examples/window.rs b/crates/gpui/examples/window.rs index c3aa344362..a513118f01 100644 --- a/crates/gpui/examples/window.rs +++ b/crates/gpui/examples/window.rs @@ -1,6 +1,6 @@ use gpui::{ - div, prelude::*, px, rgb, size, App, Application, Bounds, Context, SharedString, Timer, Window, - WindowBounds, WindowKind, WindowOptions, + App, Application, Bounds, Context, SharedString, Timer, Window, WindowBounds, WindowKind, + WindowOptions, div, prelude::*, px, rgb, size, }; struct SubWindow { diff --git a/crates/gpui/examples/window_positioning.rs b/crates/gpui/examples/window_positioning.rs index 95cd787e27..0f0bb8ac28 100644 --- a/crates/gpui/examples/window_positioning.rs +++ b/crates/gpui/examples/window_positioning.rs @@ -1,7 +1,7 @@ use gpui::{ - div, point, prelude::*, px, rgb, App, Application, Bounds, Context, DisplayId, Hsla, Pixels, - SharedString, Size, Window, WindowBackgroundAppearance, WindowBounds, WindowKind, - WindowOptions, + App, Application, Bounds, Context, DisplayId, Hsla, Pixels, SharedString, Size, Window, + WindowBackgroundAppearance, WindowBounds, WindowKind, WindowOptions, div, point, prelude::*, + px, rgb, }; struct WindowContent { diff --git a/crates/gpui/examples/window_shadow.rs b/crates/gpui/examples/window_shadow.rs index 0d787680f3..3c9849ebdd 100644 --- a/crates/gpui/examples/window_shadow.rs +++ b/crates/gpui/examples/window_shadow.rs @@ -1,8 +1,8 @@ use gpui::{ - black, canvas, div, green, point, prelude::*, px, rgb, size, transparent_black, white, App, - Application, Bounds, Context, CursorStyle, Decorations, Hsla, MouseButton, Pixels, Point, + App, Application, Bounds, Context, CursorStyle, Decorations, Hsla, MouseButton, Pixels, Point, ResizeEdge, Size, Window, WindowBackgroundAppearance, WindowBounds, WindowDecorations, - WindowOptions, + WindowOptions, black, canvas, div, green, point, prelude::*, px, rgb, size, transparent_black, + white, }; struct WindowShadow {} diff --git a/crates/gpui/src/action.rs b/crates/gpui/src/action.rs index be7ec6d96a..783b7d47e4 100644 --- a/crates/gpui/src/action.rs +++ b/crates/gpui/src/action.rs @@ -1,7 +1,7 @@ use crate::SharedString; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::HashMap; -pub use no_action::{is_no_action, NoAction}; +pub use no_action::{NoAction, is_no_action}; use serde_json::json; use std::{ any::{Any, TypeId}, diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 380692a886..95d16c0dfe 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -1,21 +1,21 @@ use std::{ - any::{type_name, TypeId}, + any::{TypeId, type_name}, cell::{Ref, RefCell, RefMut}, marker::PhantomData, mem, ops::{Deref, DerefMut}, path::{Path, PathBuf}, rc::{Rc, Weak}, - sync::{atomic::Ordering::SeqCst, Arc}, + sync::{Arc, atomic::Ordering::SeqCst}, time::Duration, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use derive_more::{Deref, DerefMut}; use futures::{ + Future, FutureExt, channel::oneshot, future::{LocalBoxFuture, Shared}, - Future, FutureExt, }; use parking_lot::RwLock; use slotmap::SlotMap; @@ -30,14 +30,14 @@ pub use test_context::*; use util::ResultExt; use crate::{ - current_platform, hash, init_app_menus, Action, ActionBuildError, ActionRegistry, Any, AnyView, - AnyWindowHandle, AppContext, Asset, AssetSource, BackgroundExecutor, Bounds, ClipboardItem, - DispatchPhase, DisplayId, EventEmitter, FocusHandle, FocusMap, ForegroundExecutor, Global, - KeyBinding, Keymap, Keystroke, LayoutId, Menu, MenuItem, OwnedMenu, PathPromptOptions, Pixels, - Platform, PlatformDisplay, Point, PromptBuilder, PromptHandle, PromptLevel, Render, - RenderablePromptHandle, Reservation, ScreenCaptureSource, SharedString, SubscriberSet, - Subscription, SvgRenderer, Task, TextSystem, Window, WindowAppearance, WindowHandle, WindowId, - WindowInvalidator, + Action, ActionBuildError, ActionRegistry, Any, AnyView, AnyWindowHandle, AppContext, Asset, + AssetSource, BackgroundExecutor, Bounds, ClipboardItem, DispatchPhase, DisplayId, EventEmitter, + FocusHandle, FocusMap, ForegroundExecutor, Global, KeyBinding, Keymap, Keystroke, LayoutId, + Menu, MenuItem, OwnedMenu, PathPromptOptions, Pixels, Platform, PlatformDisplay, Point, + PromptBuilder, PromptHandle, PromptLevel, Render, RenderablePromptHandle, Reservation, + ScreenCaptureSource, SharedString, SubscriberSet, Subscription, SvgRenderer, Task, TextSystem, + Window, WindowAppearance, WindowHandle, WindowId, WindowInvalidator, current_platform, hash, + init_app_menus, }; mod async_context; @@ -1513,15 +1513,15 @@ impl App { pub fn set_prompt_builder( &mut self, renderer: impl Fn( - PromptLevel, - &str, - Option<&str>, - &[&str], - PromptHandle, - &mut Window, - &mut App, - ) -> RenderablePromptHandle - + 'static, + PromptLevel, + &str, + Option<&str>, + &[&str], + PromptHandle, + &mut Window, + &mut App, + ) -> RenderablePromptHandle + + 'static, ) { self.prompt_builder = Some(PromptBuilder::Custom(Box::new(renderer))) } diff --git a/crates/gpui/src/app/async_context.rs b/crates/gpui/src/app/async_context.rs index 2a0f7e47c9..c20a5b9066 100644 --- a/crates/gpui/src/app/async_context.rs +++ b/crates/gpui/src/app/async_context.rs @@ -3,7 +3,7 @@ use crate::{ Entity, Focusable, ForegroundExecutor, Global, PromptLevel, Render, Reservation, Result, Task, VisualContext, Window, WindowHandle, }; -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use derive_more::{Deref, DerefMut}; use futures::channel::oneshot; use std::{future::Future, rc::Weak}; diff --git a/crates/gpui/src/app/entity_map.rs b/crates/gpui/src/app/entity_map.rs index 9959ddcc05..ebcf95dbbb 100644 --- a/crates/gpui/src/app/entity_map.rs +++ b/crates/gpui/src/app/entity_map.rs @@ -1,11 +1,11 @@ -use crate::{seal::Sealed, App, AppContext, VisualContext, Window}; -use anyhow::{anyhow, Result}; +use crate::{App, AppContext, VisualContext, Window, seal::Sealed}; +use anyhow::{Result, anyhow}; use collections::FxHashSet; use derive_more::{Deref, DerefMut}; use parking_lot::{RwLock, RwLockUpgradableReadGuard}; use slotmap::{KeyData, SecondaryMap, SlotMap}; use std::{ - any::{type_name, Any, TypeId}, + any::{Any, TypeId, type_name}, cell::RefCell, cmp::Ordering, fmt::{self, Display}, @@ -14,8 +14,8 @@ use std::{ mem, num::NonZeroU64, sync::{ - atomic::{AtomicUsize, Ordering::SeqCst}, Arc, Weak, + atomic::{AtomicUsize, Ordering::SeqCst}, }, thread::panicking, }; diff --git a/crates/gpui/src/app/test_context.rs b/crates/gpui/src/app/test_context.rs index e84a056ff9..e639da7654 100644 --- a/crates/gpui/src/app/test_context.rs +++ b/crates/gpui/src/app/test_context.rs @@ -8,7 +8,7 @@ use crate::{ WindowHandle, WindowOptions, }; use anyhow::{anyhow, bail}; -use futures::{channel::oneshot, Stream, StreamExt}; +use futures::{Stream, StreamExt, channel::oneshot}; use std::{cell::RefCell, future::Future, ops::Deref, rc::Rc, sync::Arc, time::Duration}; /// A TestAppContext is provided to tests created with `#[gpui::test]`, it provides diff --git a/crates/gpui/src/assets.rs b/crates/gpui/src/assets.rs index 99696481f3..70a07c11e9 100644 --- a/crates/gpui/src/assets.rs +++ b/crates/gpui/src/assets.rs @@ -1,4 +1,4 @@ -use crate::{size, DevicePixels, Result, SharedString, Size}; +use crate::{DevicePixels, Result, SharedString, Size, size}; use smallvec::SmallVec; use image::{Delay, Frame}; diff --git a/crates/gpui/src/color.rs b/crates/gpui/src/color.rs index 891c42c5c2..c40fcd2828 100644 --- a/crates/gpui/src/color.rs +++ b/crates/gpui/src/color.rs @@ -1,4 +1,4 @@ -use anyhow::{bail, Context}; +use anyhow::{Context, bail}; use serde::de::{self, Deserialize, Deserializer, Visitor}; use std::{ fmt::{self, Display, Formatter}, diff --git a/crates/gpui/src/element.rs b/crates/gpui/src/element.rs index 6af0474ad5..26c8c7a849 100644 --- a/crates/gpui/src/element.rs +++ b/crates/gpui/src/element.rs @@ -32,8 +32,8 @@ //! your own custom layout algorithm or rendering a code editor. use crate::{ - util::FluentBuilder, App, ArenaBox, AvailableSpace, Bounds, Context, DispatchNodeId, ElementId, - FocusHandle, LayoutId, Pixels, Point, Size, Style, Window, ELEMENT_ARENA, + App, ArenaBox, AvailableSpace, Bounds, Context, DispatchNodeId, ELEMENT_ARENA, ElementId, + FocusHandle, LayoutId, Pixels, Point, Size, Style, Window, util::FluentBuilder, }; use derive_more::{Deref, DerefMut}; pub(crate) use smallvec::SmallVec; diff --git a/crates/gpui/src/elements/anchored.rs b/crates/gpui/src/elements/anchored.rs index b6ab196f83..2e33f138b9 100644 --- a/crates/gpui/src/elements/anchored.rs +++ b/crates/gpui/src/elements/anchored.rs @@ -2,8 +2,8 @@ use smallvec::SmallVec; use taffy::style::{Display, Position}; use crate::{ - point, AnyElement, App, Axis, Bounds, Corner, Edges, Element, GlobalElementId, IntoElement, - LayoutId, ParentElement, Pixels, Point, Size, Style, Window, + AnyElement, App, Axis, Bounds, Corner, Edges, Element, GlobalElementId, IntoElement, LayoutId, + ParentElement, Pixels, Point, Size, Style, Window, point, }; /// The state that the anchored element element uses to track its children. diff --git a/crates/gpui/src/elements/common.rs b/crates/gpui/src/elements/common.rs index 42d6882cd5..5ac0d3a022 100644 --- a/crates/gpui/src/elements/common.rs +++ b/crates/gpui/src/elements/common.rs @@ -1,4 +1,4 @@ -use crate::{rgb, Hsla, Rgba, WindowAppearance}; +use crate::{Hsla, Rgba, WindowAppearance, rgb}; /// The appearance of the base GPUI colors, used to style GPUI elements /// diff --git a/crates/gpui/src/elements/div.rs b/crates/gpui/src/elements/div.rs index 0ef76732fb..3b3dd4cbdc 100644 --- a/crates/gpui/src/elements/div.rs +++ b/crates/gpui/src/elements/div.rs @@ -16,12 +16,12 @@ //! constructed by combining these two systems into an all-in-one element. use crate::{ - point, px, size, Action, AnyDrag, AnyElement, AnyTooltip, AnyView, App, Bounds, ClickEvent, - DispatchPhase, Element, ElementId, Entity, FocusHandle, Global, GlobalElementId, Hitbox, - HitboxId, IntoElement, IsZero, KeyContext, KeyDownEvent, KeyUpEvent, LayoutId, - ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, - ParentElement, Pixels, Point, Render, ScrollWheelEvent, SharedString, Size, Style, - StyleRefinement, Styled, Task, TooltipId, Visibility, Window, + Action, AnyDrag, AnyElement, AnyTooltip, AnyView, App, Bounds, ClickEvent, DispatchPhase, + Element, ElementId, Entity, FocusHandle, Global, GlobalElementId, Hitbox, HitboxId, + IntoElement, IsZero, KeyContext, KeyDownEvent, KeyUpEvent, LayoutId, ModifiersChangedEvent, + MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement, Pixels, Point, + Render, ScrollWheelEvent, SharedString, Size, Style, StyleRefinement, Styled, Task, TooltipId, + Visibility, Window, point, px, size, }; use collections::HashMap; use refineable::Refineable; diff --git a/crates/gpui/src/elements/img.rs b/crates/gpui/src/elements/img.rs index 276d9ac938..19309cd038 100644 --- a/crates/gpui/src/elements/img.rs +++ b/crates/gpui/src/elements/img.rs @@ -1,16 +1,16 @@ use crate::{ - px, swap_rgba_pa_to_bgra, AbsoluteLength, AnyElement, App, Asset, AssetLogger, Bounds, - DefiniteLength, Element, ElementId, GlobalElementId, Hitbox, Image, InteractiveElement, - Interactivity, IntoElement, LayoutId, Length, ObjectFit, Pixels, RenderImage, Resource, - SharedString, SharedUri, StyleRefinement, Styled, SvgSize, Task, Window, - SMOOTH_SVG_SCALE_FACTOR, + AbsoluteLength, AnyElement, App, Asset, AssetLogger, Bounds, DefiniteLength, Element, + ElementId, GlobalElementId, Hitbox, Image, InteractiveElement, Interactivity, IntoElement, + LayoutId, Length, ObjectFit, Pixels, RenderImage, Resource, SMOOTH_SVG_SCALE_FACTOR, + SharedString, SharedUri, StyleRefinement, Styled, SvgSize, Task, Window, px, + swap_rgba_pa_to_bgra, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use futures::{AsyncReadExt, Future}; use image::{ - codecs::{gif::GifDecoder, webp::WebPDecoder}, AnimationDecoder, DynamicImage, Frame, ImageBuffer, ImageError, ImageFormat, Rgba, + codecs::{gif::GifDecoder, webp::WebPDecoder}, }; use smallvec::SmallVec; use std::{ diff --git a/crates/gpui/src/elements/list.rs b/crates/gpui/src/elements/list.rs index 5f4b9d8b0d..af522b0c7f 100644 --- a/crates/gpui/src/elements/list.rs +++ b/crates/gpui/src/elements/list.rs @@ -8,9 +8,9 @@ //! If all of your elements are the same height, see [`UniformList`] for a simpler API use crate::{ - point, px, size, AnyElement, App, AvailableSpace, Bounds, ContentMask, DispatchPhase, Edges, - Element, EntityId, FocusHandle, GlobalElementId, Hitbox, IntoElement, Pixels, Point, - ScrollWheelEvent, Size, Style, StyleRefinement, Styled, Window, + AnyElement, App, AvailableSpace, Bounds, ContentMask, DispatchPhase, Edges, Element, EntityId, + FocusHandle, GlobalElementId, Hitbox, IntoElement, Pixels, Point, ScrollWheelEvent, Size, + Style, StyleRefinement, Styled, Window, point, px, size, }; use collections::VecDeque; use refineable::Refineable as _; @@ -349,7 +349,7 @@ impl ListState { let mut cursor = state.items.cursor::<(Count, Height)>(&()); cursor.seek(&Count(scroll_top.item_ix), Bias::Right, &()); - let scroll_top = cursor.start().1 .0 + scroll_top.offset_in_item; + let scroll_top = cursor.start().1.0 + scroll_top.offset_in_item; cursor.seek_forward(&Count(ix), Bias::Right, &()); if let Some(&ListItem::Measured { size, .. }) = cursor.item() { @@ -1067,8 +1067,8 @@ mod test { #[gpui::test] fn test_reset_after_paint_before_scroll(cx: &mut TestAppContext) { use crate::{ - div, list, point, px, size, AppContext, Context, Element, IntoElement, ListState, - Render, Styled, Window, + AppContext, Context, Element, IntoElement, ListState, Render, Styled, Window, div, + list, point, px, size, }; let cx = cx.add_empty_window(); diff --git a/crates/gpui/src/elements/svg.rs b/crates/gpui/src/elements/svg.rs index c5997bb340..abb75156bd 100644 --- a/crates/gpui/src/elements/svg.rs +++ b/crates/gpui/src/elements/svg.rs @@ -1,7 +1,7 @@ use crate::{ - geometry::Negate as _, point, px, radians, size, App, Bounds, Element, GlobalElementId, Hitbox, - InteractiveElement, Interactivity, IntoElement, LayoutId, Pixels, Point, Radians, SharedString, - Size, StyleRefinement, Styled, TransformationMatrix, Window, + App, Bounds, Element, GlobalElementId, Hitbox, InteractiveElement, Interactivity, IntoElement, + LayoutId, Pixels, Point, Radians, SharedString, Size, StyleRefinement, Styled, + TransformationMatrix, Window, geometry::Negate as _, point, px, radians, size, }; use util::ResultExt; diff --git a/crates/gpui/src/elements/text.rs b/crates/gpui/src/elements/text.rs index 45a092edf0..cd6cf033db 100644 --- a/crates/gpui/src/elements/text.rs +++ b/crates/gpui/src/elements/text.rs @@ -1,9 +1,8 @@ use crate::{ - register_tooltip_mouse_handlers, set_tooltip_on_window, ActiveTooltip, AnyView, App, Bounds, - DispatchPhase, Element, ElementId, GlobalElementId, HighlightStyle, Hitbox, IntoElement, - LayoutId, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, SharedString, Size, - TextOverflow, TextRun, TextStyle, TooltipId, WhiteSpace, Window, WrappedLine, - WrappedLineLayout, + ActiveTooltip, AnyView, App, Bounds, DispatchPhase, Element, ElementId, GlobalElementId, + HighlightStyle, Hitbox, IntoElement, LayoutId, MouseDownEvent, MouseMoveEvent, MouseUpEvent, + Pixels, Point, SharedString, Size, TextOverflow, TextRun, TextStyle, TooltipId, WhiteSpace, + Window, WrappedLine, WrappedLineLayout, register_tooltip_mouse_handlers, set_tooltip_on_window, }; use anyhow::anyhow; use smallvec::SmallVec; diff --git a/crates/gpui/src/elements/uniform_list.rs b/crates/gpui/src/elements/uniform_list.rs index baf3d77c0e..8de7abf0cf 100644 --- a/crates/gpui/src/elements/uniform_list.rs +++ b/crates/gpui/src/elements/uniform_list.rs @@ -5,10 +5,10 @@ //! elements with uniform height. use crate::{ - point, size, AnyElement, App, AvailableSpace, Bounds, ContentMask, Context, Element, ElementId, - Entity, GlobalElementId, Hitbox, InteractiveElement, Interactivity, IntoElement, IsZero, - LayoutId, ListSizingBehavior, Pixels, Render, ScrollHandle, Size, StyleRefinement, Styled, - Window, + AnyElement, App, AvailableSpace, Bounds, ContentMask, Context, Element, ElementId, Entity, + GlobalElementId, Hitbox, InteractiveElement, Interactivity, IntoElement, IsZero, LayoutId, + ListSizingBehavior, Pixels, Render, ScrollHandle, Size, StyleRefinement, Styled, Window, point, + size, }; use smallvec::SmallVec; use std::{cell::RefCell, cmp, ops::Range, rc::Rc}; diff --git a/crates/gpui/src/executor.rs b/crates/gpui/src/executor.rs index 388180fd9e..affca7b1b4 100644 --- a/crates/gpui/src/executor.rs +++ b/crates/gpui/src/executor.rs @@ -13,8 +13,8 @@ use std::{ pin::Pin, rc::Rc, sync::{ - atomic::{AtomicUsize, Ordering::SeqCst}, Arc, + atomic::{AtomicUsize, Ordering::SeqCst}, }, task::{Context, Poll}, time::{Duration, Instant}, diff --git a/crates/gpui/src/gpui.rs b/crates/gpui/src/gpui.rs index 34b9f09d8e..4e6bda1977 100644 --- a/crates/gpui/src/gpui.rs +++ b/crates/gpui/src/gpui.rs @@ -130,7 +130,7 @@ pub use elements::*; pub use executor::*; pub use geometry::*; pub use global::*; -pub use gpui_macros::{register_action, test, AppContext, IntoElement, Render, VisualContext}; +pub use gpui_macros::{AppContext, IntoElement, Render, VisualContext, register_action, test}; pub use http_client; pub use input::*; pub use interactive::*; diff --git a/crates/gpui/src/interactive.rs b/crates/gpui/src/interactive.rs index f1f6e60e7f..c6eab26186 100644 --- a/crates/gpui/src/interactive.rs +++ b/crates/gpui/src/interactive.rs @@ -1,6 +1,6 @@ use crate::{ - point, seal::Sealed, Context, Empty, IntoElement, Keystroke, Modifiers, Pixels, Point, Render, - Window, + Context, Empty, IntoElement, Keystroke, Modifiers, Pixels, Point, Render, Window, point, + seal::Sealed, }; use smallvec::SmallVec; use std::{any::Any, fmt::Debug, ops::Deref, path::PathBuf}; @@ -481,8 +481,8 @@ impl PlatformInput { mod test { use crate::{ - self as gpui, div, AppContext as _, Context, FocusHandle, InteractiveElement, IntoElement, - KeyBinding, Keystroke, ParentElement, Render, TestAppContext, Window, + self as gpui, AppContext as _, Context, FocusHandle, InteractiveElement, IntoElement, + KeyBinding, Keystroke, ParentElement, Render, TestAppContext, Window, div, }; struct TestView { diff --git a/crates/gpui/src/keymap.rs b/crates/gpui/src/keymap.rs index 49bdb54cfb..4f2b57fc52 100644 --- a/crates/gpui/src/keymap.rs +++ b/crates/gpui/src/keymap.rs @@ -4,7 +4,7 @@ mod context; pub use binding::*; pub use context::*; -use crate::{is_no_action, Action, Keystroke}; +use crate::{Action, Keystroke, is_no_action}; use collections::HashMap; use smallvec::SmallVec; use std::any::TypeId; @@ -219,7 +219,7 @@ impl Keymap { mod tests { use super::*; use crate as gpui; - use gpui::{actions, NoAction}; + use gpui::{NoAction, actions}; actions!( keymap_test, @@ -265,38 +265,46 @@ mod tests { keymap.add_bindings(bindings.clone()); // binding is only enabled in a specific context - assert!(keymap - .bindings_for_input( - &[Keystroke::parse("ctrl-a").unwrap()], - &[KeyContext::parse("barf").unwrap()], - ) - .0 - .is_empty()); - assert!(!keymap - .bindings_for_input( - &[Keystroke::parse("ctrl-a").unwrap()], - &[KeyContext::parse("editor").unwrap()], - ) - .0 - .is_empty()); + assert!( + keymap + .bindings_for_input( + &[Keystroke::parse("ctrl-a").unwrap()], + &[KeyContext::parse("barf").unwrap()], + ) + .0 + .is_empty() + ); + assert!( + !keymap + .bindings_for_input( + &[Keystroke::parse("ctrl-a").unwrap()], + &[KeyContext::parse("editor").unwrap()], + ) + .0 + .is_empty() + ); // binding is disabled in a more specific context - assert!(keymap - .bindings_for_input( - &[Keystroke::parse("ctrl-a").unwrap()], - &[KeyContext::parse("editor mode=full").unwrap()], - ) - .0 - .is_empty()); + assert!( + keymap + .bindings_for_input( + &[Keystroke::parse("ctrl-a").unwrap()], + &[KeyContext::parse("editor mode=full").unwrap()], + ) + .0 + .is_empty() + ); // binding is globally disabled - assert!(keymap - .bindings_for_input( - &[Keystroke::parse("ctrl-b").unwrap()], - &[KeyContext::parse("barf").unwrap()], - ) - .0 - .is_empty()); + assert!( + keymap + .bindings_for_input( + &[Keystroke::parse("ctrl-b").unwrap()], + &[KeyContext::parse("barf").unwrap()], + ) + .0 + .is_empty() + ); } #[test] diff --git a/crates/gpui/src/keymap/context.rs b/crates/gpui/src/keymap/context.rs index 3bee2de411..1732145d48 100644 --- a/crates/gpui/src/keymap/context.rs +++ b/crates/gpui/src/keymap/context.rs @@ -1,5 +1,5 @@ use crate::SharedString; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use std::fmt; /// A datastructure for resolving whether an action should be dispatched diff --git a/crates/gpui/src/path_builder.rs b/crates/gpui/src/path_builder.rs index 0fd8eb6fa5..982b858676 100644 --- a/crates/gpui/src/path_builder.rs +++ b/crates/gpui/src/path_builder.rs @@ -8,7 +8,7 @@ use lyon::tessellation::{ pub use lyon::math::Transform; pub use lyon::tessellation::{FillOptions, FillRule, StrokeOptions}; -use crate::{point, px, Path, Pixels, Point}; +use crate::{Path, Pixels, Point, point, px}; /// Style of the PathBuilder pub enum PathStyle { diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index d6c62dae8b..fdd4974be3 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -27,13 +27,13 @@ mod test; mod windows; use crate::{ - point, Action, AnyWindowHandle, App, AsyncWindowContext, BackgroundExecutor, Bounds, - DevicePixels, DispatchEventResult, Font, FontId, FontMetrics, FontRun, ForegroundExecutor, - GlyphId, GpuSpecs, ImageSource, Keymap, LineLayout, Pixels, PlatformInput, Point, - RenderGlyphParams, RenderImage, RenderImageParams, RenderSvgParams, ScaledPixels, Scene, - SharedString, Size, SvgRenderer, SvgSize, Task, TaskLabel, Window, DEFAULT_WINDOW_SIZE, + Action, AnyWindowHandle, App, AsyncWindowContext, BackgroundExecutor, Bounds, + DEFAULT_WINDOW_SIZE, DevicePixels, DispatchEventResult, Font, FontId, FontMetrics, FontRun, + ForegroundExecutor, GlyphId, GpuSpecs, ImageSource, Keymap, LineLayout, Pixels, PlatformInput, + Point, RenderGlyphParams, RenderImage, RenderImageParams, RenderSvgParams, ScaledPixels, Scene, + SharedString, Size, SvgRenderer, SvgSize, Task, TaskLabel, Window, point, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_task::Runnable; use futures::channel::oneshot; use image::codecs::gif::GifDecoder; @@ -1307,11 +1307,7 @@ impl ClipboardItem { } } - if any_entries { - Some(answer) - } else { - None - } + if any_entries { Some(answer) } else { None } } /// If this item is one ClipboardEntry::String, returns its metadata. diff --git a/crates/gpui/src/platform/blade/blade_atlas.rs b/crates/gpui/src/platform/blade/blade_atlas.rs index 2783d57127..aaa6192dc3 100644 --- a/crates/gpui/src/platform/blade/blade_atlas.rs +++ b/crates/gpui/src/platform/blade/blade_atlas.rs @@ -1,6 +1,6 @@ use crate::{ - platform::AtlasTextureList, AtlasKey, AtlasTextureId, AtlasTextureKind, AtlasTile, Bounds, - DevicePixels, PlatformAtlas, Point, Size, + AtlasKey, AtlasTextureId, AtlasTextureKind, AtlasTile, Bounds, DevicePixels, PlatformAtlas, + Point, Size, platform::AtlasTextureList, }; use anyhow::Result; use blade_graphics as gpu; diff --git a/crates/gpui/src/platform/linux/dispatcher.rs b/crates/gpui/src/platform/linux/dispatcher.rs index 85526340b0..94269ea621 100644 --- a/crates/gpui/src/platform/linux/dispatcher.rs +++ b/crates/gpui/src/platform/linux/dispatcher.rs @@ -1,9 +1,9 @@ use crate::{PlatformDispatcher, TaskLabel}; use async_task::Runnable; use calloop::{ + EventLoop, channel::{self, Sender}, timer::TimeoutAction, - EventLoop, }; use parking::{Parker, Unparker}; use parking_lot::Mutex; diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs index 8b36743f6f..cbf5861df2 100644 --- a/crates/gpui/src/platform/linux/platform.rs +++ b/crates/gpui/src/platform/linux/platform.rs @@ -14,19 +14,19 @@ use std::{ time::Duration, }; -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use async_task::Runnable; -use calloop::{channel::Channel, LoopSignal}; +use calloop::{LoopSignal, channel::Channel}; use futures::channel::oneshot; use util::ResultExt as _; #[cfg(any(feature = "wayland", feature = "x11"))] use xkbcommon::xkb::{self, Keycode, Keysym, State}; use crate::{ - px, Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, DisplayId, + Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, DisplayId, ForegroundExecutor, Keymap, LinuxDispatcher, Menu, MenuItem, OwnedMenu, PathPromptOptions, Pixels, Platform, PlatformDisplay, PlatformTextSystem, PlatformWindow, Point, Result, - ScreenCaptureSource, Task, WindowAppearance, WindowParams, + ScreenCaptureSource, Task, WindowAppearance, WindowParams, px, }; #[cfg(any(feature = "wayland", feature = "x11"))] pub(crate) const SCROLL_LINES: f32 = 3.0; @@ -852,7 +852,7 @@ impl crate::Modifiers { #[cfg(test)] mod tests { use super::*; - use crate::{px, Point}; + use crate::{Point, px}; #[test] fn test_is_within_click_distance() { diff --git a/crates/gpui/src/platform/linux/text_system.rs b/crates/gpui/src/platform/linux/text_system.rs index 68ac89ce7c..1987954db5 100644 --- a/crates/gpui/src/platform/linux/text_system.rs +++ b/crates/gpui/src/platform/linux/text_system.rs @@ -1,9 +1,9 @@ use crate::{ - point, size, Bounds, DevicePixels, Font, FontFeatures, FontId, FontMetrics, FontRun, FontStyle, - FontWeight, GlyphId, LineLayout, Pixels, PlatformTextSystem, Point, RenderGlyphParams, - ShapedGlyph, SharedString, Size, SUBPIXEL_VARIANTS, + Bounds, DevicePixels, Font, FontFeatures, FontId, FontMetrics, FontRun, FontStyle, FontWeight, + GlyphId, LineLayout, Pixels, PlatformTextSystem, Point, RenderGlyphParams, SUBPIXEL_VARIANTS, + ShapedGlyph, SharedString, Size, point, size, }; -use anyhow::{anyhow, Context as _, Ok, Result}; +use anyhow::{Context as _, Ok, Result, anyhow}; use collections::HashMap; use cosmic_text::{ Attrs, AttrsList, CacheKey, Family, Font as CosmicTextFont, FontSystem, ShapeBuffer, ShapeLine, diff --git a/crates/gpui/src/platform/linux/wayland/client.rs b/crates/gpui/src/platform/linux/wayland/client.rs index 075edac55c..6906dc123e 100644 --- a/crates/gpui/src/platform/linux/wayland/client.rs +++ b/crates/gpui/src/platform/linux/wayland/client.rs @@ -8,8 +8,8 @@ use std::{ }; use calloop::{ - timer::{TimeoutAction, Timer}, EventLoop, LoopHandle, + timer::{TimeoutAction, Timer}, }; use calloop_wayland_source::WaylandSource; use collections::HashMap; @@ -21,7 +21,7 @@ use util::ResultExt; use wayland_backend::client::ObjectId; use wayland_backend::protocol::WEnum; use wayland_client::event_created_child; -use wayland_client::globals::{registry_queue_init, GlobalList, GlobalListContents}; +use wayland_client::globals::{GlobalList, GlobalListContents, registry_queue_init}; use wayland_client::protocol::wl_callback::{self, WlCallback}; use wayland_client::protocol::wl_data_device_manager::DndAction; use wayland_client::protocol::wl_data_offer::WlDataOffer; @@ -30,12 +30,11 @@ use wayland_client::protocol::{ wl_data_device, wl_data_device_manager, wl_data_offer, wl_data_source, wl_output, wl_region, }; use wayland_client::{ - delegate_noop, + Connection, Dispatch, Proxy, QueueHandle, delegate_noop, protocol::{ wl_buffer, wl_compositor, wl_keyboard, wl_pointer, wl_registry, wl_seat, wl_shm, wl_shm_pool, wl_surface, }, - Connection, Dispatch, Proxy, QueueHandle, }; use wayland_protocols::wp::cursor_shape::v1::client::{ wp_cursor_shape_device_v1, wp_cursor_shape_manager_v1, @@ -64,13 +63,13 @@ use wayland_protocols::xdg::decoration::zv1::client::{ use wayland_protocols::xdg::shell::client::{xdg_surface, xdg_toplevel, xdg_wm_base}; use wayland_protocols_plasma::blur::client::{org_kde_kwin_blur, org_kde_kwin_blur_manager}; use xkbcommon::xkb::ffi::XKB_KEYMAP_FORMAT_TEXT_V1; -use xkbcommon::xkb::{self, Keycode, KEYMAP_COMPILE_NO_FLAGS}; +use xkbcommon::xkb::{self, KEYMAP_COMPILE_NO_FLAGS, Keycode}; use super::display::WaylandDisplay; use super::window::{ImeInput, WaylandWindowStatePtr}; use crate::platform::linux::{ - get_xkb_compose_state, is_within_click_distance, open_uri_internal, read_fd, + LinuxClient, get_xkb_compose_state, is_within_click_distance, open_uri_internal, read_fd, reveal_path_internal, wayland::{ clipboard::{Clipboard, DataOffer, FILE_LIST_MIME_TYPE, TEXT_MIME_TYPE}, @@ -79,16 +78,14 @@ use crate::platform::linux::{ window::WaylandWindow, }, xdg_desktop_portal::{Event as XDPEvent, XDPEventSource}, - LinuxClient, }; -use crate::platform::{blade::BladeContext, PlatformWindow}; +use crate::platform::{PlatformWindow, blade::BladeContext}; use crate::{ - point, px, size, AnyWindowHandle, Bounds, CursorStyle, DevicePixels, DisplayId, FileDropEvent, - ForegroundExecutor, KeyDownEvent, KeyUpEvent, Keystroke, LinuxCommon, Modifiers, + AnyWindowHandle, Bounds, CursorStyle, DOUBLE_CLICK_INTERVAL, DevicePixels, DisplayId, + FileDropEvent, ForegroundExecutor, KeyDownEvent, KeyUpEvent, Keystroke, LinuxCommon, Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseExitEvent, MouseMoveEvent, - MouseUpEvent, NavigationDirection, Pixels, PlatformDisplay, PlatformInput, Point, ScaledPixels, - ScrollDelta, ScrollWheelEvent, Size, TouchPhase, WindowParams, DOUBLE_CLICK_INTERVAL, - SCROLL_LINES, + MouseUpEvent, NavigationDirection, Pixels, PlatformDisplay, PlatformInput, Point, SCROLL_LINES, + ScaledPixels, ScrollDelta, ScrollWheelEvent, Size, TouchPhase, WindowParams, point, px, size, }; /// Used to convert evdev scancode to xkb scancode diff --git a/crates/gpui/src/platform/linux/wayland/clipboard.rs b/crates/gpui/src/platform/linux/wayland/clipboard.rs index 0eed91a561..7b7c59c83d 100644 --- a/crates/gpui/src/platform/linux/wayland/clipboard.rs +++ b/crates/gpui/src/platform/linux/wayland/clipboard.rs @@ -7,12 +7,12 @@ use std::{ use calloop::{LoopHandle, PostAction}; use filedescriptor::Pipe; use strum::IntoEnumIterator; -use wayland_client::{protocol::wl_data_offer::WlDataOffer, Connection}; +use wayland_client::{Connection, protocol::wl_data_offer::WlDataOffer}; use wayland_protocols::wp::primary_selection::zv1::client::zwp_primary_selection_offer_v1::ZwpPrimarySelectionOfferV1; use crate::{ - hash, platform::linux::platform::read_fd, ClipboardEntry, ClipboardItem, Image, ImageFormat, - WaylandClientStatePtr, + ClipboardEntry, ClipboardItem, Image, ImageFormat, WaylandClientStatePtr, hash, + platform::linux::platform::read_fd, }; pub(crate) const TEXT_MIME_TYPE: &str = "text/plain;charset=utf-8"; diff --git a/crates/gpui/src/platform/linux/wayland/cursor.rs b/crates/gpui/src/platform/linux/wayland/cursor.rs index 09aa414deb..756447ecd2 100644 --- a/crates/gpui/src/platform/linux/wayland/cursor.rs +++ b/crates/gpui/src/platform/linux/wayland/cursor.rs @@ -1,9 +1,9 @@ use crate::Globals; use util::ResultExt; +use wayland_client::Connection; use wayland_client::protocol::wl_surface::WlSurface; use wayland_client::protocol::{wl_pointer::WlPointer, wl_shm::WlShm}; -use wayland_client::Connection; use wayland_cursor::{CursorImageBuffer, CursorTheme}; pub(crate) struct Cursor { diff --git a/crates/gpui/src/platform/linux/wayland/window.rs b/crates/gpui/src/platform/linux/wayland/window.rs index 17dcee6b3a..4178bea4a3 100644 --- a/crates/gpui/src/platform/linux/wayland/window.rs +++ b/crates/gpui/src/platform/linux/wayland/window.rs @@ -13,7 +13,7 @@ use futures::channel::oneshot::Receiver; use raw_window_handle as rwh; use wayland_backend::client::ObjectId; use wayland_client::WEnum; -use wayland_client::{protocol::wl_surface, Proxy}; +use wayland_client::{Proxy, protocol::wl_surface}; use wayland_protocols::wp::fractional_scale::v1::client::wp_fractional_scale_v1; use wayland_protocols::wp::viewporter::client::wp_viewport; use wayland_protocols::xdg::decoration::zv1::client::zxdg_toplevel_decoration_v1; @@ -22,16 +22,17 @@ use wayland_protocols::xdg::shell::client::xdg_toplevel::{self}; use wayland_protocols_plasma::blur::client::org_kde_kwin_blur; use crate::platform::{ + PlatformAtlas, PlatformInputHandler, PlatformWindow, blade::{BladeContext, BladeRenderer, BladeSurfaceConfig}, linux::wayland::{display::WaylandDisplay, serial::SerialKind}, - PlatformAtlas, PlatformInputHandler, PlatformWindow, }; use crate::scene::Scene; use crate::{ - px, size, AnyWindowHandle, Bounds, Decorations, Globals, GpuSpecs, Modifiers, Output, Pixels, + AnyWindowHandle, Bounds, Decorations, Globals, GpuSpecs, Modifiers, Output, Pixels, PlatformDisplay, PlatformInput, Point, PromptLevel, RequestFrameOptions, ResizeEdge, ScaledPixels, Size, Tiling, WaylandClientStatePtr, WindowAppearance, - WindowBackgroundAppearance, WindowBounds, WindowControls, WindowDecorations, WindowParams, + WindowBackgroundAppearance, WindowBounds, WindowControls, WindowDecorations, WindowParams, px, + size, }; #[derive(Default)] diff --git a/crates/gpui/src/platform/linux/x11/client.rs b/crates/gpui/src/platform/linux/x11/client.rs index 4952843148..45c37221ab 100644 --- a/crates/gpui/src/platform/linux/x11/client.rs +++ b/crates/gpui/src/platform/linux/x11/client.rs @@ -9,8 +9,8 @@ use std::{ }; use calloop::{ - generic::{FdWrapper, Generic}, EventLoop, LoopHandle, RegistrationToken, + generic::{FdWrapper, Generic}, }; use anyhow::Context as _; @@ -30,38 +30,37 @@ use x11rb::{ AtomEnum, ChangeWindowAttributesAux, ClientMessageData, ClientMessageEvent, ConnectionExt as _, EventMask, KeyPressEvent, }, - protocol::{randr, render, xinput, xkb, xproto, Event}, + protocol::{Event, randr, render, xinput, xkb, xproto}, resource_manager::Database, wrapper::ConnectionExt as _, xcb_ffi::XCBConnection, }; -use xim::{x11rb::X11rbClient, AttributeName, Client, InputStyle}; +use xim::{AttributeName, Client, InputStyle, x11rb::X11rbClient}; use xkbc::x11::ffi::{XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION}; use xkbcommon::xkb::{self as xkbc, LayoutIndex, ModMask, STATE_LAYOUT_EFFECTIVE}; use super::{ - button_or_scroll_from_event_detail, get_valuator_axis_index, modifiers_from_state, - pressed_button_from_mask, ButtonOrScroll, ScrollDirection, + ButtonOrScroll, ScrollDirection, button_or_scroll_from_event_detail, get_valuator_axis_index, + modifiers_from_state, pressed_button_from_mask, }; use super::{X11Display, X11WindowStatePtr, XcbAtoms}; use super::{XimCallbackEvent, XimHandler}; use crate::platform::{ + LinuxCommon, PlatformWindow, blade::BladeContext, linux::{ - get_xkb_compose_state, is_within_click_distance, open_uri_internal, + LinuxClient, get_xkb_compose_state, is_within_click_distance, open_uri_internal, platform::{DOUBLE_CLICK_INTERVAL, SCROLL_LINES}, reveal_path_internal, xdg_desktop_portal::{Event as XDPEvent, XDPEventSource}, - LinuxClient, }, - LinuxCommon, PlatformWindow, }; use crate::{ - modifiers_from_xinput_info, point, px, AnyWindowHandle, Bounds, ClipboardItem, CursorStyle, - DisplayId, FileDropEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton, Pixels, - Platform, PlatformDisplay, PlatformInput, Point, RequestFrameOptions, ScaledPixels, - ScrollDelta, Size, TouchPhase, WindowParams, X11Window, + AnyWindowHandle, Bounds, ClipboardItem, CursorStyle, DisplayId, FileDropEvent, Keystroke, + Modifiers, ModifiersChangedEvent, MouseButton, Pixels, Platform, PlatformDisplay, + PlatformInput, Point, RequestFrameOptions, ScaledPixels, ScrollDelta, Size, TouchPhase, + WindowParams, X11Window, modifiers_from_xinput_info, point, px, }; /// Value for DeviceId parameters which selects all devices. diff --git a/crates/gpui/src/platform/linux/x11/display.rs b/crates/gpui/src/platform/linux/x11/display.rs index 4983e2f5a3..d1c2bef0d7 100644 --- a/crates/gpui/src/platform/linux/x11/display.rs +++ b/crates/gpui/src/platform/linux/x11/display.rs @@ -2,7 +2,7 @@ use anyhow::Result; use uuid::Uuid; use x11rb::{connection::Connection as _, xcb_ffi::XCBConnection}; -use crate::{px, Bounds, DisplayId, Pixels, PlatformDisplay, Size}; +use crate::{Bounds, DisplayId, Pixels, PlatformDisplay, Size, px}; #[derive(Debug)] pub(crate) struct X11Display { diff --git a/crates/gpui/src/platform/linux/x11/window.rs b/crates/gpui/src/platform/linux/x11/window.rs index 38ed0d8858..7a4cd1c35a 100644 --- a/crates/gpui/src/platform/linux/x11/window.rs +++ b/crates/gpui/src/platform/linux/x11/window.rs @@ -1,17 +1,17 @@ -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use crate::platform::blade::{BladeContext, BladeRenderer, BladeSurfaceConfig}; use crate::{ - px, size, AnyWindowHandle, Bounds, Decorations, DevicePixels, ForegroundExecutor, GpuSpecs, - Modifiers, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, - PlatformWindow, Point, PromptLevel, RequestFrameOptions, ResizeEdge, ScaledPixels, Scene, Size, - Tiling, WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowDecorations, - WindowKind, WindowParams, X11ClientStatePtr, + AnyWindowHandle, Bounds, Decorations, DevicePixels, ForegroundExecutor, GpuSpecs, Modifiers, + Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow, + Point, PromptLevel, RequestFrameOptions, ResizeEdge, ScaledPixels, Scene, Size, Tiling, + WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowDecorations, WindowKind, + WindowParams, X11ClientStatePtr, px, size, }; use blade_graphics as gpu; use raw_window_handle as rwh; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; use x11rb::{ connection::Connection, cookie::{Cookie, VoidCookie}, @@ -31,7 +31,7 @@ use std::{ sync::Arc, }; -use super::{X11Display, XINPUT_ALL_DEVICES, XINPUT_ALL_DEVICE_GROUPS}; +use super::{X11Display, XINPUT_ALL_DEVICE_GROUPS, XINPUT_ALL_DEVICES}; x11rb::atom_manager! { pub XcbAtoms: AtomsCookie { XA_ATOM, diff --git a/crates/gpui/src/platform/linux/x11/xim_handler.rs b/crates/gpui/src/platform/linux/x11/xim_handler.rs index e1ccfd4cd9..82b7c96312 100644 --- a/crates/gpui/src/platform/linux/x11/xim_handler.rs +++ b/crates/gpui/src/platform/linux/x11/xim_handler.rs @@ -1,6 +1,6 @@ use std::default::Default; -use x11rb::protocol::{xproto, Event}; +use x11rb::protocol::{Event, xproto}; use xim::{AHashMap, AttributeName, Client, ClientError, ClientHandler, InputStyle}; pub enum XimCallbackEvent { diff --git a/crates/gpui/src/platform/mac.rs b/crates/gpui/src/platform/mac.rs index 441c6562c8..75041b8cc1 100644 --- a/crates/gpui/src/platform/mac.rs +++ b/crates/gpui/src/platform/mac.rs @@ -30,7 +30,7 @@ mod platform; mod window; mod window_appearance; -use crate::{px, size, DevicePixels, Pixels, Size}; +use crate::{DevicePixels, Pixels, Size, px, size}; use cocoa::{ base::{id, nil}, foundation::{NSAutoreleasePool, NSNotFound, NSRect, NSSize, NSString, NSUInteger}, @@ -38,7 +38,7 @@ use cocoa::{ use objc::runtime::{BOOL, NO, YES}; use std::{ - ffi::{c_char, CStr}, + ffi::{CStr, c_char}, ops::Range, }; @@ -60,11 +60,7 @@ trait BoolExt { impl BoolExt for bool { fn to_objc(self) -> BOOL { - if self { - YES - } else { - NO - } + if self { YES } else { NO } } } diff --git a/crates/gpui/src/platform/mac/dispatcher.rs b/crates/gpui/src/platform/mac/dispatcher.rs index 13b2742d23..137295fb91 100644 --- a/crates/gpui/src/platform/mac/dispatcher.rs +++ b/crates/gpui/src/platform/mac/dispatcher.rs @@ -13,7 +13,7 @@ use parking::{Parker, Unparker}; use parking_lot::Mutex; use std::{ ffi::c_void, - ptr::{addr_of, NonNull}, + ptr::{NonNull, addr_of}, sync::Arc, time::Duration, }; diff --git a/crates/gpui/src/platform/mac/display.rs b/crates/gpui/src/platform/mac/display.rs index 7e8b38312c..4ee27027d5 100644 --- a/crates/gpui/src/platform/mac/display.rs +++ b/crates/gpui/src/platform/mac/display.rs @@ -1,4 +1,4 @@ -use crate::{px, size, Bounds, DisplayId, Pixels, PlatformDisplay}; +use crate::{Bounds, DisplayId, Pixels, PlatformDisplay, px, size}; use anyhow::Result; use cocoa::{ appkit::NSScreen, diff --git a/crates/gpui/src/platform/mac/display_link.rs b/crates/gpui/src/platform/mac/display_link.rs index 03bae50181..28563871df 100644 --- a/crates/gpui/src/platform/mac/display_link.rs +++ b/crates/gpui/src/platform/mac/display_link.rs @@ -103,7 +103,7 @@ mod sys { use anyhow::Result; use core_graphics::display::CGDirectDisplayID; - use foreign_types::{foreign_type, ForeignType}; + use foreign_types::{ForeignType, foreign_type}; use std::{ ffi::c_void, fmt::{self, Debug, Formatter}, diff --git a/crates/gpui/src/platform/mac/events.rs b/crates/gpui/src/platform/mac/events.rs index f915514275..34805c5bb2 100644 --- a/crates/gpui/src/platform/mac/events.rs +++ b/crates/gpui/src/platform/mac/events.rs @@ -1,15 +1,16 @@ use crate::{ - platform::mac::{ - kTISPropertyUnicodeKeyLayoutData, LMGetKbdType, NSStringExt, - TISCopyCurrentKeyboardLayoutInputSource, TISGetInputSourceProperty, UCKeyTranslate, - }, - point, px, KeyDownEvent, KeyUpEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton, + KeyDownEvent, KeyUpEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseExitEvent, MouseMoveEvent, MouseUpEvent, NavigationDirection, Pixels, PlatformInput, ScrollDelta, ScrollWheelEvent, TouchPhase, + platform::mac::{ + LMGetKbdType, NSStringExt, TISCopyCurrentKeyboardLayoutInputSource, + TISGetInputSourceProperty, UCKeyTranslate, kTISPropertyUnicodeKeyLayoutData, + }, + point, px, }; use cocoa::{ appkit::{NSEvent, NSEventModifierFlags, NSEventPhase, NSEventType}, - base::{id, YES}, + base::{YES, id}, }; use core_foundation::data::{CFDataGetBytePtr, CFDataRef}; use core_graphics::event::CGKeyCode; diff --git a/crates/gpui/src/platform/mac/metal_atlas.rs b/crates/gpui/src/platform/mac/metal_atlas.rs index 4662761a7d..e3c7d147bc 100644 --- a/crates/gpui/src/platform/mac/metal_atlas.rs +++ b/crates/gpui/src/platform/mac/metal_atlas.rs @@ -1,8 +1,8 @@ use crate::{ - platform::AtlasTextureList, AtlasKey, AtlasTextureId, AtlasTextureKind, AtlasTile, Bounds, - DevicePixels, PlatformAtlas, Point, Size, + AtlasKey, AtlasTextureId, AtlasTextureKind, AtlasTile, Bounds, DevicePixels, PlatformAtlas, + Point, Size, platform::AtlasTextureList, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::FxHashMap; use derive_more::{Deref, DerefMut}; use etagere::BucketedAtlasAllocator; diff --git a/crates/gpui/src/platform/mac/metal_renderer.rs b/crates/gpui/src/platform/mac/metal_renderer.rs index 0ed718292d..832ffab5c3 100644 --- a/crates/gpui/src/platform/mac/metal_renderer.rs +++ b/crates/gpui/src/platform/mac/metal_renderer.rs @@ -1,10 +1,10 @@ use super::metal_atlas::MetalAtlas; use crate::{ - point, size, AtlasTextureId, AtlasTextureKind, AtlasTile, Background, Bounds, ContentMask, - DevicePixels, MonochromeSprite, PaintSurface, Path, PathId, PathVertex, PolychromeSprite, - PrimitiveBatch, Quad, ScaledPixels, Scene, Shadow, Size, Surface, Underline, + AtlasTextureId, AtlasTextureKind, AtlasTile, Background, Bounds, ContentMask, DevicePixels, + MonochromeSprite, PaintSurface, Path, PathId, PathVertex, PolychromeSprite, PrimitiveBatch, + Quad, ScaledPixels, Scene, Shadow, Size, Surface, Underline, point, size, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use block::ConcreteBlock; use cocoa::{ base::{NO, YES}, diff --git a/crates/gpui/src/platform/mac/open_type.rs b/crates/gpui/src/platform/mac/open_type.rs index 51529beb9c..2ae5e8f87a 100644 --- a/crates/gpui/src/platform/mac/open_type.rs +++ b/crates/gpui/src/platform/mac/open_type.rs @@ -4,13 +4,12 @@ use crate::{FontFallbacks, FontFeatures}; use cocoa::appkit::CGFloat; use core_foundation::{ array::{ - kCFTypeArrayCallBacks, CFArray, CFArrayAppendArray, CFArrayAppendValue, - CFArrayCreateMutable, CFArrayGetCount, CFArrayGetValueAtIndex, CFArrayRef, - CFMutableArrayRef, + CFArray, CFArrayAppendArray, CFArrayAppendValue, CFArrayCreateMutable, CFArrayGetCount, + CFArrayGetValueAtIndex, CFArrayRef, CFMutableArrayRef, kCFTypeArrayCallBacks, }, - base::{kCFAllocatorDefault, CFRelease, TCFType}, + base::{CFRelease, TCFType, kCFAllocatorDefault}, dictionary::{ - kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks, CFDictionaryCreate, + CFDictionaryCreate, kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks, }, number::CFNumber, string::{CFString, CFStringRef}, @@ -18,12 +17,11 @@ use core_foundation::{ use core_foundation_sys::locale::CFLocaleCopyPreferredLanguages; use core_graphics::{display::CFDictionary, geometry::CGAffineTransform}; use core_text::{ - font::{cascade_list_for_languages, CTFont, CTFontRef}, + font::{CTFont, CTFontRef, cascade_list_for_languages}, font_descriptor::{ - kCTFontCascadeListAttribute, kCTFontFeatureSettingsAttribute, CTFontDescriptor, - CTFontDescriptorCopyAttributes, CTFontDescriptorCreateCopyWithFeature, + CTFontDescriptor, CTFontDescriptorCopyAttributes, CTFontDescriptorCreateCopyWithFeature, CTFontDescriptorCreateWithAttributes, CTFontDescriptorCreateWithNameAndSize, - CTFontDescriptorRef, + CTFontDescriptorRef, kCTFontCascadeListAttribute, kCTFontFeatureSettingsAttribute, }, }; use font_kit::font::Font as FontKitFont; diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rs index cd9a22eb77..c830522cbe 100644 --- a/crates/gpui/src/platform/mac/platform.rs +++ b/crates/gpui/src/platform/mac/platform.rs @@ -1,16 +1,17 @@ use super::{ + BoolExt, attributed_string::{NSAttributedString, NSMutableAttributedString}, events::key_to_native, - renderer, screen_capture, BoolExt, + renderer, screen_capture, }; use crate::{ - hash, Action, AnyWindowHandle, BackgroundExecutor, ClipboardEntry, ClipboardItem, - ClipboardString, CursorStyle, ForegroundExecutor, Image, ImageFormat, Keymap, MacDispatcher, - MacDisplay, MacWindow, Menu, MenuItem, PathPromptOptions, Platform, PlatformDisplay, - PlatformTextSystem, PlatformWindow, Result, ScreenCaptureSource, SemanticVersion, Task, - WindowAppearance, WindowParams, + Action, AnyWindowHandle, BackgroundExecutor, ClipboardEntry, ClipboardItem, ClipboardString, + CursorStyle, ForegroundExecutor, Image, ImageFormat, Keymap, MacDispatcher, MacDisplay, + MacWindow, Menu, MenuItem, PathPromptOptions, Platform, PlatformDisplay, PlatformTextSystem, + PlatformWindow, Result, ScreenCaptureSource, SemanticVersion, Task, WindowAppearance, + WindowParams, hash, }; -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use block::ConcreteBlock; use cocoa::{ appkit::{ @@ -19,7 +20,7 @@ use cocoa::{ NSPasteboardTypePNG, NSPasteboardTypeRTF, NSPasteboardTypeRTFD, NSPasteboardTypeString, NSPasteboardTypeTIFF, NSSavePanel, NSWindow, }, - base::{id, nil, selector, BOOL, NO, YES}, + base::{BOOL, NO, YES, id, nil, selector}, foundation::{ NSArray, NSAutoreleasePool, NSBundle, NSData, NSInteger, NSProcessInfo, NSRange, NSString, NSUInteger, NSURL, @@ -47,7 +48,7 @@ use ptr::null_mut; use std::{ cell::Cell, convert::TryInto, - ffi::{c_void, CStr, OsStr}, + ffi::{CStr, OsStr, c_void}, os::{raw::c_char, unix::ffi::OsStrExt}, path::{Path, PathBuf}, process::Command, diff --git a/crates/gpui/src/platform/mac/screen_capture.rs b/crates/gpui/src/platform/mac/screen_capture.rs index c248cebeb8..900e9d2181 100644 --- a/crates/gpui/src/platform/mac/screen_capture.rs +++ b/crates/gpui/src/platform/mac/screen_capture.rs @@ -1,11 +1,12 @@ use crate::{ + Pixels, Size, platform::{ScreenCaptureFrame, ScreenCaptureSource, ScreenCaptureStream}, - px, size, Pixels, Size, + px, size, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use block::ConcreteBlock; use cocoa::{ - base::{id, nil, YES}, + base::{YES, id, nil}, foundation::NSArray, }; use core_foundation::base::TCFType; diff --git a/crates/gpui/src/platform/mac/text_system.rs b/crates/gpui/src/platform/mac/text_system.rs index cfaa533158..abc6cf46c4 100644 --- a/crates/gpui/src/platform/mac/text_system.rs +++ b/crates/gpui/src/platform/mac/text_system.rs @@ -1,8 +1,8 @@ use crate::{ - point, px, size, swap_rgba_pa_to_bgra, Bounds, DevicePixels, Font, FontFallbacks, FontFeatures, - FontId, FontMetrics, FontRun, FontStyle, FontWeight, GlyphId, LineLayout, Pixels, - PlatformTextSystem, Point, RenderGlyphParams, Result, ShapedGlyph, ShapedRun, SharedString, - Size, SUBPIXEL_VARIANTS, + Bounds, DevicePixels, Font, FontFallbacks, FontFeatures, FontId, FontMetrics, FontRun, + FontStyle, FontWeight, GlyphId, LineLayout, Pixels, PlatformTextSystem, Point, + RenderGlyphParams, Result, SUBPIXEL_VARIANTS, ShapedGlyph, ShapedRun, SharedString, Size, + point, px, size, swap_rgba_pa_to_bgra, }; use anyhow::anyhow; use cocoa::appkit::CGFloat; @@ -14,7 +14,7 @@ use core_foundation::{ string::CFString, }; use core_graphics::{ - base::{kCGImageAlphaPremultipliedLast, CGGlyph}, + base::{CGGlyph, kCGImageAlphaPremultipliedLast}, color_space::CGColorSpace, context::CGContext, display::CGPoint, @@ -639,7 +639,7 @@ mod lenient_font_attributes { string::{CFString, CFStringRef}, }; use core_text::font_descriptor::{ - kCTFontFamilyNameAttribute, CTFontDescriptor, CTFontDescriptorCopyAttribute, + CTFontDescriptor, CTFontDescriptorCopyAttribute, kCTFontFamilyNameAttribute, }; pub fn family_name(descriptor: &CTFontDescriptor) -> Option { @@ -674,7 +674,7 @@ mod lenient_font_attributes { #[cfg(test)] mod tests { - use crate::{font, px, FontRun, GlyphId, MacTextSystem, PlatformTextSystem}; + use crate::{FontRun, GlyphId, MacTextSystem, PlatformTextSystem, font, px}; #[test] fn test_layout_line_bom_char() { @@ -697,7 +697,7 @@ mod tests { assert_eq!(layout.runs.len(), 1); assert_eq!(layout.runs[0].glyphs.len(), 2); assert_eq!(layout.runs[0].glyphs[0].id, GlyphId(68u32)); // a - // There's no glyph for \u{feff} + // There's no glyph for \u{feff} assert_eq!(layout.runs[0].glyphs[1].id, GlyphId(69u32)); // b } } diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs index 8adf25f9f7..e655e067f8 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -1,11 +1,11 @@ -use super::{ns_string, renderer, MacDisplay, NSRange, NSStringExt}; +use super::{MacDisplay, NSRange, NSStringExt, ns_string, renderer}; use crate::{ - platform::PlatformInputHandler, point, px, size, AnyWindowHandle, Bounds, DisplayLink, - ExternalPaths, FileDropEvent, ForegroundExecutor, KeyDownEvent, Keystroke, Modifiers, - ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, - PlatformAtlas, PlatformDisplay, PlatformInput, PlatformWindow, Point, PromptLevel, - RequestFrameOptions, ScaledPixels, Size, Timer, WindowAppearance, WindowBackgroundAppearance, - WindowBounds, WindowKind, WindowParams, + AnyWindowHandle, Bounds, DisplayLink, ExternalPaths, FileDropEvent, ForegroundExecutor, + KeyDownEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent, + MouseMoveEvent, MouseUpEvent, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, + PlatformWindow, Point, PromptLevel, RequestFrameOptions, ScaledPixels, Size, Timer, + WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowKind, WindowParams, + platform::PlatformInputHandler, point, px, size, }; use block::ConcreteBlock; use cocoa::{ @@ -28,7 +28,7 @@ use objc::{ class, declare::ClassDecl, msg_send, - runtime::{Class, Object, Protocol, Sel, BOOL, NO, YES}, + runtime::{BOOL, Class, NO, Object, Protocol, Sel, YES}, sel, sel_impl, }; use parking_lot::Mutex; @@ -36,7 +36,7 @@ use raw_window_handle as rwh; use smallvec::SmallVec; use std::{ cell::Cell, - ffi::{c_void, CStr}, + ffi::{CStr, c_void}, mem, ops::Range, path::PathBuf, @@ -1198,11 +1198,7 @@ fn get_scale_factor(native_window: id) -> f32 { // (if it is off-screen), though we'd expect to see viewDidChangeBackingProperties before // it was rendered for real. // Regardless, attempt to avoid the issue here. - if factor == 0.0 { - 2. - } else { - factor - } + if factor == 0.0 { 2. } else { factor } } unsafe fn get_window_state(object: &Object) -> Arc> { diff --git a/crates/gpui/src/platform/test/display.rs b/crates/gpui/src/platform/test/display.rs index 7a8f075c01..c4adb014aa 100644 --- a/crates/gpui/src/platform/test/display.rs +++ b/crates/gpui/src/platform/test/display.rs @@ -1,4 +1,4 @@ -use crate::{px, Bounds, DisplayId, Pixels, PlatformDisplay, Point}; +use crate::{Bounds, DisplayId, Pixels, PlatformDisplay, Point, px}; use anyhow::{Ok, Result}; #[derive(Debug)] diff --git a/crates/gpui/src/platform/test/platform.rs b/crates/gpui/src/platform/test/platform.rs index cb29783c84..e66465d2d2 100644 --- a/crates/gpui/src/platform/test/platform.rs +++ b/crates/gpui/src/platform/test/platform.rs @@ -1,7 +1,7 @@ use crate::{ - px, size, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, ForegroundExecutor, - Keymap, Platform, PlatformDisplay, PlatformTextSystem, ScreenCaptureFrame, ScreenCaptureSource, - ScreenCaptureStream, Task, TestDisplay, TestWindow, WindowAppearance, WindowParams, + AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, ForegroundExecutor, Keymap, + Platform, PlatformDisplay, PlatformTextSystem, ScreenCaptureFrame, ScreenCaptureSource, + ScreenCaptureStream, Task, TestDisplay, TestWindow, WindowAppearance, WindowParams, px, size, }; use anyhow::Result; use collections::VecDeque; @@ -16,7 +16,7 @@ use std::{ #[cfg(target_os = "windows")] use windows::Win32::{ Graphics::Imaging::{CLSID_WICImagingFactory, IWICImagingFactory}, - System::Com::{CoCreateInstance, CLSCTX_INPROC_SERVER}, + System::Com::{CLSCTX_INPROC_SERVER, CoCreateInstance}, }; /// TestPlatform implements the Platform trait for use in tests. diff --git a/crates/gpui/src/platform/windows/clipboard.rs b/crates/gpui/src/platform/windows/clipboard.rs index 5de057152f..19b5c6cacd 100644 --- a/crates/gpui/src/platform/windows/clipboard.rs +++ b/crates/gpui/src/platform/windows/clipboard.rs @@ -12,7 +12,7 @@ use windows::Win32::{ GetClipboardData, GetClipboardFormatNameW, IsClipboardFormatAvailable, OpenClipboard, RegisterClipboardFormatW, SetClipboardData, }, - Memory::{GlobalAlloc, GlobalLock, GlobalUnlock, GMEM_MOVEABLE}, + Memory::{GMEM_MOVEABLE, GlobalAlloc, GlobalLock, GlobalUnlock}, Ole::{CF_HDROP, CF_UNICODETEXT}, }, UI::Shell::{DragQueryFileW, HDROP}, @@ -20,7 +20,7 @@ use windows::Win32::{ use windows_core::PCWSTR; use crate::{ - hash, ClipboardEntry, ClipboardItem, ClipboardString, Image, ImageFormat, SmartGlobal, + ClipboardEntry, ClipboardItem, ClipboardString, Image, ImageFormat, SmartGlobal, hash, }; // https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-dragqueryfilew diff --git a/crates/gpui/src/platform/windows/direct_write.rs b/crates/gpui/src/platform/windows/direct_write.rs index f323bc5892..2e9a8af01d 100644 --- a/crates/gpui/src/platform/windows/direct_write.rs +++ b/crates/gpui/src/platform/windows/direct_write.rs @@ -1,13 +1,12 @@ use std::{borrow::Cow, sync::Arc}; use ::util::ResultExt; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::HashMap; use itertools::Itertools; use parking_lot::{RwLock, RwLockUpgradableReadGuard}; use smallvec::SmallVec; use windows::{ - core::*, Win32::{ Foundation::*, Globalization::GetUserDefaultLocaleName, @@ -21,6 +20,7 @@ use windows::{ System::SystemServices::LOCALE_NAME_MAX_LENGTH, UI::WindowsAndMessaging::*, }, + core::*, }; use windows_numerics::Vector2; diff --git a/crates/gpui/src/platform/windows/dispatcher.rs b/crates/gpui/src/platform/windows/dispatcher.rs index 6ce63612bb..d88aadcf71 100644 --- a/crates/gpui/src/platform/windows/dispatcher.rs +++ b/crates/gpui/src/platform/windows/dispatcher.rs @@ -1,5 +1,5 @@ use std::{ - thread::{current, ThreadId}, + thread::{ThreadId, current}, time::Duration, }; diff --git a/crates/gpui/src/platform/windows/display.rs b/crates/gpui/src/platform/windows/display.rs index 25631672c4..34e00c86b9 100644 --- a/crates/gpui/src/platform/windows/display.rs +++ b/crates/gpui/src/platform/windows/display.rs @@ -4,7 +4,6 @@ use std::rc::Rc; use util::ResultExt; use uuid::Uuid; use windows::{ - core::*, Win32::{ Foundation::*, Graphics::Gdi::*, @@ -13,9 +12,10 @@ use windows::{ WindowsAndMessaging::USER_DEFAULT_SCREEN_DPI, }, }, + core::*, }; -use crate::{logical_point, point, size, Bounds, DevicePixels, DisplayId, Pixels, PlatformDisplay}; +use crate::{Bounds, DevicePixels, DisplayId, Pixels, PlatformDisplay, logical_point, point, size}; #[derive(Debug, Clone, Copy)] pub(crate) struct WindowsDisplay { diff --git a/crates/gpui/src/platform/windows/events.rs b/crates/gpui/src/platform/windows/events.rs index 24c766c891..e12991c4ef 100644 --- a/crates/gpui/src/platform/windows/events.rs +++ b/crates/gpui/src/platform/windows/events.rs @@ -3,7 +3,6 @@ use std::rc::Rc; use ::util::ResultExt; use anyhow::Context as _; use windows::{ - core::PCWSTR, Win32::{ Foundation::*, Graphics::Gdi::*, @@ -15,6 +14,7 @@ use windows::{ WindowsAndMessaging::*, }, }, + core::PCWSTR, }; use crate::*; @@ -232,11 +232,7 @@ fn handle_close_msg(state_ptr: Rc) -> Option { drop(lock); let should_close = callback(); state_ptr.state.borrow_mut().callbacks.should_close = Some(callback); - if should_close { - None - } else { - Some(0) - } + if should_close { None } else { Some(0) } } else { None } diff --git a/crates/gpui/src/platform/windows/platform.rs b/crates/gpui/src/platform/windows/platform.rs index 4644650425..e991bc93c6 100644 --- a/crates/gpui/src/platform/windows/platform.rs +++ b/crates/gpui/src/platform/windows/platform.rs @@ -6,15 +6,18 @@ use std::{ sync::Arc, }; -use ::util::{paths::SanitizedPath, ResultExt}; -use anyhow::{anyhow, Context as _, Result}; +use ::util::{ResultExt, paths::SanitizedPath}; +use anyhow::{Context as _, Result, anyhow}; use async_task::Runnable; use futures::channel::oneshot::{self, Receiver}; use itertools::Itertools; use parking_lot::RwLock; use smallvec::SmallVec; use windows::{ - core::*, + UI::{ + StartScreen::{JumpList, JumpListItem}, + ViewManagement::UISettings, + }, Win32::{ Foundation::*, Graphics::{ @@ -25,10 +28,7 @@ use windows::{ System::{Com::*, LibraryLoader::*, Ole::*, SystemInformation::*, Threading::*}, UI::{Input::KeyboardAndMouse::*, Shell::*, WindowsAndMessaging::*}, }, - UI::{ - StartScreen::{JumpList, JumpListItem}, - ViewManagement::UISettings, - }, + core::*, }; use crate::{platform::blade::BladeContext, *}; @@ -826,7 +826,7 @@ fn should_auto_hide_scrollbars() -> Result { #[cfg(test)] mod tests { - use crate::{read_from_clipboard, write_to_clipboard, ClipboardItem}; + use crate::{ClipboardItem, read_from_clipboard, write_to_clipboard}; #[test] fn test_clipboard() { diff --git a/crates/gpui/src/platform/windows/system_settings.rs b/crates/gpui/src/platform/windows/system_settings.rs index 8bbc83fe43..d8e3513b3c 100644 --- a/crates/gpui/src/platform/windows/system_settings.rs +++ b/crates/gpui/src/platform/windows/system_settings.rs @@ -2,10 +2,10 @@ use std::ffi::{c_uint, c_void}; use ::util::ResultExt; use windows::Win32::UI::{ - Shell::{SHAppBarMessage, ABM_GETSTATE, ABM_GETTASKBARPOS, ABS_AUTOHIDE, APPBARDATA}, + Shell::{ABM_GETSTATE, ABM_GETTASKBARPOS, ABS_AUTOHIDE, APPBARDATA, SHAppBarMessage}, WindowsAndMessaging::{ - SystemParametersInfoW, SPI_GETWHEELSCROLLCHARS, SPI_GETWHEELSCROLLLINES, - SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS, + SPI_GETWHEELSCROLLCHARS, SPI_GETWHEELSCROLLLINES, SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS, + SystemParametersInfoW, }, }; diff --git a/crates/gpui/src/platform/windows/util.rs b/crates/gpui/src/platform/windows/util.rs index 6c3ef5e5ac..aefde5e881 100644 --- a/crates/gpui/src/platform/windows/util.rs +++ b/crates/gpui/src/platform/windows/util.rs @@ -2,13 +2,13 @@ use std::sync::OnceLock; use ::util::ResultExt; use windows::{ - core::BOOL, - Wdk::System::SystemServices::RtlGetVersion, - Win32::{Foundation::*, Graphics::Dwm::*, UI::WindowsAndMessaging::*}, UI::{ Color, ViewManagement::{UIColorType, UISettings}, }, + Wdk::System::SystemServices::RtlGetVersion, + Win32::{Foundation::*, Graphics::Dwm::*, UI::WindowsAndMessaging::*}, + core::BOOL, }; use crate::*; diff --git a/crates/gpui/src/platform/windows/window.rs b/crates/gpui/src/platform/windows/window.rs index 65980a284c..c5d49d036b 100644 --- a/crates/gpui/src/platform/windows/window.rs +++ b/crates/gpui/src/platform/windows/window.rs @@ -17,13 +17,13 @@ use futures::channel::oneshot::{self, Receiver}; use raw_window_handle as rwh; use smallvec::SmallVec; use windows::{ - core::*, Win32::{ Foundation::*, Graphics::Gdi::*, System::{Com::*, LibraryLoader::*, Ole::*, SystemServices::*}, UI::{Controls::*, HiDpi::*, Input::KeyboardAndMouse::*, Shell::*, WindowsAndMessaging::*}, }, + core::*, }; use crate::platform::blade::{BladeContext, BladeRenderer}; @@ -1326,7 +1326,7 @@ mod windows_renderer { #[cfg(test)] mod tests { use super::ClickState; - use crate::{point, DevicePixels, MouseButton}; + use crate::{DevicePixels, MouseButton, point}; use std::time::Duration; #[test] diff --git a/crates/gpui/src/prelude.rs b/crates/gpui/src/prelude.rs index 0cb57d534c..270f0a9341 100644 --- a/crates/gpui/src/prelude.rs +++ b/crates/gpui/src/prelude.rs @@ -3,7 +3,7 @@ //! application to avoid having to import each trait individually. pub use crate::{ - util::FluentBuilder, AppContext as _, BorrowAppContext, Context, Element, FocusableElement, - InteractiveElement, IntoElement, ParentElement, Refineable, Render, RenderOnce, - StatefulInteractiveElement, Styled, StyledImage, VisualContext, + AppContext as _, BorrowAppContext, Context, Element, FocusableElement, InteractiveElement, + IntoElement, ParentElement, Refineable, Render, RenderOnce, StatefulInteractiveElement, Styled, + StyledImage, VisualContext, util::FluentBuilder, }; diff --git a/crates/gpui/src/scene.rs b/crates/gpui/src/scene.rs index 6271d6e88b..fc527bf620 100644 --- a/crates/gpui/src/scene.rs +++ b/crates/gpui/src/scene.rs @@ -2,8 +2,8 @@ #![cfg_attr(windows, allow(dead_code))] use crate::{ - bounds_tree::BoundsTree, point, AtlasTextureId, AtlasTile, Background, Bounds, ContentMask, - Corners, Edges, Hsla, Pixels, Point, Radians, ScaledPixels, Size, + AtlasTextureId, AtlasTile, Background, Bounds, ContentMask, Corners, Edges, Hsla, Pixels, + Point, Radians, ScaledPixels, Size, bounds_tree::BoundsTree, point, }; use std::{fmt::Debug, iter::Peekable, ops::Range, slice}; diff --git a/crates/gpui/src/style.rs b/crates/gpui/src/style.rs index 5dbfa32a30..188576b465 100644 --- a/crates/gpui/src/style.rs +++ b/crates/gpui/src/style.rs @@ -5,11 +5,11 @@ use std::{ }; use crate::{ - black, phi, point, quad, rems, size, AbsoluteLength, App, Background, BackgroundTag, - BorderStyle, Bounds, ContentMask, Corners, CornersRefinement, CursorStyle, DefiniteLength, - DevicePixels, Edges, EdgesRefinement, Font, FontFallbacks, FontFeatures, FontStyle, FontWeight, - Hsla, Length, Pixels, Point, PointRefinement, Rgba, SharedString, Size, SizeRefinement, Styled, - TextRun, Window, + AbsoluteLength, App, Background, BackgroundTag, BorderStyle, Bounds, ContentMask, Corners, + CornersRefinement, CursorStyle, DefiniteLength, DevicePixels, Edges, EdgesRefinement, Font, + FontFallbacks, FontFeatures, FontStyle, FontWeight, Hsla, Length, Pixels, Point, + PointRefinement, Rgba, SharedString, Size, SizeRefinement, Styled, TextRun, Window, black, phi, + point, quad, rems, size, }; use collections::HashSet; use refineable::Refineable; diff --git a/crates/gpui/src/styled.rs b/crates/gpui/src/styled.rs index 96e77e8df9..569ab77578 100644 --- a/crates/gpui/src/styled.rs +++ b/crates/gpui/src/styled.rs @@ -1,8 +1,8 @@ use crate::{ - self as gpui, px, relative, rems, AbsoluteLength, AlignItems, BorderStyle, CursorStyle, - DefiniteLength, Fill, FlexDirection, FlexWrap, Font, FontStyle, FontWeight, Hsla, - JustifyContent, Length, SharedString, StrikethroughStyle, StyleRefinement, TextOverflow, - UnderlineStyle, WhiteSpace, + self as gpui, AbsoluteLength, AlignItems, BorderStyle, CursorStyle, DefiniteLength, Fill, + FlexDirection, FlexWrap, Font, FontStyle, FontWeight, Hsla, JustifyContent, Length, + SharedString, StrikethroughStyle, StyleRefinement, TextOverflow, UnderlineStyle, WhiteSpace, + px, relative, rems, }; use crate::{TextAlign, TextStyleRefinement}; pub use gpui_macros::{ diff --git a/crates/gpui/src/taffy.rs b/crates/gpui/src/taffy.rs index 7b96a7f575..b8c71d9731 100644 --- a/crates/gpui/src/taffy.rs +++ b/crates/gpui/src/taffy.rs @@ -5,10 +5,10 @@ use collections::{FxHashMap, FxHashSet}; use smallvec::SmallVec; use std::fmt::Debug; use taffy::{ + TaffyTree, TraversePartialTree as _, geometry::{Point as TaffyPoint, Rect as TaffyRect, Size as TaffySize}, style::AvailableSpace as TaffyAvailableSpace, tree::NodeId, - TaffyTree, TraversePartialTree as _, }; type NodeMeasureFn = Box< @@ -71,8 +71,13 @@ impl TaffyLayoutEngine { &mut self, style: Style, rem_size: Pixels, - measure: impl FnMut(Size>, Size, &mut Window, &mut App) -> Size - + 'static, + measure: impl FnMut( + Size>, + Size, + &mut Window, + &mut App, + ) -> Size + + 'static, ) -> LayoutId { let taffy_style = style.to_taffy(rem_size); diff --git a/crates/gpui/src/text_system.rs b/crates/gpui/src/text_system.rs index 2ab3a21f7d..216e14b6da 100644 --- a/crates/gpui/src/text_system.rs +++ b/crates/gpui/src/text_system.rs @@ -13,8 +13,8 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::{ - px, Bounds, DevicePixels, Hsla, Pixels, PlatformTextSystem, Point, Result, SharedString, Size, - StrikethroughStyle, UnderlineStyle, + Bounds, DevicePixels, Hsla, Pixels, PlatformTextSystem, Point, Result, SharedString, Size, + StrikethroughStyle, UnderlineStyle, px, }; use anyhow::anyhow; use collections::FxHashMap; @@ -22,7 +22,7 @@ use core::fmt; use derive_more::Deref; use itertools::Itertools; use parking_lot::{Mutex, RwLock, RwLockUpgradableReadGuard}; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use std::{ borrow::Cow, cmp, diff --git a/crates/gpui/src/text_system/line.rs b/crates/gpui/src/text_system/line.rs index ca2a9e9a72..1ebec668c7 100644 --- a/crates/gpui/src/text_system/line.rs +++ b/crates/gpui/src/text_system/line.rs @@ -1,7 +1,7 @@ use crate::{ - black, fill, point, px, size, App, Bounds, Half, Hsla, LineLayout, Pixels, Point, Result, - SharedString, StrikethroughStyle, TextAlign, UnderlineStyle, Window, WrapBoundary, - WrappedLineLayout, + App, Bounds, Half, Hsla, LineLayout, Pixels, Point, Result, SharedString, StrikethroughStyle, + TextAlign, UnderlineStyle, Window, WrapBoundary, WrappedLineLayout, black, fill, point, px, + size, }; use derive_more::{Deref, DerefMut}; use smallvec::SmallVec; diff --git a/crates/gpui/src/text_system/line_layout.rs b/crates/gpui/src/text_system/line_layout.rs index 200ea1be51..8a5d35628a 100644 --- a/crates/gpui/src/text_system/line_layout.rs +++ b/crates/gpui/src/text_system/line_layout.rs @@ -1,4 +1,4 @@ -use crate::{point, px, FontId, GlyphId, Pixels, PlatformTextSystem, Point, SharedString, Size}; +use crate::{FontId, GlyphId, Pixels, PlatformTextSystem, Point, SharedString, Size, point, px}; use collections::FxHashMap; use parking_lot::{Mutex, RwLock, RwLockUpgradableReadGuard}; use smallvec::SmallVec; diff --git a/crates/gpui/src/text_system/line_wrapper.rs b/crates/gpui/src/text_system/line_wrapper.rs index b7a783a728..d0bafe1d03 100644 --- a/crates/gpui/src/text_system/line_wrapper.rs +++ b/crates/gpui/src/text_system/line_wrapper.rs @@ -1,4 +1,4 @@ -use crate::{px, FontId, FontRun, Pixels, PlatformTextSystem, SharedString, TextRun}; +use crate::{FontId, FontRun, Pixels, PlatformTextSystem, SharedString, TextRun, px}; use collections::HashMap; use std::{iter, sync::Arc}; @@ -232,7 +232,7 @@ impl Boundary { mod tests { use super::*; use crate::{ - font, Font, FontFeatures, FontStyle, FontWeight, Hsla, TestAppContext, TestDispatcher, + Font, FontFeatures, FontStyle, FontWeight, Hsla, TestAppContext, TestDispatcher, font, }; #[cfg(target_os = "macos")] use crate::{TextRun, WindowTextSystem, WrapBoundary}; @@ -242,11 +242,11 @@ mod tests { let dispatcher = TestDispatcher::new(StdRng::seed_from_u64(0)); let cx = TestAppContext::new(dispatcher, None); cx.text_system() - .add_fonts(vec![std::fs::read( - "../../assets/fonts/plex-mono/ZedPlexMono-Regular.ttf", - ) - .unwrap() - .into()]) + .add_fonts(vec![ + std::fs::read("../../assets/fonts/plex-mono/ZedPlexMono-Regular.ttf") + .unwrap() + .into(), + ]) .unwrap(); let id = cx.text_system().font_id(&font("Zed Plex Mono")).unwrap(); LineWrapper::new(id, px(16.), cx.text_system().platform_text_system.clone()) diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rs index 10e6f9d90d..4d1115abc5 100644 --- a/crates/gpui/src/window.rs +++ b/crates/gpui/src/window.rs @@ -1,27 +1,27 @@ use crate::{ - point, prelude::*, px, size, transparent_black, Action, AnyDrag, AnyElement, AnyTooltip, - AnyView, App, AppContext, Arena, Asset, AsyncWindowContext, AvailableSpace, Background, - BorderStyle, Bounds, BoxShadow, Context, Corners, CursorStyle, Decorations, DevicePixels, - DispatchActionListener, DispatchNodeId, DispatchTree, DisplayId, Edges, Effect, Entity, - EntityId, EventEmitter, FileDropEvent, FontId, Global, GlobalElementId, GlyphId, GpuSpecs, - Hsla, InputHandler, IsZero, KeyBinding, KeyContext, KeyDownEvent, KeyEvent, Keystroke, - KeystrokeEvent, LayoutId, LineLayoutIndex, Modifiers, ModifiersChangedEvent, MonochromeSprite, - MouseButton, MouseEvent, MouseMoveEvent, MouseUpEvent, Path, Pixels, PlatformAtlas, - PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow, Point, PolychromeSprite, - PromptLevel, Quad, Render, RenderGlyphParams, RenderImage, RenderImageParams, RenderSvgParams, - Replay, ResizeEdge, ScaledPixels, Scene, Shadow, SharedString, Size, StrikethroughStyle, Style, + Action, AnyDrag, AnyElement, AnyTooltip, AnyView, App, AppContext, Arena, Asset, + AsyncWindowContext, AvailableSpace, Background, BorderStyle, Bounds, BoxShadow, Context, + Corners, CursorStyle, Decorations, DevicePixels, DispatchActionListener, DispatchNodeId, + DispatchTree, DisplayId, Edges, Effect, Entity, EntityId, EventEmitter, FileDropEvent, FontId, + Global, GlobalElementId, GlyphId, GpuSpecs, Hsla, InputHandler, IsZero, KeyBinding, KeyContext, + KeyDownEvent, KeyEvent, Keystroke, KeystrokeEvent, LayoutId, LineLayoutIndex, Modifiers, + ModifiersChangedEvent, MonochromeSprite, MouseButton, MouseEvent, MouseMoveEvent, MouseUpEvent, + Path, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, + PlatformWindow, Point, PolychromeSprite, PromptLevel, Quad, Render, RenderGlyphParams, + RenderImage, RenderImageParams, RenderSvgParams, Replay, ResizeEdge, SMOOTH_SVG_SCALE_FACTOR, + SUBPIXEL_VARIANTS, ScaledPixels, Scene, Shadow, SharedString, Size, StrikethroughStyle, Style, SubscriberSet, Subscription, TaffyLayoutEngine, Task, TextStyle, TextStyleRefinement, TransformationMatrix, Underline, UnderlineStyle, WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowControls, WindowDecorations, WindowOptions, WindowParams, WindowTextSystem, - SMOOTH_SVG_SCALE_FACTOR, SUBPIXEL_VARIANTS, + point, prelude::*, px, size, transparent_black, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::{FxHashMap, FxHashSet}; #[cfg(target_os = "macos")] use core_video::pixel_buffer::CVPixelBuffer; use derive_more::{Deref, DerefMut}; -use futures::channel::oneshot; use futures::FutureExt; +use futures::channel::oneshot; use parking_lot::RwLock; use raw_window_handle::{HandleError, HasWindowHandle}; use refineable::Refineable; @@ -39,13 +39,13 @@ use std::{ ops::{DerefMut, Range}, rc::Rc, sync::{ - atomic::{AtomicUsize, Ordering::SeqCst}, Arc, Weak, + atomic::{AtomicUsize, Ordering::SeqCst}, }, time::{Duration, Instant}, }; use util::post_inc; -use util::{measure, ResultExt}; +use util::{ResultExt, measure}; use uuid::Uuid; mod prompts; diff --git a/crates/gpui/src/window/prompts.rs b/crates/gpui/src/window/prompts.rs index 3c52afc1b0..f3307b3861 100644 --- a/crates/gpui/src/window/prompts.rs +++ b/crates/gpui/src/window/prompts.rs @@ -3,9 +3,9 @@ use std::ops::Deref; use futures::channel::oneshot; use crate::{ - div, opaque_grey, white, AnyView, App, AppContext as _, Context, Entity, EventEmitter, - FocusHandle, Focusable, InteractiveElement, IntoElement, ParentElement, PromptLevel, Render, - StatefulInteractiveElement, Styled, + AnyView, App, AppContext as _, Context, Entity, EventEmitter, FocusHandle, Focusable, + InteractiveElement, IntoElement, ParentElement, PromptLevel, Render, + StatefulInteractiveElement, Styled, div, opaque_grey, white, }; use super::Window; diff --git a/crates/gpui_macros/src/derive_app_context.rs b/crates/gpui_macros/src/derive_app_context.rs index 37ef83e3b8..bca015b8dc 100644 --- a/crates/gpui_macros/src/derive_app_context.rs +++ b/crates/gpui_macros/src/derive_app_context.rs @@ -1,6 +1,6 @@ use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, DeriveInput}; +use syn::{DeriveInput, parse_macro_input}; use crate::get_simple_attribute_field; diff --git a/crates/gpui_macros/src/derive_into_element.rs b/crates/gpui_macros/src/derive_into_element.rs index 4e244e8053..a737458569 100644 --- a/crates/gpui_macros/src/derive_into_element.rs +++ b/crates/gpui_macros/src/derive_into_element.rs @@ -1,6 +1,6 @@ use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, DeriveInput}; +use syn::{DeriveInput, parse_macro_input}; pub fn derive_into_element(input: TokenStream) -> TokenStream { let ast = parse_macro_input!(input as DeriveInput); diff --git a/crates/gpui_macros/src/derive_path_static_str.rs b/crates/gpui_macros/src/derive_path_static_str.rs index 25531fd2ad..80ac813c4a 100644 --- a/crates/gpui_macros/src/derive_path_static_str.rs +++ b/crates/gpui_macros/src/derive_path_static_str.rs @@ -1,6 +1,6 @@ use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, Attribute, Data, DeriveInput, Lit, Meta, NestedMeta}; +use syn::{Attribute, Data, DeriveInput, Lit, Meta, NestedMeta, parse_macro_input}; pub fn derive_path_static_str(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput); diff --git a/crates/gpui_macros/src/derive_render.rs b/crates/gpui_macros/src/derive_render.rs index 2be0177d32..3e0dcbc993 100644 --- a/crates/gpui_macros/src/derive_render.rs +++ b/crates/gpui_macros/src/derive_render.rs @@ -1,6 +1,6 @@ use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, DeriveInput}; +use syn::{DeriveInput, parse_macro_input}; pub fn derive_render(input: TokenStream) -> TokenStream { let ast = parse_macro_input!(input as DeriveInput); diff --git a/crates/gpui_macros/src/derive_visual_context.rs b/crates/gpui_macros/src/derive_visual_context.rs index 97a0c7493b..f2681bb29b 100644 --- a/crates/gpui_macros/src/derive_visual_context.rs +++ b/crates/gpui_macros/src/derive_visual_context.rs @@ -1,6 +1,6 @@ use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, DeriveInput}; +use syn::{DeriveInput, parse_macro_input}; use super::get_simple_attribute_field; diff --git a/crates/gpui_macros/src/styles.rs b/crates/gpui_macros/src/styles.rs index 20d36c1c91..b8a4d8ac2f 100644 --- a/crates/gpui_macros/src/styles.rs +++ b/crates/gpui_macros/src/styles.rs @@ -2,9 +2,9 @@ use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; use quote::{format_ident, quote}; use syn::{ - braced, + Token, Visibility, braced, parse::{Parse, ParseStream, Result}, - parse_macro_input, Token, Visibility, + parse_macro_input, }; #[derive(Debug)] diff --git a/crates/gpui_macros/src/test.rs b/crates/gpui_macros/src/test.rs index 5ee4662ff3..62edca2489 100644 --- a/crates/gpui_macros/src/test.rs +++ b/crates/gpui_macros/src/test.rs @@ -3,8 +3,8 @@ use proc_macro2::Ident; use quote::{format_ident, quote}; use std::mem; use syn::{ - parse_quote, spanned::Spanned, AttributeArgs, FnArg, ItemFn, Lit, Meta, MetaList, NestedMeta, - PathSegment, Type, + AttributeArgs, FnArg, ItemFn, Lit, Meta, MetaList, NestedMeta, PathSegment, Type, parse_quote, + spanned::Spanned, }; pub fn test(args: TokenStream, function: TokenStream) -> TokenStream { diff --git a/crates/html_to_markdown/src/structure/wikipedia.rs b/crates/html_to_markdown/src/structure/wikipedia.rs index fdbc6bc982..c8d399a661 100644 --- a/crates/html_to_markdown/src/structure/wikipedia.rs +++ b/crates/html_to_markdown/src/structure/wikipedia.rs @@ -1,6 +1,6 @@ +use crate::HandleTag; use crate::html_element::HtmlElement; use crate::markdown_writer::{HandlerOutcome, MarkdownWriter, StartTagOutcome}; -use crate::HandleTag; pub struct WikipediaChromeRemover; @@ -148,7 +148,7 @@ mod tests { use indoc::indoc; use pretty_assertions::assert_eq; - use crate::{convert_html_to_markdown, markdown, TagHandler}; + use crate::{TagHandler, convert_html_to_markdown, markdown}; use super::*; diff --git a/crates/http_client/src/github.rs b/crates/http_client/src/github.rs index 649daa9e31..bace2f989f 100644 --- a/crates/http_client/src/github.rs +++ b/crates/http_client/src/github.rs @@ -1,5 +1,5 @@ use crate::HttpClient; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use futures::AsyncReadExt; use serde::Deserialize; use std::sync::Arc; @@ -147,7 +147,7 @@ pub fn build_asset_url(repo_name_with_owner: &str, tag: &str, kind: AssetKind) - #[cfg(test)] mod tests { - use crate::github::{build_asset_url, AssetKind}; + use crate::github::{AssetKind, build_asset_url}; #[test] fn test_build_asset_url() { diff --git a/crates/http_client/src/http_client.rs b/crates/http_client/src/http_client.rs index ebf296c27d..cbbc2f710b 100644 --- a/crates/http_client/src/http_client.rs +++ b/crates/http_client/src/http_client.rs @@ -1,7 +1,7 @@ mod async_body; pub mod github; -pub use anyhow::{anyhow, Result}; +pub use anyhow::{Result, anyhow}; pub use async_body::{AsyncBody, Inner}; use derive_more::Deref; pub use http::{self, Method, Request, Response, StatusCode, Uri}; diff --git a/crates/image_viewer/src/image_info.rs b/crates/image_viewer/src/image_info.rs index dfee77a22f..365a2e381d 100644 --- a/crates/image_viewer/src/image_info.rs +++ b/crates/image_viewer/src/image_info.rs @@ -1,4 +1,4 @@ -use gpui::{div, Context, Entity, IntoElement, ParentElement, Render, Subscription}; +use gpui::{Context, Entity, IntoElement, ParentElement, Render, Subscription, div}; use project::image_store::{ImageFormat, ImageMetadata}; use settings::Settings; use ui::prelude::*; diff --git a/crates/image_viewer/src/image_viewer.rs b/crates/image_viewer/src/image_viewer.rs index 43e1d7c21e..b9efa8aaa5 100644 --- a/crates/image_viewer/src/image_viewer.rs +++ b/crates/image_viewer/src/image_viewer.rs @@ -4,22 +4,22 @@ mod image_viewer_settings; use std::path::PathBuf; use anyhow::Context as _; -use editor::{items::entry_git_aware_label_color, EditorSettings}; +use editor::{EditorSettings, items::entry_git_aware_label_color}; use file_icons::FileIcons; use gpui::{ - canvas, div, fill, img, opaque_grey, point, size, AnyElement, App, Bounds, Context, Entity, - EventEmitter, FocusHandle, Focusable, InteractiveElement, IntoElement, ObjectFit, - ParentElement, Render, Styled, Task, WeakEntity, Window, + AnyElement, App, Bounds, Context, Entity, EventEmitter, FocusHandle, Focusable, + InteractiveElement, IntoElement, ObjectFit, ParentElement, Render, Styled, Task, WeakEntity, + Window, canvas, div, fill, img, opaque_grey, point, size, }; use persistence::IMAGE_VIEWER; -use project::{image_store::ImageItemEvent, ImageItem, Project, ProjectPath}; +use project::{ImageItem, Project, ProjectPath, image_store::ImageItemEvent}; use settings::Settings; use theme::Theme; use ui::prelude::*; use util::paths::PathExt; use workspace::{ - item::{BreadcrumbText, Item, ProjectItem, SerializableItem, TabContentParams}, ItemId, ItemSettings, Pane, ToolbarItemLocation, Workspace, WorkspaceId, + item::{BreadcrumbText, Item, ProjectItem, SerializableItem, TabContentParams}, }; pub use crate::image_info::*; diff --git a/crates/indexed_docs/src/providers/rustdoc.rs b/crates/indexed_docs/src/providers/rustdoc.rs index d4a69f0ebf..cda93fdc53 100644 --- a/crates/indexed_docs/src/providers/rustdoc.rs +++ b/crates/indexed_docs/src/providers/rustdoc.rs @@ -12,7 +12,7 @@ use std::path::PathBuf; use std::sync::{Arc, LazyLock}; use std::time::{Duration, Instant}; -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use async_trait::async_trait; use collections::{HashSet, VecDeque}; use fs::Fs; @@ -209,9 +209,12 @@ impl IndexedDocsProvider for DocsDotRsProvider { async fn index_rustdoc( package: PackageName, database: Arc, - fetch_page: impl Fn(&PackageName, Option<&RustdocItem>) -> BoxFuture<'static, Result>> - + Send - + Sync, + fetch_page: impl Fn( + &PackageName, + Option<&RustdocItem>, + ) -> BoxFuture<'static, Result>> + + Send + + Sync, ) -> Result<()> { let Some(package_root_content) = fetch_page(&package, None).await? else { return Ok(()); diff --git a/crates/indexed_docs/src/providers/rustdoc/to_markdown.rs b/crates/indexed_docs/src/providers/rustdoc/to_markdown.rs index 63d5d7913c..87e3863728 100644 --- a/crates/indexed_docs/src/providers/rustdoc/to_markdown.rs +++ b/crates/indexed_docs/src/providers/rustdoc/to_markdown.rs @@ -7,8 +7,8 @@ use html_to_markdown::markdown::{ HeadingHandler, ListHandler, ParagraphHandler, StyledTextHandler, TableHandler, }; use html_to_markdown::{ - convert_html_to_markdown, HandleTag, HandlerOutcome, HtmlElement, MarkdownWriter, - StartTagOutcome, TagHandler, + HandleTag, HandlerOutcome, HtmlElement, MarkdownWriter, StartTagOutcome, TagHandler, + convert_html_to_markdown, }; use indexmap::IndexSet; use strum::IntoEnumIterator; @@ -326,7 +326,7 @@ impl HandleTag for RustdocItemCollector { #[cfg(test)] mod tests { - use html_to_markdown::{convert_html_to_markdown, TagHandler}; + use html_to_markdown::{TagHandler, convert_html_to_markdown}; use indoc::indoc; use pretty_assertions::assert_eq; diff --git a/crates/indexed_docs/src/store.rs b/crates/indexed_docs/src/store.rs index 41bdaad817..191075a2a9 100644 --- a/crates/indexed_docs/src/store.rs +++ b/crates/indexed_docs/src/store.rs @@ -1,17 +1,17 @@ use std::path::PathBuf; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use collections::HashMap; use derive_more::{Deref, Display}; -use futures::future::{self, BoxFuture, Shared}; use futures::FutureExt; +use futures::future::{self, BoxFuture, Shared}; use fuzzy::StringMatchCandidate; use gpui::{App, BackgroundExecutor, Task}; -use heed::types::SerdeBincode; use heed::Database; +use heed::types::SerdeBincode; use parking_lot::RwLock; use serde::{Deserialize, Serialize}; use util::ResultExt; diff --git a/crates/inline_completion_button/src/inline_completion_button.rs b/crates/inline_completion_button/src/inline_completion_button.rs index 3316331545..0ff98fbc54 100644 --- a/crates/inline_completion_button/src/inline_completion_button.rs +++ b/crates/inline_completion_button/src/inline_completion_button.rs @@ -2,36 +2,36 @@ use anyhow::Result; use client::UserStore; use copilot::{Copilot, Status}; use editor::{ + Editor, actions::{ShowEditPrediction, ToggleEditPrediction}, scroll::Autoscroll, - Editor, }; use feature_flags::{FeatureFlagAppExt, PredictEditsRateCompletionsFeatureFlag}; use fs::Fs; use gpui::{ - actions, div, pulsating_between, Action, Animation, AnimationExt, App, AsyncWindowContext, - Corner, Entity, FocusHandle, Focusable, IntoElement, ParentElement, Render, Subscription, - WeakEntity, + Action, Animation, AnimationExt, App, AsyncWindowContext, Corner, Entity, FocusHandle, + Focusable, IntoElement, ParentElement, Render, Subscription, WeakEntity, actions, div, + pulsating_between, }; use indoc::indoc; use language::{ - language_settings::{self, all_language_settings, AllLanguageSettings, EditPredictionProvider}, EditPredictionsMode, File, Language, + language_settings::{self, AllLanguageSettings, EditPredictionProvider, all_language_settings}, }; use regex::Regex; -use settings::{update_settings_file, Settings, SettingsStore}; +use settings::{Settings, SettingsStore, update_settings_file}; use std::{ sync::{Arc, LazyLock}, time::Duration, }; use supermaven::{AccountStatus, Supermaven}; use ui::{ - prelude::*, Clickable, ContextMenu, ContextMenuEntry, IconButton, IconButtonShape, Indicator, - PopoverMenu, PopoverMenuHandle, Tooltip, + Clickable, ContextMenu, ContextMenuEntry, IconButton, IconButtonShape, Indicator, PopoverMenu, + PopoverMenuHandle, Tooltip, prelude::*, }; use workspace::{ - create_and_open_local_file, item::ItemHandle, notifications::NotificationId, StatusItemView, - Toast, Workspace, + StatusItemView, Toast, Workspace, create_and_open_local_file, item::ItemHandle, + notifications::NotificationId, }; use zed_actions::OpenBrowser; use zeta::RateCompletions; diff --git a/crates/install_cli/src/install_cli.rs b/crates/install_cli/src/install_cli.rs index 3bee8d6c58..720b0d10fa 100644 --- a/crates/install_cli/src/install_cli.rs +++ b/crates/install_cli/src/install_cli.rs @@ -1,5 +1,5 @@ -use anyhow::{anyhow, Result}; -use gpui::{actions, AsyncApp}; +use anyhow::{Result, anyhow}; +use gpui::{AsyncApp, actions}; use std::path::{Path, PathBuf}; use util::ResultExt; diff --git a/crates/journal/src/journal.rs b/crates/journal/src/journal.rs index 0219a1efed..b75ae93825 100644 --- a/crates/journal/src/journal.rs +++ b/crates/journal/src/journal.rs @@ -1,8 +1,8 @@ use anyhow::Result; use chrono::{Datelike, Local, NaiveTime, Timelike}; -use editor::scroll::Autoscroll; use editor::Editor; -use gpui::{actions, App, AppContext as _, Context, Window}; +use editor::scroll::Autoscroll; +use gpui::{App, AppContext as _, Context, Window, actions}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsSources}; diff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rs index 8536874058..8ec6a9c47e 100644 --- a/crates/language/src/buffer.rs +++ b/crates/language/src/buffer.rs @@ -1,11 +1,14 @@ pub use crate::{ + Grammar, Language, LanguageRegistry, diagnostic_set::DiagnosticSet, highlight_map::{HighlightId, HighlightMap}, - proto, Grammar, Language, LanguageRegistry, + proto, }; use crate::{ + LanguageScope, Outline, OutlineConfig, RunnableCapture, RunnableTag, TextObject, + TreeSitterOptions, diagnostic_set::{DiagnosticEntry, DiagnosticGroup}, - language_settings::{language_settings, LanguageSettings}, + language_settings::{LanguageSettings, language_settings}, outline::OutlineItem, syntax_map::{ SyntaxLayer, SyntaxMap, SyntaxMapCapture, SyntaxMapCaptures, SyntaxMapMatch, @@ -13,10 +16,8 @@ use crate::{ }, task_context::RunnableRange, text_diff::text_diff, - LanguageScope, Outline, OutlineConfig, RunnableCapture, RunnableTag, TextObject, - TreeSitterOptions, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_watch as watch; use clock::Lamport; pub use clock::ReplicaId; @@ -66,7 +67,7 @@ pub use text::{ use theme::{ActiveTheme as _, SyntaxTheme}; #[cfg(any(test, feature = "test-support"))] use util::RandomCharIter; -use util::{debug_panic, maybe, RangeExt}; +use util::{RangeExt, debug_panic, maybe}; #[cfg(any(test, feature = "test-support"))] pub use {tree_sitter_rust, tree_sitter_typescript}; @@ -3742,47 +3743,49 @@ impl BufferSnapshot { let mut captures = Vec::<(Range, TextObject)>::new(); - iter::from_fn(move || loop { - while let Some(capture) = captures.pop() { - if capture.0.overlaps(&range) { - return Some(capture); - } - } - - let mat = matches.peek()?; - - let Some(config) = configs[mat.grammar_index].as_ref() else { - matches.advance(); - continue; - }; - - for capture in mat.captures { - let Some(ix) = config - .text_objects_by_capture_ix - .binary_search_by_key(&capture.index, |e| e.0) - .ok() - else { - continue; - }; - let text_object = config.text_objects_by_capture_ix[ix].1; - let byte_range = capture.node.byte_range(); - - let mut found = false; - for (range, existing) in captures.iter_mut() { - if existing == &text_object { - range.start = range.start.min(byte_range.start); - range.end = range.end.max(byte_range.end); - found = true; - break; + iter::from_fn(move || { + loop { + while let Some(capture) = captures.pop() { + if capture.0.overlaps(&range) { + return Some(capture); } } - if !found { - captures.push((byte_range, text_object)); - } - } + let mat = matches.peek()?; - matches.advance(); + let Some(config) = configs[mat.grammar_index].as_ref() else { + matches.advance(); + continue; + }; + + for capture in mat.captures { + let Some(ix) = config + .text_objects_by_capture_ix + .binary_search_by_key(&capture.index, |e| e.0) + .ok() + else { + continue; + }; + let text_object = config.text_objects_by_capture_ix[ix].1; + let byte_range = capture.node.byte_range(); + + let mut found = false; + for (range, existing) in captures.iter_mut() { + if existing == &text_object { + range.start = range.start.min(byte_range.start); + range.end = range.end.max(byte_range.end); + found = true; + break; + } + } + + if !found { + captures.push((byte_range, text_object)); + } + } + + matches.advance(); + } }) } @@ -4092,11 +4095,7 @@ impl BufferSnapshot { .then(a.diagnostic.severity.cmp(&b.diagnostic.severity)) // and stabilize order with group_id .then(a.diagnostic.group_id.cmp(&b.diagnostic.group_id)); - if reversed { - cmp.reverse() - } else { - cmp - } + if reversed { cmp.reverse() } else { cmp } })?; iterators[next_ix] .next() @@ -4699,22 +4698,24 @@ pub(crate) fn contiguous_ranges( ) -> impl Iterator> { let mut values = values; let mut current_range: Option> = None; - std::iter::from_fn(move || loop { - if let Some(value) = values.next() { - if let Some(range) = &mut current_range { - if value == range.end && range.len() < max_len { - range.end += 1; - continue; + std::iter::from_fn(move || { + loop { + if let Some(value) = values.next() { + if let Some(range) = &mut current_range { + if value == range.end && range.len() < max_len { + range.end += 1; + continue; + } } - } - let prev_range = current_range.clone(); - current_range = Some(value..(value + 1)); - if prev_range.is_some() { - return prev_range; + let prev_range = current_range.clone(); + current_range = Some(value..(value + 1)); + if prev_range.is_some() { + return prev_range; + } + } else { + return current_range.take(); } - } else { - return current_range.take(); } }) } diff --git a/crates/language/src/buffer_tests.rs b/crates/language/src/buffer_tests.rs index af5cd61dfe..6f0f25a897 100644 --- a/crates/language/src/buffer_tests.rs +++ b/crates/language/src/buffer_tests.rs @@ -1,8 +1,8 @@ use super::*; +use crate::Buffer; use crate::language_settings::{ AllLanguageSettings, AllLanguageSettingsContent, LanguageSettingsContent, }; -use crate::Buffer; use clock::ReplicaId; use collections::BTreeMap; use futures::FutureExt as _; @@ -27,7 +27,7 @@ use text::{Point, ToPoint}; use theme::ActiveTheme; use unindent::Unindent as _; use util::test::marked_text_offsets; -use util::{assert_set_eq, post_inc, test::marked_text_ranges, RandomCharIter}; +use util::{RandomCharIter, assert_set_eq, post_inc, test::marked_text_ranges}; pub static TRAILING_WHITESPACE_REGEX: LazyLock = LazyLock::new(|| { RegexBuilder::new(r"[ \t]+$") @@ -156,12 +156,14 @@ async fn test_first_line_pattern(cx: &mut TestAppContext) { ..Default::default() }); - assert!(cx - .read(|cx| languages.language_for_file(&file("the/script"), None, cx)) - .is_none()); - assert!(cx - .read(|cx| languages.language_for_file(&file("the/script"), Some(&"nothing".into()), cx)) - .is_none()); + assert!( + cx.read(|cx| languages.language_for_file(&file("the/script"), None, cx)) + .is_none() + ); + assert!( + cx.read(|cx| languages.language_for_file(&file("the/script"), Some(&"nothing".into()), cx)) + .is_none() + ); assert_eq!( cx.read(|cx| languages.language_for_file( diff --git a/crates/language/src/diagnostic_set.rs b/crates/language/src/diagnostic_set.rs index cff59c8004..661e3ef217 100644 --- a/crates/language/src/diagnostic_set.rs +++ b/crates/language/src/diagnostic_set.rs @@ -1,4 +1,4 @@ -use crate::{range_to_lsp, Diagnostic}; +use crate::{Diagnostic, range_to_lsp}; use anyhow::Result; use collections::HashMap; use lsp::LanguageServerId; diff --git a/crates/language/src/language.rs b/crates/language/src/language.rs index fb73f2c18d..9339fbbf1c 100644 --- a/crates/language/src/language.rs +++ b/crates/language/src/language.rs @@ -24,7 +24,7 @@ pub mod buffer_tests; pub use crate::language_settings::EditPredictionsMode; use crate::language_settings::SoftWrap; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_trait::async_trait; use collections::{HashMap, HashSet}; use fs::Fs; @@ -38,11 +38,11 @@ pub use manifest::{ManifestName, ManifestProvider, ManifestQuery}; use parking_lot::Mutex; use regex::Regex; use schemars::{ + JsonSchema, r#gen::SchemaGenerator, schema::{InstanceType, Schema, SchemaObject}, - JsonSchema, }; -use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; +use serde::{Deserialize, Deserializer, Serialize, Serializer, de}; use serde_json::Value; use settings::WorktreeId; use smol::future::FutureExt as _; @@ -57,18 +57,18 @@ use std::{ pin::Pin, str, sync::{ - atomic::{AtomicU64, AtomicUsize, Ordering::SeqCst}, Arc, LazyLock, + atomic::{AtomicU64, AtomicUsize, Ordering::SeqCst}, }, }; use std::{num::NonZeroU32, sync::OnceLock}; use syntax_map::{QueryCursorHandle, SyntaxSnapshot}; use task::RunnableTag; pub use task_context::{ContextProvider, RunnableRange}; -pub use text_diff::{line_diff, text_diff, text_diff_with_options, unified_diff, DiffOptions}; +pub use text_diff::{DiffOptions, line_diff, text_diff, text_diff_with_options, unified_diff}; use theme::SyntaxTheme; pub use toolchain::{LanguageToolchainStore, Toolchain, ToolchainList, ToolchainLister}; -use tree_sitter::{self, wasmtime, Query, QueryCursor, WasmStore}; +use tree_sitter::{self, Query, QueryCursor, WasmStore, wasmtime}; use util::serde::default_true; pub use buffer::Operation; diff --git a/crates/language/src/language_registry.rs b/crates/language/src/language_registry.rs index 79bcb871f4..e1de25c41b 100644 --- a/crates/language/src/language_registry.rs +++ b/crates/language/src/language_registry.rs @@ -1,17 +1,18 @@ use crate::{ + CachedLspAdapter, File, Language, LanguageConfig, LanguageId, LanguageMatcher, + LanguageServerName, LspAdapter, PLAIN_TEXT, ToolchainLister, language_settings::{ - all_language_settings, AllLanguageSettingsContent, LanguageSettingsContent, + AllLanguageSettingsContent, LanguageSettingsContent, all_language_settings, }, task_context::ContextProvider, - with_parser, CachedLspAdapter, File, Language, LanguageConfig, LanguageId, LanguageMatcher, - LanguageServerName, LspAdapter, ToolchainLister, PLAIN_TEXT, + with_parser, }; -use anyhow::{anyhow, Context as _, Result}; -use collections::{hash_map, HashMap, HashSet}; +use anyhow::{Context as _, Result, anyhow}; +use collections::{HashMap, HashSet, hash_map}; use futures::{ - channel::{mpsc, oneshot}, Future, + channel::{mpsc, oneshot}, }; use globset::GlobSet; use gpui::{App, BackgroundExecutor, SharedString}; @@ -31,7 +32,7 @@ use sum_tree::Bias; use text::{Point, Rope}; use theme::Theme; use unicase::UniCase; -use util::{maybe, post_inc, ResultExt}; +use util::{ResultExt, maybe, post_inc}; #[derive( Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, JsonSchema, diff --git a/crates/language/src/language_settings.rs b/crates/language/src/language_settings.rs index 70c1d29346..33e8ff4519 100644 --- a/crates/language/src/language_settings.rs +++ b/crates/language/src/language_settings.rs @@ -5,23 +5,23 @@ use anyhow::Result; use collections::{HashMap, HashSet}; use core::slice; use ec4rs::{ - property::{FinalNewline, IndentSize, IndentStyle, TabWidth, TrimTrailingWs}, Properties as EditorconfigProperties, + property::{FinalNewline, IndentSize, IndentStyle, TabWidth, TrimTrailingWs}, }; use globset::{Glob, GlobMatcher, GlobSet, GlobSetBuilder}; use gpui::{App, Modifiers}; use itertools::{Either, Itertools}; use schemars::{ - schema::{InstanceType, ObjectValidation, Schema, SchemaObject, SingleOrVec}, JsonSchema, + schema::{InstanceType, ObjectValidation, Schema, SchemaObject, SingleOrVec}, }; use serde::{ - de::{self, IntoDeserializer, MapAccess, SeqAccess, Visitor}, Deserialize, Deserializer, Serialize, + de::{self, IntoDeserializer, MapAccess, SeqAccess, Visitor}, }; use serde_json::Value; use settings::{ - add_references_to_properties, Settings, SettingsLocation, SettingsSources, SettingsStore, + Settings, SettingsLocation, SettingsSources, SettingsStore, add_references_to_properties, }; use std::{borrow::Cow, num::NonZeroU32, path::Path, sync::Arc}; use util::serde::default_true; @@ -1308,9 +1308,11 @@ impl settings::Settings for AllLanguageSettings { // Create a schema for a 'languages overrides' object, associating editor // settings with specific languages. - assert!(root_schema - .definitions - .contains_key("LanguageSettingsContent")); + assert!( + root_schema + .definitions + .contains_key("LanguageSettingsContent") + ); let languages_object_schema = SchemaObject { instance_type: Some(InstanceType::Object.into()), diff --git a/crates/language/src/proto.rs b/crates/language/src/proto.rs index a30b8b8a15..c5179a0e3c 100644 --- a/crates/language/src/proto.rs +++ b/crates/language/src/proto.rs @@ -1,7 +1,7 @@ //! Handles conversions of `language` items to and from the [`rpc`] protocol. -use crate::{diagnostic_set::DiagnosticEntry, CursorShape, Diagnostic}; -use anyhow::{anyhow, Context as _, Result}; +use crate::{CursorShape, Diagnostic, diagnostic_set::DiagnosticEntry}; +use anyhow::{Context as _, Result, anyhow}; use clock::ReplicaId; use lsp::{DiagnosticSeverity, LanguageServerId}; use rpc::proto; diff --git a/crates/language/src/syntax_map.rs b/crates/language/src/syntax_map.rs index 85107a530b..22d9669b78 100644 --- a/crates/language/src/syntax_map.rs +++ b/crates/language/src/syntax_map.rs @@ -2,7 +2,7 @@ mod syntax_map_tests; use crate::{ - with_parser, Grammar, InjectionConfig, Language, LanguageId, LanguageRegistry, QUERY_CURSORS, + Grammar, InjectionConfig, Language, LanguageId, LanguageRegistry, QUERY_CURSORS, with_parser, }; use collections::HashMap; use futures::FutureExt; @@ -1890,7 +1890,7 @@ impl fmt::Debug for LogChangedRegions<'_> { f.debug_list() .entries( self.0 - .0 + .0 .iter() .map(|region| LogAnchorRange(®ion.range, self.1)), ) diff --git a/crates/language/src/syntax_map/syntax_map_tests.rs b/crates/language/src/syntax_map/syntax_map_tests.rs index 7e78aa52b8..211edad87c 100644 --- a/crates/language/src/syntax_map/syntax_map_tests.rs +++ b/crates/language/src/syntax_map/syntax_map_tests.rs @@ -1,7 +1,7 @@ use super::*; use crate::{ - buffer_tests::{markdown_inline_lang, markdown_lang}, LanguageConfig, LanguageMatcher, + buffer_tests::{markdown_inline_lang, markdown_lang}, }; use gpui::App; use rand::rngs::StdRng; diff --git a/crates/language/src/text_diff.rs b/crates/language/src/text_diff.rs index 83c4aba3bb..fd95830d66 100644 --- a/crates/language/src/text_diff.rs +++ b/crates/language/src/text_diff.rs @@ -1,9 +1,8 @@ use crate::{CharClassifier, CharKind, LanguageScope}; use imara_diff::{ - diff, + Algorithm, UnifiedDiffBuilder, diff, intern::{InternedInput, Token}, sources::lines_with_terminator, - Algorithm, UnifiedDiffBuilder, }; use std::{iter, ops::Range, sync::Arc}; diff --git a/crates/language_extension/src/extension_lsp_adapter.rs b/crates/language_extension/src/extension_lsp_adapter.rs index 148e5b5902..ae325edbd8 100644 --- a/crates/language_extension/src/extension_lsp_adapter.rs +++ b/crates/language_extension/src/extension_lsp_adapter.rs @@ -18,7 +18,7 @@ use language::{ use lsp::{CodeActionKind, LanguageServerBinary, LanguageServerBinaryOptions, LanguageServerName}; use serde::Serialize; use serde_json::Value; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; use crate::LanguageServerRegistryProxy; diff --git a/crates/language_model/src/fake_provider.rs b/crates/language_model/src/fake_provider.rs index 0e4c0748fc..9ce8ba333a 100644 --- a/crates/language_model/src/fake_provider.rs +++ b/crates/language_model/src/fake_provider.rs @@ -3,7 +3,7 @@ use crate::{ LanguageModelName, LanguageModelProvider, LanguageModelProviderId, LanguageModelProviderName, LanguageModelProviderState, LanguageModelRequest, }; -use futures::{channel::mpsc, future::BoxFuture, stream::BoxStream, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, channel::mpsc, future::BoxFuture, stream::BoxStream}; use gpui::{AnyView, App, AsyncApp, Entity, Task, Window}; use http_client::Result; use parking_lot::Mutex; diff --git a/crates/language_model/src/language_model.rs b/crates/language_model/src/language_model.rs index 845eff45a5..38b4a10489 100644 --- a/crates/language_model/src/language_model.rs +++ b/crates/language_model/src/language_model.rs @@ -11,13 +11,13 @@ pub mod fake_provider; use anyhow::Result; use client::Client; use futures::FutureExt; -use futures::{future::BoxFuture, stream::BoxStream, StreamExt, TryStreamExt as _}; +use futures::{StreamExt, TryStreamExt as _, future::BoxFuture, stream::BoxStream}; use gpui::{AnyElement, AnyView, App, AsyncApp, SharedString, Task, Window}; use icons::IconName; use parking_lot::Mutex; use proto::Plan; use schemars::JsonSchema; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::DeserializeOwned}; use std::fmt; use std::ops::{Add, Sub}; use std::{future::Future, sync::Arc}; diff --git a/crates/language_model/src/registry.rs b/crates/language_model/src/registry.rs index 0c7d3f167f..93882eafb9 100644 --- a/crates/language_model/src/registry.rs +++ b/crates/language_model/src/registry.rs @@ -3,7 +3,7 @@ use crate::{ LanguageModelProviderState, }; use collections::BTreeMap; -use gpui::{prelude::*, App, Context, Entity, EventEmitter, Global}; +use gpui::{App, Context, Entity, EventEmitter, Global, prelude::*}; use std::sync::Arc; pub fn init(cx: &mut App) { diff --git a/crates/language_model/src/request.rs b/crates/language_model/src/request.rs index 25ab642fc9..696e3644f6 100644 --- a/crates/language_model/src/request.rs +++ b/crates/language_model/src/request.rs @@ -5,10 +5,10 @@ use crate::role::Role; use crate::{LanguageModelToolUse, LanguageModelToolUseId}; use base64::write::EncoderWriter; use gpui::{ - point, px, size, App, AppContext as _, DevicePixels, Image, ObjectFit, RenderImage, - SharedString, Size, Task, + App, AppContext as _, DevicePixels, Image, ObjectFit, RenderImage, SharedString, Size, Task, + point, px, size, }; -use image::{codecs::png::PngEncoder, imageops::resize, DynamicImage, ImageDecoder}; +use image::{DynamicImage, ImageDecoder, codecs::png::PngEncoder, imageops::resize}; use serde::{Deserialize, Serialize}; use util::ResultExt; diff --git a/crates/language_model/src/telemetry.rs b/crates/language_model/src/telemetry.rs index 0454d43c73..c24ec97700 100644 --- a/crates/language_model/src/telemetry.rs +++ b/crates/language_model/src/telemetry.rs @@ -1,5 +1,5 @@ -use anthropic::{AnthropicError, ANTHROPIC_API_URL}; -use anyhow::{anyhow, Context as _, Result}; +use anthropic::{ANTHROPIC_API_URL, AnthropicError}; +use anyhow::{Context as _, Result, anyhow}; use client::telemetry::Telemetry; use gpui::BackgroundExecutor; use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest}; diff --git a/crates/language_model_selector/src/language_model_selector.rs b/crates/language_model_selector/src/language_model_selector.rs index 2acf78a5d2..b6ef5a77eb 100644 --- a/crates/language_model_selector/src/language_model_selector.rs +++ b/crates/language_model_selector/src/language_model_selector.rs @@ -2,15 +2,15 @@ use std::sync::Arc; use feature_flags::ZedPro; use gpui::{ - action_with_deprecated_aliases, Action, AnyElement, AnyView, App, Corner, DismissEvent, Entity, - EventEmitter, FocusHandle, Focusable, Subscription, Task, WeakEntity, + Action, AnyElement, AnyView, App, Corner, DismissEvent, Entity, EventEmitter, FocusHandle, + Focusable, Subscription, Task, WeakEntity, action_with_deprecated_aliases, }; use language_model::{ AuthenticateError, LanguageModel, LanguageModelAvailability, LanguageModelRegistry, }; use picker::{Picker, PickerDelegate}; use proto::Plan; -use ui::{prelude::*, ListItem, ListItemSpacing, PopoverMenu, PopoverMenuHandle, PopoverTrigger}; +use ui::{ListItem, ListItemSpacing, PopoverMenu, PopoverMenuHandle, PopoverTrigger, prelude::*}; use workspace::ShowConfiguration; action_with_deprecated_aliases!( diff --git a/crates/language_models/src/provider/anthropic.rs b/crates/language_models/src/provider/anthropic.rs index b3daaf2ecf..7694455cb7 100644 --- a/crates/language_models/src/provider/anthropic.rs +++ b/crates/language_models/src/provider/anthropic.rs @@ -1,12 +1,12 @@ -use crate::ui::InstructionListItem; use crate::AllLanguageModelSettings; +use crate::ui::InstructionListItem; use anthropic::{AnthropicError, AnthropicModelMode, ContentDelta, Event, ResponseContent, Usage}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::{BTreeMap, HashMap}; use credentials_provider::CredentialsProvider; use editor::{Editor, EditorElement, EditorStyle}; use futures::Stream; -use futures::{future::BoxFuture, stream::BoxStream, FutureExt, StreamExt, TryStreamExt as _}; +use futures::{FutureExt, StreamExt, TryStreamExt as _, future::BoxFuture, stream::BoxStream}; use gpui::{ AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace, }; @@ -25,8 +25,8 @@ use std::str::FromStr; use std::sync::Arc; use strum::IntoEnumIterator; use theme::ThemeSettings; -use ui::{prelude::*, Icon, IconName, List, Tooltip}; -use util::{maybe, ResultExt}; +use ui::{Icon, IconName, List, Tooltip, prelude::*}; +use util::{ResultExt, maybe}; const PROVIDER_ID: &str = language_model::ANTHROPIC_PROVIDER_ID; const PROVIDER_NAME: &str = "Anthropic"; diff --git a/crates/language_models/src/provider/bedrock.rs b/crates/language_models/src/provider/bedrock.rs index 894b04a2e7..4b84e85591 100644 --- a/crates/language_models/src/provider/bedrock.rs +++ b/crates/language_models/src/provider/bedrock.rs @@ -3,9 +3,9 @@ use std::str::FromStr; use std::sync::Arc; use crate::ui::InstructionListItem; -use anyhow::{anyhow, Context as _, Result}; -use aws_config::stalled_stream_protection::StalledStreamProtectionConfig; +use anyhow::{Context as _, Result, anyhow}; use aws_config::Region; +use aws_config::stalled_stream_protection::StalledStreamProtectionConfig; use aws_credential_types::Credentials; use aws_http_client::AwsHttpClient; use bedrock::bedrock_client::types::{ @@ -13,13 +13,14 @@ use bedrock::bedrock_client::types::{ }; use bedrock::bedrock_client::{self, Config}; use bedrock::{ - value_to_aws_document, BedrockError, BedrockInnerContent, BedrockMessage, BedrockSpecificTool, + BedrockError, BedrockInnerContent, BedrockMessage, BedrockSpecificTool, BedrockStreamingResponse, BedrockTool, BedrockToolChoice, BedrockToolInputSchema, Model, + value_to_aws_document, }; use collections::{BTreeMap, HashMap}; use credentials_provider::CredentialsProvider; use editor::{Editor, EditorElement, EditorStyle}; -use futures::{future::BoxFuture, stream::BoxStream, FutureExt, Stream, StreamExt}; +use futures::{FutureExt, Stream, StreamExt, future::BoxFuture, stream::BoxStream}; use gpui::{ AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace, }; @@ -38,8 +39,8 @@ use settings::{Settings, SettingsStore}; use strum::IntoEnumIterator; use theme::ThemeSettings; use tokio::runtime::Handle; -use ui::{prelude::*, Icon, IconName, List, Tooltip}; -use util::{maybe, ResultExt}; +use ui::{Icon, IconName, List, Tooltip, prelude::*}; +use util::{ResultExt, maybe}; use crate::AllLanguageModelSettings; diff --git a/crates/language_models/src/provider/cloud.rs b/crates/language_models/src/provider/cloud.rs index 376d5cd3f5..ee6ab37e5f 100644 --- a/crates/language_models/src/provider/cloud.rs +++ b/crates/language_models/src/provider/cloud.rs @@ -1,14 +1,14 @@ use anthropic::{AnthropicError, AnthropicModelMode}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use client::{ - zed_urls, Client, PerformCompletionParams, UserStore, EXPIRED_LLM_TOKEN_HEADER_NAME, - MAX_LLM_MONTHLY_SPEND_REACHED_HEADER_NAME, + Client, EXPIRED_LLM_TOKEN_HEADER_NAME, MAX_LLM_MONTHLY_SPEND_REACHED_HEADER_NAME, + PerformCompletionParams, UserStore, zed_urls, }; use collections::BTreeMap; use feature_flags::{FeatureFlagAppExt, LlmClosedBeta, ZedPro}; use futures::{ - future::BoxFuture, stream::BoxStream, AsyncBufReadExt, FutureExt, Stream, StreamExt, - TryStreamExt as _, + AsyncBufReadExt, FutureExt, Stream, StreamExt, TryStreamExt as _, future::BoxFuture, + stream::BoxStream, }; use gpui::{AnyElement, AnyView, App, AsyncApp, Context, Entity, Subscription, Task}; use http_client::{AsyncBody, HttpClient, Method, Response, StatusCode}; @@ -23,25 +23,25 @@ use language_model::{ MaxMonthlySpendReachedError, PaymentRequiredError, RefreshLlmTokenListener, }; use schemars::JsonSchema; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::DeserializeOwned}; use serde_json::value::RawValue; use settings::{Settings, SettingsStore}; -use smol::io::{AsyncReadExt, BufReader}; use smol::Timer; +use smol::io::{AsyncReadExt, BufReader}; use std::{ future, sync::{Arc, LazyLock}, time::Duration, }; use strum::IntoEnumIterator; -use ui::{prelude::*, TintColor}; +use ui::{TintColor, prelude::*}; +use crate::AllLanguageModelSettings; use crate::provider::anthropic::{ count_anthropic_tokens, into_anthropic, map_to_language_model_completion_events, }; use crate::provider::google::into_google; use crate::provider::open_ai::{count_open_ai_tokens, into_open_ai}; -use crate::AllLanguageModelSettings; pub const PROVIDER_NAME: &str = "Zed"; diff --git a/crates/language_models/src/provider/copilot_chat.rs b/crates/language_models/src/provider/copilot_chat.rs index da9ebbdb28..1307fdb511 100644 --- a/crates/language_models/src/provider/copilot_chat.rs +++ b/crates/language_models/src/provider/copilot_chat.rs @@ -1,7 +1,7 @@ use std::future; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use copilot::copilot_chat::{ ChatMessage, CopilotChat, Model as CopilotChatModel, Request as CopilotChatRequest, Role as CopilotChatRole, @@ -11,8 +11,8 @@ use futures::future::BoxFuture; use futures::stream::BoxStream; use futures::{FutureExt, StreamExt}; use gpui::{ - percentage, svg, Action, Animation, AnimationExt, AnyView, App, AsyncApp, Entity, Render, - Subscription, Task, Transformation, + Action, Animation, AnimationExt, AnyView, App, AsyncApp, Entity, Render, Subscription, Task, + Transformation, percentage, svg, }; use language_model::{ AuthenticateError, LanguageModel, LanguageModelCompletionEvent, LanguageModelId, diff --git a/crates/language_models/src/provider/deepseek.rs b/crates/language_models/src/provider/deepseek.rs index 760d6b538b..1e33e1071b 100644 --- a/crates/language_models/src/provider/deepseek.rs +++ b/crates/language_models/src/provider/deepseek.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::BTreeMap; use credentials_provider::CredentialsProvider; use editor::{Editor, EditorElement, EditorStyle}; -use futures::{future::BoxFuture, stream::BoxStream, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, future::BoxFuture, stream::BoxStream}; use gpui::{ AnyView, AppContext as _, AsyncApp, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace, @@ -18,10 +18,10 @@ use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsStore}; use std::sync::Arc; use theme::ThemeSettings; -use ui::{prelude::*, Icon, IconName, List}; +use ui::{Icon, IconName, List, prelude::*}; use util::ResultExt; -use crate::{ui::InstructionListItem, AllLanguageModelSettings}; +use crate::{AllLanguageModelSettings, ui::InstructionListItem}; const PROVIDER_ID: &str = "deepseek"; const PROVIDER_NAME: &str = "DeepSeek"; diff --git a/crates/language_models/src/provider/google.rs b/crates/language_models/src/provider/google.rs index 1952d8777a..70ce0832c5 100644 --- a/crates/language_models/src/provider/google.rs +++ b/crates/language_models/src/provider/google.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::BTreeMap; use credentials_provider::CredentialsProvider; use editor::{Editor, EditorElement, EditorStyle}; -use futures::{future::BoxFuture, FutureExt, Stream, StreamExt}; +use futures::{FutureExt, Stream, StreamExt, future::BoxFuture}; use google_ai::{FunctionDeclaration, GenerateContentResponse, Part, UsageMetadata}; use gpui::{ AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace, @@ -24,11 +24,11 @@ use std::pin::Pin; use std::sync::Arc; use strum::IntoEnumIterator; use theme::ThemeSettings; -use ui::{prelude::*, Icon, IconName, List, Tooltip}; +use ui::{Icon, IconName, List, Tooltip, prelude::*}; use util::ResultExt; -use crate::ui::InstructionListItem; use crate::AllLanguageModelSettings; +use crate::ui::InstructionListItem; const PROVIDER_ID: &str = "google"; const PROVIDER_NAME: &str = "Google AI"; diff --git a/crates/language_models/src/provider/lmstudio.rs b/crates/language_models/src/provider/lmstudio.rs index ae9343f741..dacb0f72bd 100644 --- a/crates/language_models/src/provider/lmstudio.rs +++ b/crates/language_models/src/provider/lmstudio.rs @@ -1,5 +1,5 @@ -use anyhow::{anyhow, Result}; -use futures::{future::BoxFuture, stream::BoxStream, FutureExt, StreamExt}; +use anyhow::{Result, anyhow}; +use futures::{FutureExt, StreamExt, future::BoxFuture, stream::BoxStream}; use gpui::{AnyView, App, AsyncApp, Context, Subscription, Task}; use http_client::HttpClient; use language_model::{AuthenticateError, LanguageModelCompletionEvent}; @@ -9,14 +9,14 @@ use language_model::{ LanguageModelRequest, RateLimiter, Role, }; use lmstudio::{ - get_models, preload_model, stream_chat_completion, ChatCompletionRequest, ChatMessage, - ModelType, + ChatCompletionRequest, ChatMessage, ModelType, get_models, preload_model, + stream_chat_completion, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsStore}; use std::{collections::BTreeMap, sync::Arc}; -use ui::{prelude::*, ButtonLike, Indicator}; +use ui::{ButtonLike, Indicator, prelude::*}; use util::ResultExt; use crate::AllLanguageModelSettings; diff --git a/crates/language_models/src/provider/mistral.rs b/crates/language_models/src/provider/mistral.rs index d9d62e83b9..6b509d4b4c 100644 --- a/crates/language_models/src/provider/mistral.rs +++ b/crates/language_models/src/provider/mistral.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::BTreeMap; use credentials_provider::CredentialsProvider; use editor::{Editor, EditorElement, EditorStyle}; -use futures::{future::BoxFuture, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, future::BoxFuture}; use gpui::{ AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace, }; @@ -20,10 +20,10 @@ use settings::{Settings, SettingsStore}; use std::sync::Arc; use strum::IntoEnumIterator; use theme::ThemeSettings; -use ui::{prelude::*, Icon, IconName, List, Tooltip}; +use ui::{Icon, IconName, List, Tooltip, prelude::*}; use util::ResultExt; -use crate::{ui::InstructionListItem, AllLanguageModelSettings}; +use crate::{AllLanguageModelSettings, ui::InstructionListItem}; const PROVIDER_ID: &str = "mistral"; const PROVIDER_NAME: &str = "Mistral"; diff --git a/crates/language_models/src/provider/ollama.rs b/crates/language_models/src/provider/ollama.rs index 16cac27f40..810c141e48 100644 --- a/crates/language_models/src/provider/ollama.rs +++ b/crates/language_models/src/provider/ollama.rs @@ -1,5 +1,5 @@ -use anyhow::{anyhow, bail, Result}; -use futures::{future::BoxFuture, stream::BoxStream, FutureExt, StreamExt}; +use anyhow::{Result, anyhow, bail}; +use futures::{FutureExt, StreamExt, future::BoxFuture, stream::BoxStream}; use gpui::{AnyView, App, AsyncApp, Context, Subscription, Task}; use http_client::HttpClient; use language_model::{AuthenticateError, LanguageModelCompletionEvent}; @@ -9,14 +9,14 @@ use language_model::{ LanguageModelRequest, RateLimiter, Role, }; use ollama::{ - get_models, preload_model, stream_chat_completion, ChatMessage, ChatOptions, ChatRequest, - ChatResponseDelta, KeepAlive, OllamaToolCall, + ChatMessage, ChatOptions, ChatRequest, ChatResponseDelta, KeepAlive, OllamaToolCall, + get_models, preload_model, stream_chat_completion, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsStore}; use std::{collections::BTreeMap, sync::Arc}; -use ui::{prelude::*, ButtonLike, Indicator}; +use ui::{ButtonLike, Indicator, prelude::*}; use util::ResultExt; use crate::AllLanguageModelSettings; diff --git a/crates/language_models/src/provider/open_ai.rs b/crates/language_models/src/provider/open_ai.rs index e914a848b3..10c103eefb 100644 --- a/crates/language_models/src/provider/open_ai.rs +++ b/crates/language_models/src/provider/open_ai.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::BTreeMap; use credentials_provider::CredentialsProvider; use editor::{Editor, EditorElement, EditorStyle}; -use futures::{future::BoxFuture, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, future::BoxFuture}; use gpui::{ AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace, }; @@ -13,7 +13,7 @@ use language_model::{ LanguageModelProviderState, LanguageModelRequest, RateLimiter, Role, }; use open_ai::{ - stream_completion, FunctionDefinition, ResponseStreamEvent, ToolChoice, ToolDefinition, + FunctionDefinition, ResponseStreamEvent, ToolChoice, ToolDefinition, stream_completion, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -21,10 +21,10 @@ use settings::{Settings, SettingsStore}; use std::sync::Arc; use strum::IntoEnumIterator; use theme::ThemeSettings; -use ui::{prelude::*, Icon, IconName, List, Tooltip}; +use ui::{Icon, IconName, List, Tooltip, prelude::*}; use util::ResultExt; -use crate::{ui::InstructionListItem, AllLanguageModelSettings}; +use crate::{AllLanguageModelSettings, ui::InstructionListItem}; const PROVIDER_ID: &str = "openai"; const PROVIDER_NAME: &str = "OpenAI"; diff --git a/crates/language_models/src/settings.rs b/crates/language_models/src/settings.rs index 6e25ca3c40..68833d8d63 100644 --- a/crates/language_models/src/settings.rs +++ b/crates/language_models/src/settings.rs @@ -6,7 +6,7 @@ use language_model::LanguageModelCacheConfiguration; use project::Fs; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use settings::{update_settings_file, Settings, SettingsSources}; +use settings::{Settings, SettingsSources, update_settings_file}; use crate::provider::{ self, diff --git a/crates/language_models/src/ui/instruction_list_item.rs b/crates/language_models/src/ui/instruction_list_item.rs index daf5646d65..d3442cf815 100644 --- a/crates/language_models/src/ui/instruction_list_item.rs +++ b/crates/language_models/src/ui/instruction_list_item.rs @@ -1,5 +1,5 @@ use gpui::{AnyElement, IntoElement, ParentElement, SharedString}; -use ui::{prelude::*, ListItem}; +use ui::{ListItem, prelude::*}; /// A reusable list item component for adding LLM provider configuration instructions pub struct InstructionListItem { diff --git a/crates/language_selector/src/active_buffer_language.rs b/crates/language_selector/src/active_buffer_language.rs index 0d515e3d26..250d0c23d8 100644 --- a/crates/language_selector/src/active_buffer_language.rs +++ b/crates/language_selector/src/active_buffer_language.rs @@ -1,10 +1,10 @@ use editor::Editor; use gpui::{ - div, Context, Entity, IntoElement, ParentElement, Render, Subscription, WeakEntity, Window, + Context, Entity, IntoElement, ParentElement, Render, Subscription, WeakEntity, Window, div, }; use language::LanguageName; use ui::{Button, ButtonCommon, Clickable, FluentBuilder, LabelSize, Tooltip}; -use workspace::{item::ItemHandle, StatusItemView, Workspace}; +use workspace::{StatusItemView, Workspace, item::ItemHandle}; use crate::{LanguageSelector, Toggle}; diff --git a/crates/language_selector/src/language_selector.rs b/crates/language_selector/src/language_selector.rs index 24b43a5acf..e5767ea288 100644 --- a/crates/language_selector/src/language_selector.rs +++ b/crates/language_selector/src/language_selector.rs @@ -5,17 +5,17 @@ use anyhow::anyhow; use editor::Editor; use file_finder::file_finder_settings::FileFinderSettings; use file_icons::FileIcons; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{ - actions, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, - ParentElement, Render, Styled, WeakEntity, Window, + App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, ParentElement, + Render, Styled, WeakEntity, Window, actions, }; use language::{Buffer, LanguageMatcher, LanguageName, LanguageRegistry}; use picker::{Picker, PickerDelegate}; use project::Project; use settings::Settings; use std::{ops::Not as _, path::Path, sync::Arc}; -use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; +use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::{ModalView, Workspace}; diff --git a/crates/language_tools/src/key_context_view.rs b/crates/language_tools/src/key_context_view.rs index 9f490caced..ec65ccdbe8 100644 --- a/crates/language_tools/src/key_context_view.rs +++ b/crates/language_tools/src/key_context_view.rs @@ -1,16 +1,16 @@ use gpui::{ - actions, Action, App, AppContext as _, Entity, EventEmitter, FocusHandle, Focusable, - KeyBindingContextPredicate, KeyContext, Keystroke, MouseButton, Render, Subscription, + Action, App, AppContext as _, Entity, EventEmitter, FocusHandle, Focusable, + KeyBindingContextPredicate, KeyContext, Keystroke, MouseButton, Render, Subscription, actions, }; use itertools::Itertools; use serde_json::json; use settings::get_key_equivalents; -use ui::{ - div, h_flex, px, v_flex, ButtonCommon, Clickable, Context, FluentBuilder, InteractiveElement, - Label, LabelCommon, LabelSize, ParentElement, SharedString, StatefulInteractiveElement, Styled, - Window, -}; use ui::{Button, ButtonStyle}; +use ui::{ + ButtonCommon, Clickable, Context, FluentBuilder, InteractiveElement, Label, LabelCommon, + LabelSize, ParentElement, SharedString, StatefulInteractiveElement, Styled, Window, div, + h_flex, px, v_flex, +}; use workspace::{Item, SplitDirection, Workspace}; actions!(debug, [OpenKeyContextView]); diff --git a/crates/language_tools/src/lsp_log.rs b/crates/language_tools/src/lsp_log.rs index 09b77b47ce..5e1790bd9f 100644 --- a/crates/language_tools/src/lsp_log.rs +++ b/crates/language_tools/src/lsp_log.rs @@ -1,23 +1,23 @@ use collections::{HashMap, VecDeque}; use copilot::Copilot; -use editor::{actions::MoveToEnd, scroll::Autoscroll, Editor, EditorEvent}; -use futures::{channel::mpsc, StreamExt}; +use editor::{Editor, EditorEvent, actions::MoveToEnd, scroll::Autoscroll}; +use futures::{StreamExt, channel::mpsc}; use gpui::{ - actions, div, AnyView, App, Context, Corner, Entity, EventEmitter, FocusHandle, Focusable, - IntoElement, ParentElement, Render, Styled, Subscription, WeakEntity, Window, + AnyView, App, Context, Corner, Entity, EventEmitter, FocusHandle, Focusable, IntoElement, + ParentElement, Render, Styled, Subscription, WeakEntity, Window, actions, div, }; -use language::{language_settings::SoftWrap, LanguageServerId}; +use language::{LanguageServerId, language_settings::SoftWrap}; use lsp::{ - notification::SetTrace, IoKind, LanguageServer, LanguageServerName, MessageType, - SetTraceParams, TraceValue, + IoKind, LanguageServer, LanguageServerName, MessageType, SetTraceParams, TraceValue, + notification::SetTrace, }; -use project::{search::SearchQuery, Project, WorktreeId}; +use project::{Project, WorktreeId, search::SearchQuery}; use std::{any::TypeId, borrow::Cow, sync::Arc}; -use ui::{prelude::*, Button, Checkbox, ContextMenu, Label, PopoverMenu, ToggleState}; +use ui::{Button, Checkbox, ContextMenu, Label, PopoverMenu, ToggleState, prelude::*}; use workspace::{ + SplitDirection, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, WorkspaceId, item::{Item, ItemHandle}, searchable::{Direction, SearchEvent, SearchableItem, SearchableItemHandle}, - SplitDirection, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, WorkspaceId, }; const SEND_LINE: &str = "// Send:"; diff --git a/crates/language_tools/src/lsp_log_tests.rs b/crates/language_tools/src/lsp_log_tests.rs index 707d2ca022..a5f15790e9 100644 --- a/crates/language_tools/src/lsp_log_tests.rs +++ b/crates/language_tools/src/lsp_log_tests.rs @@ -5,7 +5,7 @@ use crate::lsp_log::LogMenuItem; use super::*; use futures::StreamExt; use gpui::{AppContext as _, SemanticVersion, TestAppContext, VisualTestContext}; -use language::{tree_sitter_rust, FakeLspAdapter, Language, LanguageConfig, LanguageMatcher}; +use language::{FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, tree_sitter_rust}; use lsp::LanguageServerName; use lsp_log::LogKind; use project::{FakeFs, Project}; diff --git a/crates/language_tools/src/syntax_tree_view.rs b/crates/language_tools/src/syntax_tree_view.rs index 3dbdfa2b91..2098c86673 100644 --- a/crates/language_tools/src/syntax_tree_view.rs +++ b/crates/language_tools/src/syntax_tree_view.rs @@ -1,18 +1,18 @@ -use editor::{scroll::Autoscroll, Anchor, Editor, ExcerptId}; +use editor::{Anchor, Editor, ExcerptId, scroll::Autoscroll}; use gpui::{ - actions, div, rems, uniform_list, App, AppContext as _, Context, Div, Entity, EventEmitter, - FocusHandle, Focusable, Hsla, InteractiveElement, IntoElement, MouseButton, MouseDownEvent, - MouseMoveEvent, ParentElement, Render, ScrollStrategy, SharedString, Styled, - UniformListScrollHandle, WeakEntity, Window, + App, AppContext as _, Context, Div, Entity, EventEmitter, FocusHandle, Focusable, Hsla, + InteractiveElement, IntoElement, MouseButton, MouseDownEvent, MouseMoveEvent, ParentElement, + Render, ScrollStrategy, SharedString, Styled, UniformListScrollHandle, WeakEntity, Window, + actions, div, rems, uniform_list, }; use language::{Buffer, OwnedSyntaxLayer}; use std::{mem, ops::Range}; use theme::ActiveTheme; use tree_sitter::{Node, TreeCursor}; -use ui::{h_flex, ButtonLike, Color, ContextMenu, Label, LabelCommon, PopoverMenu}; +use ui::{ButtonLike, Color, ContextMenu, Label, LabelCommon, PopoverMenu, h_flex}; use workspace::{ - item::{Item, ItemHandle}, SplitDirection, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, + item::{Item, ItemHandle}, }; actions!(debug, [OpenSyntaxTreeView]); diff --git a/crates/languages/src/bash.rs b/crates/languages/src/bash.rs index 3f37926d48..75809d6c69 100644 --- a/crates/languages/src/bash.rs +++ b/crates/languages/src/bash.rs @@ -19,7 +19,7 @@ pub(super) fn bash_task_context() -> ContextProviderWithTasks { #[cfg(test)] mod tests { use gpui::{AppContext as _, BorrowAppContext, Context, TestAppContext}; - use language::{language_settings::AllLanguageSettings, AutoindentMode, Buffer}; + use language::{AutoindentMode, Buffer, language_settings::AllLanguageSettings}; use settings::SettingsStore; use std::num::NonZeroU32; use unindent::Unindent; diff --git a/crates/languages/src/c.rs b/crates/languages/src/c.rs index 27f4ff2056..1e0318dee2 100644 --- a/crates/languages/src/c.rs +++ b/crates/languages/src/c.rs @@ -1,15 +1,15 @@ -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use async_trait::async_trait; use futures::StreamExt; use gpui::AsyncApp; -use http_client::github::{latest_github_release, GitHubLspBinaryVersion}; +use http_client::github::{GitHubLspBinaryVersion, latest_github_release}; pub use language::*; use lsp::{DiagnosticTag, InitializeParams, LanguageServerBinary, LanguageServerName}; use project::lsp_store::clangd_ext; use serde_json::json; use smol::fs::{self, File}; use std::{any::Any, env::consts, path::PathBuf, sync::Arc}; -use util::{fs::remove_matching, maybe, merge_json_value_into, ResultExt}; +use util::{ResultExt, fs::remove_matching, maybe, merge_json_value_into}; pub struct CLspAdapter; @@ -360,7 +360,7 @@ async fn get_cached_server_binary(container_dir: PathBuf) -> Option Vec { vec!["-mode=stdio".into()] diff --git a/crates/languages/src/json.rs b/crates/languages/src/json.rs index 98a0520180..de8a5e513c 100644 --- a/crates/languages/src/json.rs +++ b/crates/languages/src/json.rs @@ -1,16 +1,16 @@ -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use async_trait::async_trait; use collections::HashMap; use futures::StreamExt; use gpui::{App, AsyncApp}; -use http_client::github::{latest_github_release, GitHubLspBinaryVersion}; +use http_client::github::{GitHubLspBinaryVersion, latest_github_release}; use language::{LanguageRegistry, LanguageToolchainStore, LspAdapter, LspAdapterDelegate}; use lsp::{LanguageServerBinary, LanguageServerName}; use node_runtime::NodeRuntime; -use project::{lsp_store::language_server_settings, ContextProviderWithTasks, Fs}; -use serde_json::{json, Value}; +use project::{ContextProviderWithTasks, Fs, lsp_store::language_server_settings}; +use serde_json::{Value, json}; use settings::{KeymapFile, SettingsJsonSchemaParams, SettingsStore}; use smol::{ fs::{self}, @@ -26,7 +26,7 @@ use std::{ sync::Arc, }; use task::{TaskTemplate, TaskTemplates, VariableName}; -use util::{fs::remove_matching, maybe, merge_json_value_into, ResultExt}; +use util::{ResultExt, fs::remove_matching, maybe, merge_json_value_into}; const SERVER_PATH: &str = "node_modules/vscode-langservers-extracted/bin/vscode-json-language-server"; diff --git a/crates/languages/src/lib.rs b/crates/languages/src/lib.rs index ed8a1fc5b8..3a140e4ae1 100644 --- a/crates/languages/src/lib.rs +++ b/crates/languages/src/lib.rs @@ -8,7 +8,7 @@ use rust_embed::RustEmbed; use settings::SettingsStore; use smol::stream::StreamExt; use std::{str, sync::Arc}; -use util::{asset_str, ResultExt}; +use util::{ResultExt, asset_str}; pub use language::*; diff --git a/crates/languages/src/python.rs b/crates/languages/src/python.rs index cd4add33b1..7b0400eb9c 100644 --- a/crates/languages/src/python.rs +++ b/crates/languages/src/python.rs @@ -1,25 +1,25 @@ use anyhow::ensure; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use collections::HashMap; use gpui::{App, Task}; use gpui::{AsyncApp, SharedString}; -use language::language_settings::language_settings; use language::LanguageToolchainStore; use language::Toolchain; use language::ToolchainList; use language::ToolchainLister; +use language::language_settings::language_settings; use language::{ContextProvider, LspAdapter, LspAdapterDelegate}; use language::{LanguageName, ManifestName, ManifestProvider, ManifestQuery}; use lsp::LanguageServerBinary; use lsp::LanguageServerName; use node_runtime::NodeRuntime; +use pet_core::Configuration; use pet_core::os_environment::Environment; use pet_core::python_environment::PythonEnvironmentKind; -use pet_core::Configuration; -use project::lsp_store::language_server_settings; use project::Fs; -use serde_json::{json, Value}; +use project::lsp_store::language_server_settings; +use serde_json::{Value, json}; use smol::lock::OnceCell; use std::cmp::Ordering; @@ -1127,7 +1127,7 @@ impl LspAdapter for PyLspAdapter { #[cfg(test)] mod tests { use gpui::{AppContext as _, BorrowAppContext, Context, TestAppContext}; - use language::{language_settings::AllLanguageSettings, AutoindentMode, Buffer}; + use language::{AutoindentMode, Buffer, language_settings::AllLanguageSettings}; use settings::SettingsStore; use std::num::NonZeroU32; diff --git a/crates/languages/src/rust.rs b/crates/languages/src/rust.rs index c4d0c2ada0..219a9cd0ce 100644 --- a/crates/languages/src/rust.rs +++ b/crates/languages/src/rust.rs @@ -1,11 +1,11 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_compression::futures::bufread::GzipDecoder; use async_trait::async_trait; use collections::HashMap; -use futures::{io::BufReader, StreamExt}; +use futures::{StreamExt, io::BufReader}; use gpui::{App, AsyncApp, SharedString, Task}; use http_client::github::AssetKind; -use http_client::github::{latest_github_release, GitHubLspBinaryVersion}; +use http_client::github::{GitHubLspBinaryVersion, latest_github_release}; pub use language::*; use lsp::LanguageServerBinary; use regex::Regex; @@ -18,7 +18,7 @@ use std::{ sync::{Arc, LazyLock}, }; use task::{TaskTemplate, TaskTemplates, TaskType, TaskVariables, VariableName}; -use util::{fs::remove_matching, maybe, ResultExt}; +use util::{ResultExt, fs::remove_matching, maybe}; use crate::language_settings::language_settings; diff --git a/crates/languages/src/tailwind.rs b/crates/languages/src/tailwind.rs index 04127e98bb..a9aba75643 100644 --- a/crates/languages/src/tailwind.rs +++ b/crates/languages/src/tailwind.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use collections::HashMap; use futures::StreamExt; @@ -6,8 +6,8 @@ use gpui::AsyncApp; use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate}; use lsp::{LanguageServerBinary, LanguageServerName}; use node_runtime::NodeRuntime; -use project::{lsp_store::language_server_settings, Fs}; -use serde_json::{json, Value}; +use project::{Fs, lsp_store::language_server_settings}; +use serde_json::{Value, json}; use smol::fs; use std::{ any::Any, @@ -15,7 +15,7 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; #[cfg(target_os = "windows")] const SERVER_PATH: &str = diff --git a/crates/languages/src/typescript.rs b/crates/languages/src/typescript.rs index db3671ab1a..20249e0092 100644 --- a/crates/languages/src/typescript.rs +++ b/crates/languages/src/typescript.rs @@ -1,16 +1,16 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use async_trait::async_trait; use collections::HashMap; use gpui::AsyncApp; -use http_client::github::{build_asset_url, AssetKind, GitHubLspBinaryVersion}; +use http_client::github::{AssetKind, GitHubLspBinaryVersion, build_asset_url}; use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate}; use lsp::{CodeActionKind, LanguageServerBinary, LanguageServerName}; use node_runtime::NodeRuntime; use project::ContextProviderWithTasks; -use project::{lsp_store::language_server_settings, Fs}; -use serde_json::{json, Value}; +use project::{Fs, lsp_store::language_server_settings}; +use serde_json::{Value, json}; use smol::{fs, io::BufReader, stream::StreamExt}; use std::{ any::Any, @@ -19,7 +19,7 @@ use std::{ sync::Arc, }; use task::{TaskTemplate, TaskTemplates, VariableName}; -use util::{fs::remove_matching, maybe, ResultExt}; +use util::{ResultExt, fs::remove_matching, maybe}; pub(super) fn typescript_task_context() -> ContextProviderWithTasks { ContextProviderWithTasks::new(TaskTemplates(vec![ diff --git a/crates/languages/src/vtsls.rs b/crates/languages/src/vtsls.rs index 692dbd5092..8b1cf5edc6 100644 --- a/crates/languages/src/vtsls.rs +++ b/crates/languages/src/vtsls.rs @@ -1,11 +1,11 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use collections::HashMap; use gpui::AsyncApp; use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate}; use lsp::{CodeActionKind, LanguageServerBinary, LanguageServerName}; use node_runtime::NodeRuntime; -use project::{lsp_store::language_server_settings, Fs}; +use project::{Fs, lsp_store::language_server_settings}; use serde_json::Value; use std::{ any::Any, @@ -13,7 +13,7 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use util::{maybe, merge_json_value_into, ResultExt}; +use util::{ResultExt, maybe, merge_json_value_into}; fn typescript_server_binary_arguments(server_path: &Path) -> Vec { vec![server_path.into(), "--stdio".into()] diff --git a/crates/languages/src/yaml.rs b/crates/languages/src/yaml.rs index edc176a117..1b9da5771f 100644 --- a/crates/languages/src/yaml.rs +++ b/crates/languages/src/yaml.rs @@ -1,13 +1,13 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use futures::StreamExt; use gpui::AsyncApp; use language::{ - language_settings::AllLanguageSettings, LanguageToolchainStore, LspAdapter, LspAdapterDelegate, + LanguageToolchainStore, LspAdapter, LspAdapterDelegate, language_settings::AllLanguageSettings, }; use lsp::{LanguageServerBinary, LanguageServerName}; use node_runtime::NodeRuntime; -use project::{lsp_store::language_server_settings, Fs}; +use project::{Fs, lsp_store::language_server_settings}; use serde_json::Value; use settings::{Settings, SettingsLocation}; use smol::fs; @@ -17,7 +17,7 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use util::{maybe, merge_json_value_into, ResultExt}; +use util::{ResultExt, maybe, merge_json_value_into}; const SERVER_PATH: &str = "node_modules/yaml-language-server/bin/yaml-language-server"; diff --git a/crates/livekit_api/src/livekit_api.rs b/crates/livekit_api/src/livekit_api.rs index d68099c0e3..ea4279c223 100644 --- a/crates/livekit_api/src/livekit_api.rs +++ b/crates/livekit_api/src/livekit_api.rs @@ -1,7 +1,7 @@ pub mod proto; pub mod token; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use prost::Message; use reqwest::header::CONTENT_TYPE; diff --git a/crates/livekit_api/src/token.rs b/crates/livekit_api/src/token.rs index aa36702823..02602e1393 100644 --- a/crates/livekit_api/src/token.rs +++ b/crates/livekit_api/src/token.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use jsonwebtoken::{DecodingKey, EncodingKey, Header, Validation}; use serde::{Deserialize, Serialize}; use std::{ diff --git a/crates/livekit_client/examples/test_app.rs b/crates/livekit_client/examples/test_app.rs index c04d442592..e1d01df534 100644 --- a/crates/livekit_client/examples/test_app.rs +++ b/crates/livekit_client/examples/test_app.rs @@ -2,12 +2,12 @@ use std::sync::Arc; use futures::StreamExt; use gpui::{ - actions, bounds, div, point, - prelude::{FluentBuilder as _, IntoElement}, - px, rgb, size, AppContext as _, AsyncApp, Bounds, Context, Entity, InteractiveElement, - KeyBinding, Menu, MenuItem, ParentElement, Pixels, Render, ScreenCaptureStream, SharedString, + AppContext as _, AsyncApp, Bounds, Context, Entity, InteractiveElement, KeyBinding, Menu, + MenuItem, ParentElement, Pixels, Render, ScreenCaptureStream, SharedString, StatefulInteractiveElement as _, Styled, Task, Window, WindowBounds, WindowHandle, - WindowOptions, + WindowOptions, actions, bounds, div, point, + prelude::{FluentBuilder as _, IntoElement}, + px, rgb, size, }; use livekit_client::{ AudioStream, LocalTrackPublication, Participant, ParticipantIdentity, RemoteParticipant, @@ -302,11 +302,7 @@ impl LivekitWindow { cx: &mut Context, ) -> Option<()> { let participant = self.remote_participants.iter().find_map(|(id, state)| { - if id == identity { - Some(state) - } else { - None - } + if id == identity { Some(state) } else { None } })?; let publication = &participant.audio_output_stream.as_ref()?.0; publication.set_enabled(!publication.is_enabled(), cx); @@ -336,11 +332,7 @@ impl Render for LivekitWindow { button() .id("toggle-mute") .child(if let Some(track) = &self.microphone_track { - if track.is_muted() { - "Unmute" - } else { - "Mute" - } + if track.is_muted() { "Unmute" } else { "Mute" } } else { "Publish mic" }) diff --git a/crates/livekit_client/src/livekit_client.rs b/crates/livekit_client/src/livekit_client.rs index ddab660678..c258d11de3 100644 --- a/crates/livekit_client/src/livekit_client.rs +++ b/crates/livekit_client/src/livekit_client.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use anyhow::Result; use collections::HashMap; -use futures::{channel::mpsc, SinkExt}; +use futures::{SinkExt, channel::mpsc}; use gpui::{App, AsyncApp, ScreenCaptureSource, ScreenCaptureStream, Task}; use gpui_tokio::Tokio; use playback::capture_local_video_track; @@ -11,7 +11,7 @@ mod playback; use crate::{LocalTrack, Participant, RemoteTrack, RoomEvent, TrackPublication}; pub use playback::AudioStream; -pub(crate) use playback::{play_remote_video_track, RemoteVideoFrame}; +pub(crate) use playback::{RemoteVideoFrame, play_remote_video_track}; #[derive(Clone, Debug)] pub struct RemoteVideoTrack(livekit::track::RemoteVideoTrack); diff --git a/crates/livekit_client/src/livekit_client/playback.rs b/crates/livekit_client/src/livekit_client/playback.rs index a459fe84a5..340efc95aa 100644 --- a/crates/livekit_client/src/livekit_client/playback.rs +++ b/crates/livekit_client/src/livekit_client/playback.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use cpal::traits::{DeviceTrait, HostTrait, StreamTrait as _}; use futures::channel::mpsc::UnboundedSender; @@ -11,19 +11,19 @@ use livekit::track; use livekit::webrtc::{ audio_frame::AudioFrame, - audio_source::{native::NativeAudioSource, AudioSourceOptions, RtcAudioSource}, + audio_source::{AudioSourceOptions, RtcAudioSource, native::NativeAudioSource}, audio_stream::native::NativeAudioStream, video_frame::{VideoBuffer, VideoFrame, VideoRotation}, - video_source::{native::NativeVideoSource, RtcVideoSource, VideoResolution}, + video_source::{RtcVideoSource, VideoResolution, native::NativeVideoSource}, video_stream::native::NativeVideoStream, }; use parking_lot::Mutex; use std::cell::RefCell; -use std::sync::atomic::{self, AtomicI32}; use std::sync::Weak; +use std::sync::atomic::{self, AtomicI32}; use std::time::Duration; use std::{borrow::Cow, collections::VecDeque, sync::Arc, thread}; -use util::{maybe, ResultExt as _}; +use util::{ResultExt as _, maybe}; pub(crate) struct AudioStack { executor: BackgroundExecutor, @@ -576,7 +576,7 @@ fn video_frame_buffer_from_webrtc(buffer: Box) -> Option + Sized { mod macos { use coreaudio::sys::{ - kAudioHardwarePropertyDefaultInputDevice, kAudioHardwarePropertyDefaultOutputDevice, - kAudioObjectPropertyElementMaster, kAudioObjectPropertyScopeGlobal, - kAudioObjectSystemObject, AudioObjectAddPropertyListener, AudioObjectID, - AudioObjectPropertyAddress, AudioObjectRemovePropertyListener, OSStatus, + AudioObjectAddPropertyListener, AudioObjectID, AudioObjectPropertyAddress, + AudioObjectRemovePropertyListener, OSStatus, kAudioHardwarePropertyDefaultInputDevice, + kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyElementMaster, + kAudioObjectPropertyScopeGlobal, kAudioObjectSystemObject, }; - use futures::{channel::mpsc::UnboundedReceiver, StreamExt}; + use futures::{StreamExt, channel::mpsc::UnboundedReceiver}; /// Implementation from: https://github.com/zed-industries/cpal/blob/fd8bc2fd39f1f5fdee5a0690656caff9a26d9d50/src/host/coreaudio/macos/property_listener.rs#L15 pub struct CoreAudioDefaultDeviceChangeListener { diff --git a/crates/livekit_client/src/mock_client/participant.rs b/crates/livekit_client/src/mock_client/participant.rs index 3eb6c56a99..1f4168b8e0 100644 --- a/crates/livekit_client/src/mock_client/participant.rs +++ b/crates/livekit_client/src/mock_client/participant.rs @@ -1,7 +1,7 @@ use crate::{ - test::{Room, WeakRoom}, AudioStream, LocalAudioTrack, LocalTrackPublication, LocalVideoTrack, Participant, ParticipantIdentity, RemoteTrack, RemoteTrackPublication, TrackSid, + test::{Room, WeakRoom}, }; use anyhow::Result; use collections::HashMap; diff --git a/crates/livekit_client/src/mock_client/publication.rs b/crates/livekit_client/src/mock_client/publication.rs index 0176e63a9e..70ef3b7c26 100644 --- a/crates/livekit_client/src/mock_client/publication.rs +++ b/crates/livekit_client/src/mock_client/publication.rs @@ -1,6 +1,6 @@ use gpui::App; -use crate::{test::WeakRoom, RemoteTrack, TrackSid}; +use crate::{RemoteTrack, TrackSid, test::WeakRoom}; #[derive(Clone, Debug)] pub struct LocalTrackPublication { diff --git a/crates/livekit_client/src/mock_client/track.rs b/crates/livekit_client/src/mock_client/track.rs index aaa1e52783..61909370aa 100644 --- a/crates/livekit_client/src/mock_client/track.rs +++ b/crates/livekit_client/src/mock_client/track.rs @@ -1,8 +1,8 @@ use std::sync::Arc; use crate::{ - test::{TestServerAudioTrack, TestServerVideoTrack, WeakRoom}, ParticipantIdentity, TrackSid, + test::{TestServerAudioTrack, TestServerVideoTrack, WeakRoom}, }; #[derive(Clone, Debug)] diff --git a/crates/livekit_client/src/test.rs b/crates/livekit_client/src/test.rs index b27479d7b1..77e1c0038a 100644 --- a/crates/livekit_client/src/test.rs +++ b/crates/livekit_client/src/test.rs @@ -1,16 +1,16 @@ use crate::{AudioStream, Participant, RemoteTrack, RoomEvent, TrackPublication}; use crate::mock_client::{participant::*, publication::*, track::*}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_trait::async_trait; -use collections::{btree_map::Entry as BTreeEntry, hash_map::Entry, BTreeMap, HashMap, HashSet}; +use collections::{BTreeMap, HashMap, HashSet, btree_map::Entry as BTreeEntry, hash_map::Entry}; use gpui::{App, AsyncApp, BackgroundExecutor}; use livekit_api::{proto, token}; use parking_lot::Mutex; use postage::{mpsc, sink::Sink}; use std::sync::{ - atomic::{AtomicBool, Ordering::SeqCst}, Arc, Weak, + atomic::{AtomicBool, Ordering::SeqCst}, }; #[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] diff --git a/crates/lmstudio/src/lmstudio.rs b/crates/lmstudio/src/lmstudio.rs index aadf33248f..0d17db63c1 100644 --- a/crates/lmstudio/src/lmstudio.rs +++ b/crates/lmstudio/src/lmstudio.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, Context as _, Result}; -use futures::{io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, StreamExt}; -use http_client::{http, AsyncBody, HttpClient, Method, Request as HttpRequest}; +use anyhow::{Context as _, Result, anyhow}; +use futures::{AsyncBufReadExt, AsyncReadExt, StreamExt, io::BufReader, stream::BoxStream}; +use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest, http}; use serde::{Deserialize, Serialize}; -use serde_json::{value::RawValue, Value}; +use serde_json::{Value, value::RawValue}; use std::{convert::TryFrom, sync::Arc, time::Duration}; pub const LMSTUDIO_API_URL: &str = "http://localhost:1234/api/v0"; diff --git a/crates/lsp/src/input_handler.rs b/crates/lsp/src/input_handler.rs index e9f90110ae..7cebc2fe32 100644 --- a/crates/lsp/src/input_handler.rs +++ b/crates/lsp/src/input_handler.rs @@ -1,11 +1,11 @@ use std::str; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::HashMap; use futures::{ - channel::mpsc::{unbounded, UnboundedReceiver, UnboundedSender}, AsyncBufReadExt, AsyncRead, AsyncReadExt as _, + channel::mpsc::{UnboundedReceiver, UnboundedSender, unbounded}, }; use gpui::{BackgroundExecutor, Task}; use log::warn; @@ -13,7 +13,7 @@ use parking_lot::Mutex; use smol::io::BufReader; use crate::{ - AnyNotification, AnyResponse, IoHandler, IoKind, RequestId, ResponseHandler, CONTENT_LEN_HEADER, + AnyNotification, AnyResponse, CONTENT_LEN_HEADER, IoHandler, IoKind, RequestId, ResponseHandler, }; const HEADER_DELIMITER: &[u8; 4] = b"\r\n\r\n"; diff --git a/crates/lsp/src/lsp.rs b/crates/lsp/src/lsp.rs index e988836fcc..b0abd1067c 100644 --- a/crates/lsp/src/lsp.rs +++ b/crates/lsp/src/lsp.rs @@ -3,20 +3,20 @@ mod input_handler; pub use lsp_types::request::*; pub use lsp_types::*; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::HashMap; -use futures::{channel::oneshot, io::BufWriter, select, AsyncRead, AsyncWrite, Future, FutureExt}; +use futures::{AsyncRead, AsyncWrite, Future, FutureExt, channel::oneshot, io::BufWriter, select}; use gpui::{App, AppContext as _, AsyncApp, BackgroundExecutor, SharedString, Task}; use notification::DidChangeWorkspaceFolders; use parking_lot::{Mutex, RwLock}; use postage::{barrier, prelude::Stream}; use schemars::{ + JsonSchema, r#gen::SchemaGenerator, schema::{InstanceType, Schema, SchemaObject}, - JsonSchema, }; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; -use serde_json::{json, value::RawValue, Value}; +use serde::{Deserialize, Serialize, de::DeserializeOwned}; +use serde_json::{Value, json, value::RawValue}; use smol::{ channel, io::{AsyncBufReadExt, AsyncWriteExt, BufReader}, @@ -32,8 +32,8 @@ use std::{ path::PathBuf, pin::Pin, sync::{ - atomic::{AtomicI32, Ordering::SeqCst}, Arc, Weak, + atomic::{AtomicI32, Ordering::SeqCst}, }, task::Poll, time::{Duration, Instant}, diff --git a/crates/markdown/examples/markdown.rs b/crates/markdown/examples/markdown.rs index bcd210a0db..a6014705c3 100644 --- a/crates/markdown/examples/markdown.rs +++ b/crates/markdown/examples/markdown.rs @@ -1,13 +1,13 @@ use assets::Assets; -use gpui::{prelude::*, rgb, Application, Entity, KeyBinding, StyleRefinement, WindowOptions}; -use language::{language_settings::AllLanguageSettings, LanguageRegistry}; +use gpui::{Application, Entity, KeyBinding, StyleRefinement, WindowOptions, prelude::*, rgb}; +use language::{LanguageRegistry, language_settings::AllLanguageSettings}; use markdown::{Markdown, MarkdownStyle}; use node_runtime::NodeRuntime; use settings::SettingsStore; use std::sync::Arc; use theme::LoadThemes; use ui::prelude::*; -use ui::{div, App, Window}; +use ui::{App, Window, div}; const MARKDOWN_EXAMPLE: &str = r#" # Markdown Example Document diff --git a/crates/markdown/examples/markdown_as_child.rs b/crates/markdown/examples/markdown_as_child.rs index 4aa97a5e38..b30f2e2130 100644 --- a/crates/markdown/examples/markdown_as_child.rs +++ b/crates/markdown/examples/markdown_as_child.rs @@ -1,6 +1,6 @@ use assets::Assets; -use gpui::{rgb, Application, Entity, KeyBinding, Length, StyleRefinement, WindowOptions}; -use language::{language_settings::AllLanguageSettings, LanguageRegistry}; +use gpui::{Application, Entity, KeyBinding, Length, StyleRefinement, WindowOptions, rgb}; +use language::{LanguageRegistry, language_settings::AllLanguageSettings}; use markdown::{Markdown, MarkdownStyle}; use node_runtime::NodeRuntime; use settings::SettingsStore; diff --git a/crates/markdown/src/markdown.rs b/crates/markdown/src/markdown.rs index b422817ac5..122fe3fc16 100644 --- a/crates/markdown/src/markdown.rs +++ b/crates/markdown/src/markdown.rs @@ -9,17 +9,17 @@ use std::sync::Arc; use std::time::Duration; use gpui::{ - actions, point, quad, AnyElement, App, BorderStyle, Bounds, ClipboardItem, CursorStyle, - DispatchPhase, Edges, Entity, FocusHandle, Focusable, FontStyle, FontWeight, GlobalElementId, - Hitbox, Hsla, KeyContext, Length, MouseDownEvent, MouseEvent, MouseMoveEvent, MouseUpEvent, - Point, Render, Stateful, StrikethroughStyle, StyleRefinement, StyledText, Task, TextLayout, - TextRun, TextStyle, TextStyleRefinement, + AnyElement, App, BorderStyle, Bounds, ClipboardItem, CursorStyle, DispatchPhase, Edges, Entity, + FocusHandle, Focusable, FontStyle, FontWeight, GlobalElementId, Hitbox, Hsla, KeyContext, + Length, MouseDownEvent, MouseEvent, MouseMoveEvent, MouseUpEvent, Point, Render, Stateful, + StrikethroughStyle, StyleRefinement, StyledText, Task, TextLayout, TextRun, TextStyle, + TextStyleRefinement, actions, point, quad, }; use language::{Language, LanguageRegistry, Rope}; -use parser::{parse_links_only, parse_markdown, MarkdownEvent, MarkdownTag, MarkdownTagEnd}; +use parser::{MarkdownEvent, MarkdownTag, MarkdownTagEnd, parse_links_only, parse_markdown}; use pulldown_cmark::Alignment; use theme::SyntaxTheme; -use ui::{prelude::*, Tooltip}; +use ui::{Tooltip, prelude::*}; use util::{ResultExt, TryFutureExt}; use crate::parser::CodeBlockKind; @@ -294,11 +294,7 @@ impl Selection { } fn tail(&self) -> usize { - if self.reversed { - self.end - } else { - self.start - } + if self.reversed { self.end } else { self.start } } } @@ -535,7 +531,7 @@ impl MarkdownElement { window: &mut Window, _cx: &mut App, mut f: impl 'static - + FnMut(&mut Markdown, &T, DispatchPhase, &mut Window, &mut Context), + + FnMut(&mut Markdown, &T, DispatchPhase, &mut Window, &mut Context), ) { window.on_mouse_event({ let markdown = self.markdown.downgrade(); diff --git a/crates/markdown_preview/src/markdown_elements.rs b/crates/markdown_preview/src/markdown_elements.rs index 256ce6ee4a..a570e79f53 100644 --- a/crates/markdown_preview/src/markdown_elements.rs +++ b/crates/markdown_preview/src/markdown_elements.rs @@ -1,5 +1,5 @@ use gpui::{ - px, FontStyle, FontWeight, HighlightStyle, SharedString, StrikethroughStyle, UnderlineStyle, + FontStyle, FontWeight, HighlightStyle, SharedString, StrikethroughStyle, UnderlineStyle, px, }; use language::HighlightId; use std::{fmt::Display, ops::Range, path::PathBuf}; diff --git a/crates/markdown_preview/src/markdown_parser.rs b/crates/markdown_preview/src/markdown_parser.rs index 24a88342a6..0e540fcc9e 100644 --- a/crates/markdown_preview/src/markdown_parser.rs +++ b/crates/markdown_preview/src/markdown_parser.rs @@ -751,12 +751,12 @@ mod tests { use super::*; + use ParsedMarkdownListItemType::*; use gpui::BackgroundExecutor; use language::{ - tree_sitter_rust, HighlightId, Language, LanguageConfig, LanguageMatcher, LanguageRegistry, + HighlightId, Language, LanguageConfig, LanguageMatcher, LanguageRegistry, tree_sitter_rust, }; use pretty_assertions::assert_eq; - use ParsedMarkdownListItemType::*; async fn parse(input: &str) -> ParsedMarkdown { parse_markdown(input, None, None).await diff --git a/crates/markdown_preview/src/markdown_preview.rs b/crates/markdown_preview/src/markdown_preview.rs index da1f35c45e..de3554286b 100644 --- a/crates/markdown_preview/src/markdown_preview.rs +++ b/crates/markdown_preview/src/markdown_preview.rs @@ -1,4 +1,4 @@ -use gpui::{actions, App}; +use gpui::{App, actions}; use workspace::Workspace; pub mod markdown_elements; diff --git a/crates/markdown_preview/src/markdown_preview_view.rs b/crates/markdown_preview/src/markdown_preview_view.rs index ae62ea3d62..ace832d7bc 100644 --- a/crates/markdown_preview/src/markdown_preview_view.rs +++ b/crates/markdown_preview/src/markdown_preview_view.rs @@ -6,22 +6,22 @@ use anyhow::Result; use editor::scroll::Autoscroll; use editor::{Editor, EditorEvent}; use gpui::{ - list, App, ClickEvent, Context, Entity, EventEmitter, FocusHandle, Focusable, - InteractiveElement, IntoElement, ListState, ParentElement, Render, Styled, Subscription, Task, - WeakEntity, Window, + App, ClickEvent, Context, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, + IntoElement, ListState, ParentElement, Render, Styled, Subscription, Task, WeakEntity, Window, + list, }; use language::LanguageRegistry; use ui::prelude::*; use workspace::item::{Item, ItemHandle}; use workspace::{Pane, Workspace}; -use crate::markdown_elements::ParsedMarkdownElement; use crate::OpenPreviewToTheSide; +use crate::markdown_elements::ParsedMarkdownElement; use crate::{ + OpenPreview, markdown_elements::ParsedMarkdown, markdown_parser::parse_markdown, - markdown_renderer::{render_markdown_block, RenderContext}, - OpenPreview, + markdown_renderer::{RenderContext, render_markdown_block}, }; const REPARSE_DEBOUNCE: Duration = Duration::from_millis(200); diff --git a/crates/markdown_preview/src/markdown_renderer.rs b/crates/markdown_preview/src/markdown_renderer.rs index 77b3e67876..e86943fe7c 100644 --- a/crates/markdown_preview/src/markdown_renderer.rs +++ b/crates/markdown_preview/src/markdown_renderer.rs @@ -5,10 +5,10 @@ use crate::markdown_elements::{ ParsedMarkdownTableAlignment, ParsedMarkdownTableRow, }; use gpui::{ - div, img, px, rems, AbsoluteLength, AnyElement, App, AppContext as _, ClipboardItem, Context, - DefiniteLength, Div, Element, ElementId, Entity, HighlightStyle, Hsla, ImageSource, - InteractiveText, IntoElement, Keystroke, Length, Modifiers, ParentElement, Render, Resource, - SharedString, Styled, StyledText, TextStyle, WeakEntity, Window, + AbsoluteLength, AnyElement, App, AppContext as _, ClipboardItem, Context, DefiniteLength, Div, + Element, ElementId, Entity, HighlightStyle, Hsla, ImageSource, InteractiveText, IntoElement, + Keystroke, Length, Modifiers, ParentElement, Render, Resource, SharedString, Styled, + StyledText, TextStyle, WeakEntity, Window, div, img, px, rems, }; use settings::Settings; use std::{ @@ -18,10 +18,10 @@ use std::{ }; use theme::{ActiveTheme, SyntaxTheme, ThemeSettings}; use ui::{ - h_flex, relative, tooltip_container, v_flex, ButtonCommon, Checkbox, Clickable, Color, - FluentBuilder, IconButton, IconName, IconSize, InteractiveElement, Label, LabelCommon, - LabelSize, LinkPreview, StatefulInteractiveElement, StyledExt, StyledImage, ToggleState, - Tooltip, VisibleOnHover, + ButtonCommon, Checkbox, Clickable, Color, FluentBuilder, IconButton, IconName, IconSize, + InteractiveElement, Label, LabelCommon, LabelSize, LinkPreview, StatefulInteractiveElement, + StyledExt, StyledImage, ToggleState, Tooltip, VisibleOnHover, h_flex, relative, + tooltip_container, v_flex, }; use workspace::{OpenOptions, OpenVisible, Workspace}; diff --git a/crates/media/src/media.rs b/crates/media/src/media.rs index a3071783f8..19fb35a41c 100644 --- a/crates/media/src/media.rs +++ b/crates/media/src/media.rs @@ -8,10 +8,10 @@ pub mod core_media { #![allow(non_snake_case)] pub use crate::bindings::{ - kCMSampleAttachmentKey_NotSync, kCMTimeInvalid, kCMVideoCodecType_H264, CMItemIndex, - CMSampleTimingInfo, CMTime, CMTimeMake, CMVideoCodecType, + CMItemIndex, CMSampleTimingInfo, CMTime, CMTimeMake, CMVideoCodecType, + kCMSampleAttachmentKey_NotSync, kCMTimeInvalid, kCMVideoCodecType_H264, }; - use anyhow::{anyhow, Result}; + use anyhow::{Result, anyhow}; use core_foundation::{ array::{CFArray, CFArrayRef}, base::{CFTypeID, OSStatus, TCFType}, @@ -226,12 +226,12 @@ pub mod core_video { #[cfg(target_os = "macos")] use std::ffi::c_void; + use crate::bindings::{CVReturn, kCVReturnSuccess}; pub use crate::bindings::{ kCVPixelFormatType_32BGRA, kCVPixelFormatType_420YpCbCr8BiPlanarFullRange, kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange, kCVPixelFormatType_420YpCbCr8Planar, }; - use crate::bindings::{kCVReturnSuccess, CVReturn}; - use anyhow::{anyhow, Result}; + use anyhow::{Result, anyhow}; use core_foundation::{ base::kCFAllocatorDefault, dictionary::CFDictionaryRef, mach_port::CFAllocatorRef, }; diff --git a/crates/migrator/src/migrations.rs b/crates/migrator/src/migrations.rs index a0a070051c..cb34a8d30b 100644 --- a/crates/migrator/src/migrations.rs +++ b/crates/migrator/src/migrations.rs @@ -9,7 +9,7 @@ pub(crate) mod m_2025_01_29 { mod settings; pub(crate) use keymap::KEYMAP_PATTERNS; - pub(crate) use settings::{replace_edit_prediction_provider_setting, SETTINGS_PATTERNS}; + pub(crate) use settings::{SETTINGS_PATTERNS, replace_edit_prediction_provider_setting}; } pub(crate) mod m_2025_01_30 { diff --git a/crates/migrator/src/migrations/m_2025_01_02/settings.rs b/crates/migrator/src/migrations/m_2025_01_02/settings.rs index 3778187231..3ce85e6b26 100644 --- a/crates/migrator/src/migrations/m_2025_01_02/settings.rs +++ b/crates/migrator/src/migrations/m_2025_01_02/settings.rs @@ -2,8 +2,8 @@ use collections::HashMap; use std::{ops::Range, sync::LazyLock}; use tree_sitter::{Query, QueryMatch}; -use crate::patterns::SETTINGS_NESTED_KEY_VALUE_PATTERN; use crate::MigrationPatterns; +use crate::patterns::SETTINGS_NESTED_KEY_VALUE_PATTERN; pub const SETTINGS_PATTERNS: MigrationPatterns = &[( SETTINGS_NESTED_KEY_VALUE_PATTERN, diff --git a/crates/migrator/src/migrations/m_2025_01_29/keymap.rs b/crates/migrator/src/migrations/m_2025_01_29/keymap.rs index 2be465470d..c32da88229 100644 --- a/crates/migrator/src/migrations/m_2025_01_29/keymap.rs +++ b/crates/migrator/src/migrations/m_2025_01_29/keymap.rs @@ -2,11 +2,11 @@ use collections::HashMap; use std::{ops::Range, sync::LazyLock}; use tree_sitter::{Query, QueryMatch}; +use crate::MigrationPatterns; use crate::patterns::{ KEYMAP_ACTION_ARRAY_ARGUMENT_AS_OBJECT_PATTERN, KEYMAP_ACTION_ARRAY_PATTERN, KEYMAP_ACTION_STRING_PATTERN, KEYMAP_CONTEXT_PATTERN, }; -use crate::MigrationPatterns; pub const KEYMAP_PATTERNS: MigrationPatterns = &[ ( diff --git a/crates/migrator/src/migrations/m_2025_01_29/settings.rs b/crates/migrator/src/migrations/m_2025_01_29/settings.rs index ba11779c35..8d3261676b 100644 --- a/crates/migrator/src/migrations/m_2025_01_29/settings.rs +++ b/crates/migrator/src/migrations/m_2025_01_29/settings.rs @@ -2,10 +2,10 @@ use collections::HashMap; use std::{ops::Range, sync::LazyLock}; use tree_sitter::{Query, QueryMatch}; +use crate::MigrationPatterns; use crate::patterns::{ SETTINGS_LANGUAGES_PATTERN, SETTINGS_NESTED_KEY_VALUE_PATTERN, SETTINGS_ROOT_KEY_VALUE_PATTERN, }; -use crate::MigrationPatterns; pub const SETTINGS_PATTERNS: MigrationPatterns = &[ (SETTINGS_ROOT_KEY_VALUE_PATTERN, replace_setting_name), diff --git a/crates/migrator/src/migrations/m_2025_01_30/keymap.rs b/crates/migrator/src/migrations/m_2025_01_30/keymap.rs index e660b99ab1..0e131fea02 100644 --- a/crates/migrator/src/migrations/m_2025_01_30/keymap.rs +++ b/crates/migrator/src/migrations/m_2025_01_30/keymap.rs @@ -3,8 +3,8 @@ use convert_case::{Case, Casing}; use std::{ops::Range, sync::LazyLock}; use tree_sitter::{Query, QueryMatch}; -use crate::patterns::KEYMAP_ACTION_ARRAY_ARGUMENT_AS_OBJECT_PATTERN; use crate::MigrationPatterns; +use crate::patterns::KEYMAP_ACTION_ARRAY_ARGUMENT_AS_OBJECT_PATTERN; pub const KEYMAP_PATTERNS: MigrationPatterns = &[( KEYMAP_ACTION_ARRAY_ARGUMENT_AS_OBJECT_PATTERN, diff --git a/crates/migrator/src/migrations/m_2025_01_30/settings.rs b/crates/migrator/src/migrations/m_2025_01_30/settings.rs index bc65764151..23a3243b82 100644 --- a/crates/migrator/src/migrations/m_2025_01_30/settings.rs +++ b/crates/migrator/src/migrations/m_2025_01_30/settings.rs @@ -1,8 +1,8 @@ use std::ops::Range; use tree_sitter::{Query, QueryMatch}; -use crate::patterns::SETTINGS_NESTED_KEY_VALUE_PATTERN; use crate::MigrationPatterns; +use crate::patterns::SETTINGS_NESTED_KEY_VALUE_PATTERN; pub const SETTINGS_PATTERNS: MigrationPatterns = &[ ( diff --git a/crates/migrator/src/migrations/m_2025_03_03/keymap.rs b/crates/migrator/src/migrations/m_2025_03_03/keymap.rs index 0ed7c9e88a..2342a8f696 100644 --- a/crates/migrator/src/migrations/m_2025_03_03/keymap.rs +++ b/crates/migrator/src/migrations/m_2025_03_03/keymap.rs @@ -2,8 +2,8 @@ use collections::HashMap; use std::{ops::Range, sync::LazyLock}; use tree_sitter::{Query, QueryMatch}; -use crate::patterns::KEYMAP_ACTION_STRING_PATTERN; use crate::MigrationPatterns; +use crate::patterns::KEYMAP_ACTION_STRING_PATTERN; pub const KEYMAP_PATTERNS: MigrationPatterns = &[(KEYMAP_ACTION_STRING_PATTERN, replace_string_action)]; diff --git a/crates/migrator/src/migrations/m_2025_03_06/keymap.rs b/crates/migrator/src/migrations/m_2025_03_06/keymap.rs index 6975cdafa2..333535908d 100644 --- a/crates/migrator/src/migrations/m_2025_03_06/keymap.rs +++ b/crates/migrator/src/migrations/m_2025_03_06/keymap.rs @@ -2,8 +2,8 @@ use collections::HashSet; use std::{ops::Range, sync::LazyLock}; use tree_sitter::{Query, QueryMatch}; -use crate::patterns::KEYMAP_ACTION_ARRAY_ARGUMENT_AS_OBJECT_PATTERN; use crate::MigrationPatterns; +use crate::patterns::KEYMAP_ACTION_ARRAY_ARGUMENT_AS_OBJECT_PATTERN; pub const KEYMAP_PATTERNS: MigrationPatterns = &[( KEYMAP_ACTION_ARRAY_ARGUMENT_AS_OBJECT_PATTERN, diff --git a/crates/migrator/src/migrations/m_2025_03_29/settings.rs b/crates/migrator/src/migrations/m_2025_03_29/settings.rs index 367929c713..47f65b407d 100644 --- a/crates/migrator/src/migrations/m_2025_03_29/settings.rs +++ b/crates/migrator/src/migrations/m_2025_03_29/settings.rs @@ -1,8 +1,8 @@ use std::ops::Range; use tree_sitter::{Query, QueryMatch}; -use crate::patterns::SETTINGS_ROOT_KEY_VALUE_PATTERN; use crate::MigrationPatterns; +use crate::patterns::SETTINGS_ROOT_KEY_VALUE_PATTERN; pub const SETTINGS_PATTERNS: MigrationPatterns = &[ (SETTINGS_ROOT_KEY_VALUE_PATTERN, replace_setting_name), diff --git a/crates/mistral/src/mistral.rs b/crates/mistral/src/mistral.rs index 19ed244eb9..de2457e0bf 100644 --- a/crates/mistral/src/mistral.rs +++ b/crates/mistral/src/mistral.rs @@ -1,5 +1,5 @@ -use anyhow::{anyhow, Result}; -use futures::{io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, StreamExt}; +use anyhow::{Result, anyhow}; +use futures::{AsyncBufReadExt, AsyncReadExt, StreamExt, io::BufReader, stream::BoxStream}; use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest}; use serde::{Deserialize, Serialize}; use serde_json::Value; diff --git a/crates/multi_buffer/src/multi_buffer.rs b/crates/multi_buffer/src/multi_buffer.rs index 3952d20a0d..162d2d6e34 100644 --- a/crates/multi_buffer/src/multi_buffer.rs +++ b/crates/multi_buffer/src/multi_buffer.rs @@ -6,23 +6,23 @@ mod position; pub use anchor::{Anchor, AnchorRangeExt, Offset}; pub use position::{TypedOffset, TypedPoint, TypedRow}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use buffer_diff::{ BufferDiff, BufferDiffEvent, BufferDiffSnapshot, DiffHunkSecondaryStatus, DiffHunkStatus, DiffHunkStatusKind, }; use clock::ReplicaId; use collections::{BTreeMap, Bound, HashMap, HashSet}; -use futures::{channel::mpsc, SinkExt}; +use futures::{SinkExt, channel::mpsc}; use gpui::{App, AppContext as _, Context, Entity, EntityId, EventEmitter, Task}; use itertools::Itertools; use language::{ - language_settings::{language_settings, IndentGuideSettings, LanguageSettings}, AutoindentMode, Buffer, BufferChunks, BufferRow, BufferSnapshot, Capability, CharClassifier, CharKind, Chunk, CursorShape, DiagnosticEntry, DiskState, File, IndentSize, Language, LanguageScope, OffsetRangeExt, OffsetUtf16, Outline, OutlineItem, Point, PointUtf16, Selection, TextDimension, TextObject, ToOffset as _, ToPoint as _, TransactionId, TreeSitterOptions, Unclipped, + language_settings::{IndentGuideSettings, LanguageSettings, language_settings}, }; use rope::DimensionPair; @@ -46,9 +46,9 @@ use std::{ }; use sum_tree::{Bias, Cursor, SumTree, TreeMap}; use text::{ + BufferId, Edit, LineIndent, TextSummary, locator::Locator, subscription::{Subscription, Topic}, - BufferId, Edit, LineIndent, TextSummary, }; use theme::SyntaxTheme; use util::post_inc; @@ -2042,12 +2042,12 @@ impl MultiBuffer { ExcerptDimension(excerpt_start.0 + excerpt.text_summary.lines); diff_transforms.seek_forward(&excerpt_start, Bias::Left, &()); - let overshoot = excerpt_start.0 - diff_transforms.start().0 .0; - let start = diff_transforms.start().1 .0 + overshoot; + let overshoot = excerpt_start.0 - diff_transforms.start().0.0; + let start = diff_transforms.start().1.0 + overshoot; diff_transforms.seek_forward(&excerpt_end, Bias::Right, &()); - let overshoot = excerpt_end.0 - diff_transforms.start().0 .0; - let end = diff_transforms.start().1 .0 + overshoot; + let overshoot = excerpt_end.0 - diff_transforms.start().0.0; + let end = diff_transforms.start().1.0 + overshoot; result.push(start..end) } @@ -4674,7 +4674,7 @@ impl MultiBufferSnapshot { D: TextDimension + Ord + Sub, { loop { - let transform_end_position = diff_transforms.end(&()).0 .0; + let transform_end_position = diff_transforms.end(&()).0.0; let at_transform_end = excerpt_position == transform_end_position && diff_transforms.item().is_some(); if at_transform_end && anchor.text_anchor.bias == Bias::Right { @@ -4682,7 +4682,7 @@ impl MultiBufferSnapshot { continue; } - let mut position = diff_transforms.start().1 .0; + let mut position = diff_transforms.start().1.0; match diff_transforms.item() { Some(DiffTransform::DeletedHunk { buffer_id, @@ -4716,7 +4716,7 @@ impl MultiBufferSnapshot { diff_transforms.next(&()); continue; } - let overshoot = excerpt_position - diff_transforms.start().0 .0; + let overshoot = excerpt_position - diff_transforms.start().0.0; position.add_assign(&overshoot); } } @@ -4812,7 +4812,7 @@ impl MultiBufferSnapshot { position.add_assign(&(summary - excerpt_buffer_start)); } - if position > diff_transforms_cursor.start().0 .0 { + if position > diff_transforms_cursor.start().0.0 { diff_transforms_cursor.seek_forward( &ExcerptDimension(position), Bias::Left, @@ -5155,7 +5155,7 @@ impl MultiBufferSnapshot { let excerpt = excerpts.item()?; Some(MultiBufferExcerpt { excerpt, - offset: diff_transforms.start().0 .0, + offset: diff_transforms.start().0.0, buffer_offset: excerpt.range.context.start.to_offset(&excerpt.buffer), excerpt_offset: excerpts.start().1.clone(), diff_transforms, @@ -5209,50 +5209,52 @@ impl MultiBufferSnapshot { cursor.next_excerpt(); - iter::from_fn(move || loop { - if self.singleton { - return None; - } + iter::from_fn(move || { + loop { + if self.singleton { + return None; + } - let next_region = cursor.region()?; - cursor.next_excerpt(); - if !bounds.contains(&next_region.range.start.key) { - prev_region = Some(next_region); - continue; - } + let next_region = cursor.region()?; + cursor.next_excerpt(); + if !bounds.contains(&next_region.range.start.key) { + prev_region = Some(next_region); + continue; + } - let next_region_start = next_region.range.start.value.unwrap(); - let next_region_end = if let Some(region) = cursor.region() { - region.range.start.value.unwrap() - } else { - self.max_point() - }; - - let prev = prev_region.as_ref().map(|region| ExcerptInfo { - id: region.excerpt.id, - buffer: region.excerpt.buffer.clone(), - buffer_id: region.excerpt.buffer_id, - range: region.excerpt.range.clone(), - end_row: MultiBufferRow(next_region_start.row), - }); - - let next = ExcerptInfo { - id: next_region.excerpt.id, - buffer: next_region.excerpt.buffer.clone(), - buffer_id: next_region.excerpt.buffer_id, - range: next_region.excerpt.range.clone(), - end_row: if next_region.excerpt.has_trailing_newline { - MultiBufferRow(next_region_end.row - 1) + let next_region_start = next_region.range.start.value.unwrap(); + let next_region_end = if let Some(region) = cursor.region() { + region.range.start.value.unwrap() } else { - MultiBufferRow(next_region_end.row) - }, - }; + self.max_point() + }; - let row = MultiBufferRow(next_region_start.row); + let prev = prev_region.as_ref().map(|region| ExcerptInfo { + id: region.excerpt.id, + buffer: region.excerpt.buffer.clone(), + buffer_id: region.excerpt.buffer_id, + range: region.excerpt.range.clone(), + end_row: MultiBufferRow(next_region_start.row), + }); - prev_region = Some(next_region); + let next = ExcerptInfo { + id: next_region.excerpt.id, + buffer: next_region.excerpt.buffer.clone(), + buffer_id: next_region.excerpt.buffer_id, + range: next_region.excerpt.range.clone(), + end_row: if next_region.excerpt.has_trailing_newline { + MultiBufferRow(next_region_end.row - 1) + } else { + MultiBufferRow(next_region_end.row) + }, + }; - return Some(ExcerptBoundary { row, prev, next }); + let row = MultiBufferRow(next_region_start.row); + + prev_region = Some(next_region); + + return Some(ExcerptBoundary { row, prev, next }); + } }) } @@ -6014,11 +6016,11 @@ impl MultiBufferSnapshot { .diff_transforms .cursor::<(ExcerptDimension, OutputDimension)>(&()); diff_transforms.seek(&start, Bias::Left, &()); - let overshoot = start.0 - diff_transforms.start().0 .0; - let start = diff_transforms.start().1 .0 + overshoot; + let overshoot = start.0 - diff_transforms.start().0.0; + let start = diff_transforms.start().1.0 + overshoot; diff_transforms.seek(&end, Bias::Right, &()); - let overshoot = end.0 - diff_transforms.start().0 .0; - let end = diff_transforms.start().1 .0 + overshoot; + let overshoot = end.0 - diff_transforms.start().0.0; + let end = diff_transforms.start().1.0 + overshoot; Some(start..end) } else { None @@ -6224,13 +6226,13 @@ where self.cached_region.take(); self.diff_transforms .seek(&OutputDimension(*position), Bias::Right, &()); - if self.diff_transforms.item().is_none() && *position == self.diff_transforms.start().0 .0 { + if self.diff_transforms.item().is_none() && *position == self.diff_transforms.start().0.0 { self.diff_transforms.prev(&()); } - let mut excerpt_position = self.diff_transforms.start().1 .0; + let mut excerpt_position = self.diff_transforms.start().1.0; if let Some(DiffTransform::BufferContent { .. }) = self.diff_transforms.item() { - let overshoot = *position - self.diff_transforms.start().0 .0; + let overshoot = *position - self.diff_transforms.start().0.0; excerpt_position.add_assign(&overshoot); } @@ -6245,12 +6247,12 @@ where self.cached_region.take(); self.diff_transforms .seek_forward(&OutputDimension(*position), Bias::Right, &()); - if self.diff_transforms.item().is_none() && *position == self.diff_transforms.start().0 .0 { + if self.diff_transforms.item().is_none() && *position == self.diff_transforms.start().0.0 { self.diff_transforms.prev(&()); } - let overshoot = *position - self.diff_transforms.start().0 .0; - let mut excerpt_position = self.diff_transforms.start().1 .0; + let overshoot = *position - self.diff_transforms.start().0.0; + let mut excerpt_position = self.diff_transforms.start().1.0; if let Some(DiffTransform::BufferContent { .. }) = self.diff_transforms.item() { excerpt_position.add_assign(&overshoot); } @@ -6373,7 +6375,7 @@ where let buffer = &excerpt.buffer; let buffer_context_start = excerpt.range.context.start.summary::(buffer); let mut buffer_start = buffer_context_start; - let overshoot = self.diff_transforms.end(&()).1 .0 - self.excerpts.start().0; + let overshoot = self.diff_transforms.end(&()).1.0 - self.excerpts.start().0; buffer_start.add_assign(&overshoot); Some(buffer_start) } @@ -6395,8 +6397,8 @@ where let buffer_range_len = rope_cursor.summary::(base_text_byte_range.end); let mut buffer_end = buffer_start; buffer_end.add_assign(&buffer_range_len); - let start = self.diff_transforms.start().0 .0; - let end = self.diff_transforms.end(&()).0 .0; + let start = self.diff_transforms.start().0.0; + let end = self.diff_transforms.end(&()).0.0; return Some(MultiBufferRegion { buffer, excerpt, @@ -6415,28 +6417,28 @@ where let buffer = &excerpt.buffer; let buffer_context_start = excerpt.range.context.start.summary::(buffer); - let mut start = self.diff_transforms.start().0 .0; + let mut start = self.diff_transforms.start().0.0; let mut buffer_start = buffer_context_start; if self.diff_transforms.start().1 < *self.excerpts.start() { - let overshoot = self.excerpts.start().0 - self.diff_transforms.start().1 .0; + let overshoot = self.excerpts.start().0 - self.diff_transforms.start().1.0; start.add_assign(&overshoot); } else { - let overshoot = self.diff_transforms.start().1 .0 - self.excerpts.start().0; + let overshoot = self.diff_transforms.start().1.0 - self.excerpts.start().0; buffer_start.add_assign(&overshoot); } let mut end; let mut buffer_end; let has_trailing_newline; - if self.diff_transforms.end(&()).1 .0 < self.excerpts.end(&()).0 { - let overshoot = self.diff_transforms.end(&()).1 .0 - self.excerpts.start().0; - end = self.diff_transforms.end(&()).0 .0; + if self.diff_transforms.end(&()).1.0 < self.excerpts.end(&()).0 { + let overshoot = self.diff_transforms.end(&()).1.0 - self.excerpts.start().0; + end = self.diff_transforms.end(&()).0.0; buffer_end = buffer_context_start; buffer_end.add_assign(&overshoot); has_trailing_newline = false; } else { - let overshoot = self.excerpts.end(&()).0 - self.diff_transforms.start().1 .0; - end = self.diff_transforms.start().0 .0; + let overshoot = self.excerpts.end(&()).0 - self.diff_transforms.start().1.0; + end = self.diff_transforms.start().0.0; end.add_assign(&overshoot); buffer_end = excerpt.range.context.end.summary::(buffer); has_trailing_newline = excerpt.has_trailing_newline; @@ -6834,7 +6836,7 @@ impl<'a> MultiBufferExcerpt<'a> { fn map_offset_to_buffer_internal(&self, offset: usize) -> usize { let mut excerpt_offset = self.diff_transforms.start().1.clone(); if let Some(DiffTransform::BufferContent { .. }) = self.diff_transforms.item() { - excerpt_offset.0 += offset - self.diff_transforms.start().0 .0; + excerpt_offset.0 += offset - self.diff_transforms.start().0.0; }; let offset_in_excerpt = excerpt_offset.0.saturating_sub(self.excerpt_offset.0); self.buffer_offset + offset_in_excerpt @@ -6857,22 +6859,22 @@ impl<'a> MultiBufferExcerpt<'a> { let overshoot = buffer_range.start - self.buffer_offset; let excerpt_offset = ExcerptDimension(self.excerpt_offset.0 + overshoot); self.diff_transforms.seek(&excerpt_offset, Bias::Right, &()); - if excerpt_offset.0 < self.diff_transforms.start().1 .0 { + if excerpt_offset.0 < self.diff_transforms.start().1.0 { log::warn!( "Attempting to map a range from a buffer offset that starts before the current buffer offset" ); return buffer_range; } - let overshoot = excerpt_offset.0 - self.diff_transforms.start().1 .0; - let start = self.diff_transforms.start().0 .0 + overshoot; + let overshoot = excerpt_offset.0 - self.diff_transforms.start().1.0; + let start = self.diff_transforms.start().0.0 + overshoot; let end = if buffer_range.end > buffer_range.start { let overshoot = buffer_range.end - self.buffer_offset; let excerpt_offset = ExcerptDimension(self.excerpt_offset.0 + overshoot); self.diff_transforms .seek_forward(&excerpt_offset, Bias::Right, &()); - let overshoot = excerpt_offset.0 - self.diff_transforms.start().1 .0; - self.diff_transforms.start().0 .0 + overshoot + let overshoot = excerpt_offset.0 - self.diff_transforms.start().1.0; + self.diff_transforms.start().0.0 + overshoot } else { start }; @@ -7157,7 +7159,7 @@ impl cursor_location: &(OutputDimension, ExcerptDimension), _: &(), ) -> cmp::Ordering { - Ord::cmp(&self.0, &cursor_location.1 .0) + Ord::cmp(&self.0, &cursor_location.1.0) } } @@ -7239,7 +7241,7 @@ impl Iterator for MultiBufferRows<'_> { if let Some(next_region) = self.cursor.region() { region = next_region; } else { - if self.point == self.cursor.diff_transforms.end(&()).0 .0 { + if self.point == self.cursor.diff_transforms.end(&()).0.0 { let multibuffer_row = MultiBufferRow(self.point.row); let last_excerpt = self .cursor diff --git a/crates/node_runtime/src/archive.rs b/crates/node_runtime/src/archive.rs index 0ac1493d28..76f754eca2 100644 --- a/crates/node_runtime/src/archive.rs +++ b/crates/node_runtime/src/archive.rs @@ -2,7 +2,7 @@ use std::path::Path; use anyhow::Result; use async_zip::base::read::stream::ZipFileReader; -use futures::{io::BufReader, AsyncRead}; +use futures::{AsyncRead, io::BufReader}; pub async fn extract_zip(destination: &Path, reader: R) -> Result<()> { let mut reader = ZipFileReader::new(BufReader::new(reader)); @@ -35,8 +35,8 @@ pub async fn extract_zip(destination: &Path, reader: R) -> mod tests { use std::path::PathBuf; - use async_zip::base::write::ZipFileWriter; use async_zip::ZipEntryBuilder; + use async_zip::base::write::ZipFileWriter; use futures::AsyncWriteExt; use smol::io::Cursor; use tempfile::TempDir; diff --git a/crates/node_runtime/src/node_runtime.rs b/crates/node_runtime/src/node_runtime.rs index 8fad097505..80d7da1373 100644 --- a/crates/node_runtime/src/node_runtime.rs +++ b/crates/node_runtime/src/node_runtime.rs @@ -1,6 +1,6 @@ mod archive; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; pub use archive::extract_zip; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; @@ -279,10 +279,12 @@ impl ManagedNodeRuntime { async fn node_environment_path(&self) -> Result { let node_binary = self.installation_path.join(Self::NODE_PATH); - let mut env_path = vec![node_binary - .parent() - .expect("invalid node binary path") - .to_path_buf()]; + let mut env_path = vec![ + node_binary + .parent() + .expect("invalid node binary path") + .to_path_buf(), + ]; if let Some(existing_path) = std::env::var_os("PATH") { let mut paths = std::env::split_paths(&existing_path).collect::>(); diff --git a/crates/notifications/src/notification_store.rs b/crates/notifications/src/notification_store.rs index 68a3b57f37..c2f18e5700 100644 --- a/crates/notifications/src/notification_store.rs +++ b/crates/notifications/src/notification_store.rs @@ -4,7 +4,7 @@ use client::{ChannelId, Client, UserStore}; use collections::HashMap; use db::smol::stream::StreamExt; use gpui::{App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, Task}; -use rpc::{proto, Notification, TypedEnvelope}; +use rpc::{Notification, TypedEnvelope, proto}; use std::{ops::Range, sync::Arc}; use sum_tree::{Bias, SumTree}; use time::OffsetDateTime; @@ -368,7 +368,7 @@ impl NotificationStore { new_notifications.append(cursor.slice(&NotificationId(id), Bias::Left, &()), &()); if i == 0 { - old_range.start = cursor.start().1 .0; + old_range.start = cursor.start().1.0; } let old_notification = cursor.item(); @@ -401,7 +401,7 @@ impl NotificationStore { } } - old_range.end = cursor.start().1 .0; + old_range.end = cursor.start().1.0; let new_count = new_notifications.summary().count - old_range.start; new_notifications.append(cursor.suffix(&()), &()); drop(cursor); diff --git a/crates/notifications/src/status_toast.rs b/crates/notifications/src/status_toast.rs index 5f5bb192ac..e8e7876d99 100644 --- a/crates/notifications/src/status_toast.rs +++ b/crates/notifications/src/status_toast.rs @@ -1,7 +1,7 @@ use std::rc::Rc; use gpui::{DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, IntoElement}; -use ui::{prelude::*, Tooltip}; +use ui::{Tooltip, prelude::*}; use workspace::{ToastAction, ToastView}; #[derive(Clone, Copy)] diff --git a/crates/ollama/src/ollama.rs b/crates/ollama/src/ollama.rs index 0313ddd7c9..640e672f7f 100644 --- a/crates/ollama/src/ollama.rs +++ b/crates/ollama/src/ollama.rs @@ -1,9 +1,9 @@ -use anyhow::{anyhow, Context as _, Result}; -use futures::{io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, StreamExt}; -use http_client::{http, AsyncBody, HttpClient, Method, Request as HttpRequest}; +use anyhow::{Context as _, Result, anyhow}; +use futures::{AsyncBufReadExt, AsyncReadExt, StreamExt, io::BufReader, stream::BoxStream}; +use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest, http}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use serde_json::{value::RawValue, Value}; +use serde_json::{Value, value::RawValue}; use std::{convert::TryFrom, sync::Arc, time::Duration}; pub const OLLAMA_API_URL: &str = "http://localhost:11434"; diff --git a/crates/open_ai/src/open_ai.rs b/crates/open_ai/src/open_ai.rs index c62b1c2950..ca5eafaacd 100644 --- a/crates/open_ai/src/open_ai.rs +++ b/crates/open_ai/src/open_ai.rs @@ -1,10 +1,10 @@ mod supported_countries; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use futures::{ + AsyncBufReadExt, AsyncReadExt, Stream, StreamExt, io::BufReader, stream::{self, BoxStream}, - AsyncBufReadExt, AsyncReadExt, Stream, StreamExt, }; use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest}; use serde::{Deserialize, Serialize}; diff --git a/crates/outline/src/outline.rs b/crates/outline/src/outline.rs index 88b134f6c7..d2aba0bca4 100644 --- a/crates/outline/src/outline.rs +++ b/crates/outline/src/outline.rs @@ -4,19 +4,19 @@ use std::{ sync::Arc, }; -use editor::{scroll::Autoscroll, Anchor, AnchorRangeExt, Editor, EditorMode}; +use editor::{Anchor, AnchorRangeExt, Editor, EditorMode, scroll::Autoscroll}; use fuzzy::StringMatch; use gpui::{ - div, rems, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, - HighlightStyle, ParentElement, Point, Render, Styled, StyledText, Task, TextStyle, WeakEntity, - Window, + App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, HighlightStyle, + ParentElement, Point, Render, Styled, StyledText, Task, TextStyle, WeakEntity, Window, div, + rems, }; use language::{Outline, OutlineItem}; use ordered_float::OrderedFloat; use picker::{Picker, PickerDelegate}; use settings::Settings; use theme::{ActiveTheme, ThemeSettings}; -use ui::{prelude::*, ListItem, ListItemSpacing}; +use ui::{ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::{DismissDecision, ModalView}; diff --git a/crates/outline_panel/src/outline_panel.rs b/crates/outline_panel/src/outline_panel.rs index 1e6146c1eb..684fedb120 100644 --- a/crates/outline_panel/src/outline_panel.rs +++ b/crates/outline_panel/src/outline_panel.rs @@ -5,35 +5,35 @@ use std::{ collections::BTreeMap, hash::Hash, ops::Range, - path::{Path, PathBuf, MAIN_SEPARATOR_STR}, + path::{MAIN_SEPARATOR_STR, Path, PathBuf}, sync::{ - atomic::{self, AtomicBool}, Arc, OnceLock, + atomic::{self, AtomicBool}, }, time::Duration, u32, }; use anyhow::Context as _; -use collections::{hash_map, BTreeSet, HashMap, HashSet}; +use collections::{BTreeSet, HashMap, HashSet, hash_map}; use db::kvp::KEY_VALUE_STORE; use editor::{ + AnchorRangeExt, Bias, DisplayPoint, Editor, EditorEvent, EditorMode, EditorSettings, ExcerptId, + ExcerptRange, MultiBufferSnapshot, RangeToAnchorExt, ShowScrollbar, display_map::ToDisplayPoint, items::{entry_git_aware_label_color, entry_label_color}, scroll::{Autoscroll, AutoscrollStrategy, ScrollAnchor, ScrollbarAutoHide}, - AnchorRangeExt, Bias, DisplayPoint, Editor, EditorEvent, EditorMode, EditorSettings, ExcerptId, - ExcerptRange, MultiBufferSnapshot, RangeToAnchorExt, ShowScrollbar, }; use file_icons::FileIcons; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{ - actions, anchored, deferred, div, point, px, size, uniform_list, Action, AnyElement, App, - AppContext as _, AsyncWindowContext, Bounds, ClipboardItem, Context, DismissEvent, Div, - ElementId, Entity, EventEmitter, FocusHandle, Focusable, HighlightStyle, InteractiveElement, - IntoElement, KeyContext, ListHorizontalSizingBehavior, ListSizingBehavior, MouseButton, - MouseDownEvent, ParentElement, Pixels, Point, Render, ScrollStrategy, SharedString, Stateful, - StatefulInteractiveElement as _, Styled, Subscription, Task, UniformListScrollHandle, - WeakEntity, Window, + Action, AnyElement, App, AppContext as _, AsyncWindowContext, Bounds, ClipboardItem, Context, + DismissEvent, Div, ElementId, Entity, EventEmitter, FocusHandle, Focusable, HighlightStyle, + InteractiveElement, IntoElement, KeyContext, ListHorizontalSizingBehavior, ListSizingBehavior, + MouseButton, MouseDownEvent, ParentElement, Pixels, Point, Render, ScrollStrategy, + SharedString, Stateful, StatefulInteractiveElement as _, Styled, Subscription, Task, + UniformListScrollHandle, WeakEntity, Window, actions, anchored, deferred, div, point, px, size, + uniform_list, }; use itertools::Itertools; use language::{BufferId, BufferSnapshot, OffsetRangeExt, OutlineItem}; @@ -47,18 +47,18 @@ use settings::{Settings, SettingsStore}; use smol::channel; use theme::{SyntaxTheme, ThemeSettings}; use ui::{DynamicSpacing, IndentGuideColors, IndentGuideLayout}; -use util::{debug_panic, RangeExt, ResultExt, TryFutureExt}; +use util::{RangeExt, ResultExt, TryFutureExt, debug_panic}; use workspace::{ + OpenInTerminal, WeakItemHandle, Workspace, dock::{DockPosition, Panel, PanelEvent}, item::ItemHandle, searchable::{SearchEvent, SearchableItem}, ui::{ - h_flex, v_flex, ActiveTheme, ButtonCommon, Clickable, Color, ContextMenu, FluentBuilder, - HighlightedLabel, Icon, IconButton, IconButtonShape, IconName, IconSize, Label, - LabelCommon, ListItem, Scrollbar, ScrollbarState, StyledExt, StyledTypography, Toggleable, - Tooltip, + ActiveTheme, ButtonCommon, Clickable, Color, ContextMenu, FluentBuilder, HighlightedLabel, + Icon, IconButton, IconButtonShape, IconName, IconSize, Label, LabelCommon, ListItem, + Scrollbar, ScrollbarState, StyledExt, StyledTypography, Toggleable, Tooltip, h_flex, + v_flex, }, - OpenInTerminal, WeakItemHandle, Workspace, }; use worktree::{Entry, ProjectEntryId, WorktreeId}; @@ -1767,11 +1767,7 @@ impl OutlinePanel { active_editor.update(cx, |editor, cx| { buffers_to_toggle.retain(|buffer_id| { let folded = editor.is_buffer_folded(*buffer_id, cx); - if fold { - !folded - } else { - folded - } + if fold { !folded } else { folded } }); }); @@ -5165,7 +5161,7 @@ impl GenerationState { mod tests { use db::indoc; use gpui::{TestAppContext, VisualTestContext, WindowHandle}; - use language::{tree_sitter_rust, Language, LanguageConfig, LanguageMatcher}; + use language::{Language, LanguageConfig, LanguageMatcher, tree_sitter_rust}; use pretty_assertions::assert_eq; use project::FakeFs; use search::project_search::{self, perform_project_search}; diff --git a/crates/panel/src/panel.rs b/crates/panel/src/panel.rs index 9859bf6444..58edb1e81d 100644 --- a/crates/panel/src/panel.rs +++ b/crates/panel/src/panel.rs @@ -1,9 +1,9 @@ //! # panel use editor::{Editor, EditorElement, EditorStyle}; -use gpui::{actions, Entity, TextStyle}; +use gpui::{Entity, TextStyle, actions}; use settings::Settings; use theme::ThemeSettings; -use ui::{prelude::*, Tab}; +use ui::{Tab, prelude::*}; actions!(panel, [NextPanelTab, PreviousPanelTab]); diff --git a/crates/picker/src/head.rs b/crates/picker/src/head.rs index 539a301cd4..aba7b8a1d0 100644 --- a/crates/picker/src/head.rs +++ b/crates/picker/src/head.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use editor::{Editor, EditorEvent}; -use gpui::{prelude::*, App, Entity, FocusHandle, Focusable}; +use gpui::{App, Entity, FocusHandle, Focusable, prelude::*}; use ui::prelude::*; /// The head of a [`Picker`](crate::Picker). @@ -17,7 +17,7 @@ impl Head { pub fn editor( placeholder_text: Arc, edit_handler: impl FnMut(&mut V, &Entity, &EditorEvent, &mut Window, &mut Context) - + 'static, + + 'static, window: &mut Window, cx: &mut Context, ) -> Self { diff --git a/crates/picker/src/highlighted_match_with_paths.rs b/crates/picker/src/highlighted_match_with_paths.rs index 9455ec3d43..255e0150e8 100644 --- a/crates/picker/src/highlighted_match_with_paths.rs +++ b/crates/picker/src/highlighted_match_with_paths.rs @@ -1,4 +1,4 @@ -use ui::{prelude::*, HighlightedLabel}; +use ui::{HighlightedLabel, prelude::*}; #[derive(Clone)] pub struct HighlightedMatchWithPaths { diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index 9c6fa555aa..2caa9ff756 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -1,17 +1,17 @@ use anyhow::Result; -use editor::{scroll::Autoscroll, Editor}; +use editor::{Editor, scroll::Autoscroll}; use gpui::{ - actions, div, impl_actions, list, prelude::*, uniform_list, AnyElement, App, ClickEvent, - Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Length, - ListSizingBehavior, ListState, MouseButton, MouseUpEvent, Render, ScrollHandle, ScrollStrategy, - Stateful, Task, UniformListScrollHandle, Window, + AnyElement, App, ClickEvent, Context, DismissEvent, Entity, EventEmitter, FocusHandle, + Focusable, Length, ListSizingBehavior, ListState, MouseButton, MouseUpEvent, Render, + ScrollHandle, ScrollStrategy, Stateful, Task, UniformListScrollHandle, Window, actions, div, + impl_actions, list, prelude::*, uniform_list, }; use head::Head; use schemars::JsonSchema; use serde::Deserialize; use std::{sync::Arc, time::Duration}; use ui::{ - prelude::*, v_flex, Color, Divider, Label, ListItem, ListItemSpacing, Scrollbar, ScrollbarState, + Color, Divider, Label, ListItem, ListItemSpacing, Scrollbar, ScrollbarState, prelude::*, v_flex, }; use util::ResultExt; use workspace::ModalView; diff --git a/crates/prettier/src/prettier.rs b/crates/prettier/src/prettier.rs index cfba2bca4e..0e6f5c0d3e 100644 --- a/crates/prettier/src/prettier.rs +++ b/crates/prettier/src/prettier.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use collections::{HashMap, HashSet}; use fs::Fs; use gpui::{AsyncApp, Entity}; -use language::{language_settings::language_settings, Buffer, Diff}; +use language::{Buffer, Diff, language_settings::language_settings}; use lsp::{LanguageServer, LanguageServerId}; use node_runtime::NodeRuntime; use paths::default_prettier_dir; diff --git a/crates/project/src/buffer_store.rs b/crates/project/src/buffer_store.rs index 409a15ca42..c3d5f3b528 100644 --- a/crates/project/src/buffer_store.rs +++ b/crates/project/src/buffer_store.rs @@ -1,32 +1,32 @@ use crate::{ + ProjectItem as _, ProjectPath, lsp_store::OpenLspBufferHandle, search::SearchQuery, worktree_store::{WorktreeStore, WorktreeStoreEvent}, - ProjectItem as _, ProjectPath, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use client::Client; -use collections::{hash_map, HashMap, HashSet}; +use collections::{HashMap, HashSet, hash_map}; use fs::Fs; -use futures::{channel::oneshot, future::Shared, Future, FutureExt as _, StreamExt}; +use futures::{Future, FutureExt as _, StreamExt, channel::oneshot, future::Shared}; use gpui::{ App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Subscription, Task, WeakEntity, }; use language::{ + Buffer, BufferEvent, Capability, DiskState, File as _, Language, Operation, proto::{ deserialize_line_ending, deserialize_version, serialize_line_ending, serialize_version, split_operations, }, - Buffer, BufferEvent, Capability, DiskState, File as _, Language, Operation, }; use rpc::{ - proto::{self, ToProto}, AnyProtoClient, ErrorExt as _, TypedEnvelope, + proto::{self, ToProto}, }; use smol::channel::Receiver; use std::{io, path::Path, pin::pin, sync::Arc, time::Instant}; use text::BufferId; -use util::{debug_panic, maybe, ResultExt as _, TryFutureExt}; +use util::{ResultExt as _, TryFutureExt, debug_panic, maybe}; use worktree::{File, PathChange, ProjectEntryId, Worktree, WorktreeId}; /// A set of open buffers. diff --git a/crates/project/src/debounced_delay.rs b/crates/project/src/debounced_delay.rs index e6fc2e0a35..0ea045be5f 100644 --- a/crates/project/src/debounced_delay.rs +++ b/crates/project/src/debounced_delay.rs @@ -1,4 +1,4 @@ -use futures::{channel::oneshot, FutureExt}; +use futures::{FutureExt, channel::oneshot}; use gpui::{Context, Task}; use std::{marker::PhantomData, time::Duration}; diff --git a/crates/project/src/debugger/breakpoint_store.rs b/crates/project/src/debugger/breakpoint_store.rs index 478e50b78c..d3a182162e 100644 --- a/crates/project/src/debugger/breakpoint_store.rs +++ b/crates/project/src/debugger/breakpoint_store.rs @@ -1,20 +1,20 @@ //! Module for managing breakpoints in a project. //! //! Breakpoints are separate from a session because they're not associated with any particular debug session. They can also be set up without a session running. -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use breakpoints_in_file::BreakpointsInFile; use collections::BTreeMap; use dap::client::SessionId; use gpui::{App, AppContext, AsyncApp, Context, Entity, EventEmitter, Subscription, Task}; -use language::{proto::serialize_anchor as serialize_text_anchor, Buffer, BufferSnapshot}; +use language::{Buffer, BufferSnapshot, proto::serialize_anchor as serialize_text_anchor}; use rpc::{ - proto::{self}, AnyProtoClient, TypedEnvelope, + proto::{self}, }; use std::{hash::Hash, ops::Range, path::Path, sync::Arc}; use text::PointUtf16; -use crate::{buffer_store::BufferStore, worktree_store::WorktreeStore, Project, ProjectPath}; +use crate::{Project, ProjectPath, buffer_store::BufferStore, worktree_store::WorktreeStore}; mod breakpoints_in_file { use language::BufferEvent; diff --git a/crates/project/src/debugger/dap_command.rs b/crates/project/src/debugger/dap_command.rs index e21480d950..0685e513d1 100644 --- a/crates/project/src/debugger/dap_command.rs +++ b/crates/project/src/debugger/dap_command.rs @@ -1,14 +1,14 @@ use std::sync::Arc; -use anyhow::{anyhow, Ok, Result}; +use anyhow::{Ok, Result, anyhow}; use dap::{ - client::SessionId, - proto_conversions::ProtoConversion, - requests::{Continue, Next}, Capabilities, ContinueArguments, InitializeRequestArguments, InitializeRequestArgumentsPathFormat, NextArguments, SetVariableResponse, SourceBreakpoint, StepInArguments, StepOutArguments, SteppingGranularity, ValueFormat, Variable, VariablesArgumentsFilter, + client::SessionId, + proto_conversions::ProtoConversion, + requests::{Continue, Next}, }; use rpc::proto; use serde_json::Value; diff --git a/crates/project/src/debugger/dap_store.rs b/crates/project/src/debugger/dap_store.rs index a8e629ecbe..e17d3eef2b 100644 --- a/crates/project/src/debugger/dap_store.rs +++ b/crates/project/src/debugger/dap_store.rs @@ -3,23 +3,23 @@ use super::{ locator_store::LocatorStore, session::{self, Session}, }; -use crate::{debugger, worktree_store::WorktreeStore, ProjectEnvironment}; -use anyhow::{anyhow, Result}; +use crate::{ProjectEnvironment, debugger, worktree_store::WorktreeStore}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use collections::HashMap; use dap::{ + Capabilities, CompletionItem, CompletionsArguments, DapRegistry, ErrorResponse, + EvaluateArguments, EvaluateArgumentsContext, EvaluateResponse, RunInTerminalRequestArguments, + Source, StartDebuggingRequestArguments, adapters::{DapStatus, DebugAdapterName}, client::SessionId, messages::Message, requests::{Completions, Evaluate, Request as _, RunInTerminal, StartDebugging}, - Capabilities, CompletionItem, CompletionsArguments, DapRegistry, ErrorResponse, - EvaluateArguments, EvaluateArgumentsContext, EvaluateResponse, RunInTerminalRequestArguments, - Source, StartDebuggingRequestArguments, }; use fs::Fs; use futures::{ channel::{mpsc, oneshot}, - future::{join_all, Shared}, + future::{Shared, join_all}, }; use gpui::{App, AppContext, AsyncApp, Context, Entity, EventEmitter, SharedString, Task}; use http_client::HttpClient; @@ -28,8 +28,8 @@ use lsp::LanguageServerName; use node_runtime::NodeRuntime; use rpc::{ - proto::{self}, AnyProtoClient, TypedEnvelope, + proto::{self}, }; use serde_json::Value; use settings::WorktreeId; @@ -39,7 +39,7 @@ use std::{ collections::{BTreeMap, HashSet}, ffi::OsStr, path::PathBuf, - sync::{atomic::Ordering::SeqCst, Arc}, + sync::{Arc, atomic::Ordering::SeqCst}, }; use std::{collections::VecDeque, sync::atomic::AtomicU32}; use task::{DebugAdapterConfig, DebugRequestDisposition}; diff --git a/crates/project/src/debugger/locator_store.rs b/crates/project/src/debugger/locator_store.rs index ef7f3a802a..d951cebfe9 100644 --- a/crates/project/src/debugger/locator_store.rs +++ b/crates/project/src/debugger/locator_store.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use cargo::CargoLocator; use collections::HashMap; use dap::DebugAdapterConfig; diff --git a/crates/project/src/debugger/locator_store/cargo.rs b/crates/project/src/debugger/locator_store/cargo.rs index 06307efe74..d2b9d31be1 100644 --- a/crates/project/src/debugger/locator_store/cargo.rs +++ b/crates/project/src/debugger/locator_store/cargo.rs @@ -1,5 +1,5 @@ use super::DapLocator; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use dap::DebugAdapterConfig; use serde_json::Value; diff --git a/crates/project/src/debugger/session.rs b/crates/project/src/debugger/session.rs index 6705694afe..75926e5824 100644 --- a/crates/project/src/debugger/session.rs +++ b/crates/project/src/debugger/session.rs @@ -10,25 +10,25 @@ use super::dap_command::{ VariablesCommand, }; use super::dap_store::DapAdapterDelegate; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::{HashMap, HashSet, IndexMap, IndexSet}; use dap::adapters::{DebugAdapter, DebugAdapterBinary}; use dap::messages::Response; use dap::{ + Capabilities, ContinueArguments, EvaluateArgumentsContext, Module, Source, StackFrameId, + SteppingGranularity, StoppedEvent, VariableReference, adapters::{DapDelegate, DapStatus}, client::{DebugAdapterClient, SessionId}, messages::{Events, Message}, - Capabilities, ContinueArguments, EvaluateArgumentsContext, Module, Source, StackFrameId, - SteppingGranularity, StoppedEvent, VariableReference, }; use dap::{DapRegistry, DebugRequestType, OutputEventCategory}; use futures::channel::oneshot; -use futures::{future::Shared, FutureExt}; +use futures::{FutureExt, future::Shared}; use gpui::{ App, AppContext, AsyncApp, BackgroundExecutor, Context, Entity, EventEmitter, Task, WeakEntity, }; use rpc::AnyProtoClient; -use serde_json::{json, Value}; +use serde_json::{Value, json}; use settings::Settings; use smol::stream::StreamExt; use std::any::TypeId; @@ -43,7 +43,7 @@ use std::{ }; use task::{DebugAdapterConfig, DebugTaskDefinition}; use text::{PointUtf16, ToPointUtf16}; -use util::{merge_json_value_into, ResultExt}; +use util::{ResultExt, merge_json_value_into}; #[derive(Debug, Copy, Clone, Hash, PartialEq, PartialOrd, Ord, Eq)] #[repr(transparent)] @@ -1194,8 +1194,12 @@ impl Session { fn fetch( &mut self, request: T, - process_result: impl FnOnce(&mut Self, Result, &mut Context) -> Option - + 'static, + process_result: impl FnOnce( + &mut Self, + Result, + &mut Context, + ) -> Option + + 'static, cx: &mut Context, ) { const { @@ -1246,8 +1250,12 @@ impl Session { session_id: SessionId, mode: &Mode, request: T, - process_result: impl FnOnce(&mut Self, Result, &mut Context) -> Option - + 'static, + process_result: impl FnOnce( + &mut Self, + Result, + &mut Context, + ) -> Option + + 'static, cx: &mut Context, ) -> Task> { if !T::is_supported(&capabilities) { @@ -1277,8 +1285,12 @@ impl Session { fn request( &self, request: T, - process_result: impl FnOnce(&mut Self, Result, &mut Context) -> Option - + 'static, + process_result: impl FnOnce( + &mut Self, + Result, + &mut Context, + ) -> Option + + 'static, cx: &mut Context, ) -> Task> { Self::request_inner( diff --git a/crates/project/src/environment.rs b/crates/project/src/environment.rs index 9934b6ac59..7f178c2d70 100644 --- a/crates/project/src/environment.rs +++ b/crates/project/src/environment.rs @@ -1,4 +1,4 @@ -use futures::{future::Shared, FutureExt}; +use futures::{FutureExt, future::Shared}; use std::{path::Path, sync::Arc}; use util::ResultExt; @@ -280,7 +280,7 @@ async fn load_shell_environment( Option>, Option, ) { - use crate::direnv::{load_direnv_environment, DirenvError}; + use crate::direnv::{DirenvError, load_direnv_environment}; use std::path::PathBuf; use util::parse_env_output; diff --git a/crates/project/src/git_store.rs b/crates/project/src/git_store.rs index f7b71fe261..63c18daf5b 100644 --- a/crates/project/src/git_store.rs +++ b/crates/project/src/git_store.rs @@ -1,22 +1,23 @@ pub mod git_traversal; use crate::{ + ProjectEnvironment, ProjectItem, ProjectPath, buffer_store::{BufferStore, BufferStoreEvent}, worktree_store::{WorktreeStore, WorktreeStoreEvent}, - ProjectEnvironment, ProjectItem, ProjectPath, }; -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use askpass::AskPassDelegate; use buffer_diff::{BufferDiff, BufferDiffEvent}; use client::ProjectId; use collections::HashMap; use fs::Fs; use futures::{ + FutureExt as _, StreamExt as _, channel::{mpsc, oneshot}, future::{self, OptionFuture, Shared}, - FutureExt as _, StreamExt as _, }; use git::{ + BuildPermalinkParams, GitHostingProviderRegistry, blame::Blame, parse_git_remote_url, repository::{ @@ -24,25 +25,24 @@ use git::{ Remote, RemoteCommandOutput, RepoPath, ResetMode, }, status::FileStatus, - BuildPermalinkParams, GitHostingProviderRegistry, }; use gpui::{ App, AppContext, AsyncApp, Context, Entity, EventEmitter, SharedString, Subscription, Task, WeakEntity, }; use language::{ - proto::{deserialize_version, serialize_version}, Buffer, BufferEvent, Language, LanguageRegistry, + proto::{deserialize_version, serialize_version}, }; use parking_lot::Mutex; use rpc::{ - proto::{self, git_reset, FromProto, ToProto, SSH_PROJECT_ID}, AnyProtoClient, TypedEnvelope, + proto::{self, FromProto, SSH_PROJECT_ID, ToProto, git_reset}, }; use serde::Deserialize; use settings::WorktreeId; use std::{ - collections::{hash_map, VecDeque}, + collections::{VecDeque, hash_map}, future::Future, ops::Range, path::{Path, PathBuf}, @@ -50,10 +50,10 @@ use std::{ }; use sum_tree::TreeSet; use text::BufferId; -use util::{debug_panic, maybe, ResultExt}; +use util::{ResultExt, debug_panic, maybe}; use worktree::{ - proto_to_branch, File, PathKey, ProjectEntryId, RepositoryEntry, StatusEntry, - UpdatedGitRepositoriesSet, Worktree, + File, PathKey, ProjectEntryId, RepositoryEntry, StatusEntry, UpdatedGitRepositoriesSet, + Worktree, proto_to_branch, }; pub struct GitStore { diff --git a/crates/project/src/image_store.rs b/crates/project/src/image_store.rs index 9ccbdb044d..f12f790be4 100644 --- a/crates/project/src/image_store.rs +++ b/crates/project/src/image_store.rs @@ -1,13 +1,13 @@ use crate::{ - worktree_store::{WorktreeStore, WorktreeStoreEvent}, Project, ProjectEntryId, ProjectItem, ProjectPath, + worktree_store::{WorktreeStore, WorktreeStoreEvent}, }; -use anyhow::{anyhow, Context as _, Result}; -use collections::{hash_map, HashMap, HashSet}; -use futures::{channel::oneshot, StreamExt}; +use anyhow::{Context as _, Result, anyhow}; +use collections::{HashMap, HashSet, hash_map}; +use futures::{StreamExt, channel::oneshot}; use gpui::{ - hash, prelude::*, App, AsyncApp, Context, Entity, EventEmitter, Img, Subscription, Task, - WeakEntity, + App, AsyncApp, Context, Entity, EventEmitter, Img, Subscription, Task, WeakEntity, hash, + prelude::*, }; pub use image::ImageFormat; use image::{ExtendedColorType, GenericImageView, ImageReader}; diff --git a/crates/project/src/lsp_command.rs b/crates/project/src/lsp_command.rs index 64f2623fe7..f10a7b7e5f 100644 --- a/crates/project/src/lsp_command.rs +++ b/crates/project/src/lsp_command.rs @@ -1,13 +1,13 @@ mod signature_help; use crate::{ - lsp_store::{LocalLspStore, LspStore}, CodeAction, CompletionSource, CoreCompletion, DocumentHighlight, DocumentSymbol, Hover, HoverBlock, HoverBlockKind, InlayHint, InlayHintLabel, InlayHintLabelPart, InlayHintLabelPartTooltip, InlayHintTooltip, Location, LocationLink, LspAction, MarkupContent, PrepareRenameResponse, ProjectTransaction, ResolveState, + lsp_store::{LocalLspStore, LspStore}, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_trait::async_trait; use client::proto::{self, PeerId}; use clock::Global; @@ -15,11 +15,12 @@ use collections::HashSet; use futures::future; use gpui::{App, AsyncApp, Entity}; use language::{ - language_settings::{language_settings, InlayHintKind, LanguageSettings}, + Anchor, Bias, Buffer, BufferSnapshot, CachedLspAdapter, CharKind, OffsetRangeExt, PointUtf16, + ToOffset, ToPointUtf16, Transaction, Unclipped, + language_settings::{InlayHintKind, LanguageSettings, language_settings}, point_from_lsp, point_to_lsp, proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version}, - range_from_lsp, range_to_lsp, Anchor, Bias, Buffer, BufferSnapshot, CachedLspAdapter, CharKind, - OffsetRangeExt, PointUtf16, ToOffset, ToPointUtf16, Transaction, Unclipped, + range_from_lsp, range_to_lsp, }; use lsp::{ AdapterServerCapabilities, CodeActionKind, CodeActionOptions, CompletionContext, diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs index 4bd8d68dd9..aacf10dcb7 100644 --- a/crates/project/src/lsp_store.rs +++ b/crates/project/src/lsp_store.rs @@ -3,6 +3,8 @@ pub mod lsp_ext_command; pub mod rust_analyzer_ext; use crate::{ + CodeAction, Completion, CompletionSource, CoreCompletion, Hover, InlayHint, LspAction, + ProjectItem, ProjectPath, ProjectTransaction, ResolveState, Symbol, ToolchainStore, buffer_store::{BufferStore, BufferStoreEvent}, environment::ProjectEnvironment, lsp_command::{self, *}, @@ -13,18 +15,16 @@ use crate::{ toolchain_store::{EmptyToolchainStore, ToolchainStoreEvent}, worktree_store::{WorktreeStore, WorktreeStoreEvent}, yarn::YarnPathStore, - CodeAction, Completion, CompletionSource, CoreCompletion, Hover, InlayHint, LspAction, - ProjectItem, ProjectPath, ProjectTransaction, ResolveState, Symbol, ToolchainStore, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_trait::async_trait; -use client::{proto, TypedEnvelope}; -use collections::{btree_map, BTreeMap, BTreeSet, HashMap, HashSet}; +use client::{TypedEnvelope, proto}; +use collections::{BTreeMap, BTreeSet, HashMap, HashSet, btree_map}; use futures::{ - future::{join_all, Shared}, + AsyncWriteExt, Future, FutureExt, StreamExt, + future::{Shared, join_all}, select, select_biased, stream::FuturesUnordered, - AsyncWriteExt, Future, FutureExt, StreamExt, }; use globset::{Glob, GlobBuilder, GlobMatcher, GlobSet, GlobSetBuilder}; use gpui::{ @@ -34,23 +34,25 @@ use gpui::{ use http_client::HttpClient; use itertools::Itertools as _; use language::{ + Bias, BinaryStatus, Buffer, BufferSnapshot, CachedLspAdapter, CodeLabel, Diagnostic, + DiagnosticEntry, DiagnosticSet, Diff, File as _, Language, LanguageRegistry, + LanguageToolchainStore, LocalFile, LspAdapter, LspAdapterDelegate, Patch, PointUtf16, + TextBufferSnapshot, ToOffset, ToPointUtf16, Transaction, Unclipped, language_settings::{ - language_settings, FormatOnSave, Formatter, LanguageSettings, SelectedFormatter, + FormatOnSave, Formatter, LanguageSettings, SelectedFormatter, language_settings, }, point_to_lsp, proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version}, - range_from_lsp, range_to_lsp, Bias, BinaryStatus, Buffer, BufferSnapshot, CachedLspAdapter, - CodeLabel, Diagnostic, DiagnosticEntry, DiagnosticSet, Diff, File as _, Language, - LanguageRegistry, LanguageToolchainStore, LocalFile, LspAdapter, LspAdapterDelegate, Patch, - PointUtf16, TextBufferSnapshot, ToOffset, ToPointUtf16, Transaction, Unclipped, + range_from_lsp, range_to_lsp, }; use lsp::{ - notification::DidRenameFiles, CodeActionKind, CompletionContext, DiagnosticSeverity, - DiagnosticTag, DidChangeWatchedFilesRegistrationOptions, Edit, FileOperationFilter, - FileOperationPatternKind, FileOperationRegistrationOptions, FileRename, FileSystemWatcher, - LanguageServer, LanguageServerBinary, LanguageServerBinaryOptions, LanguageServerId, - LanguageServerName, LspRequestFuture, MessageActionItem, MessageType, OneOf, RenameFilesParams, - SymbolKind, TextEdit, WillRenameFiles, WorkDoneProgressCancelParams, WorkspaceFolder, + CodeActionKind, CompletionContext, DiagnosticSeverity, DiagnosticTag, + DidChangeWatchedFilesRegistrationOptions, Edit, FileOperationFilter, FileOperationPatternKind, + FileOperationRegistrationOptions, FileRename, FileSystemWatcher, LanguageServer, + LanguageServerBinary, LanguageServerBinaryOptions, LanguageServerId, LanguageServerName, + LspRequestFuture, MessageActionItem, MessageType, OneOf, RenameFilesParams, SymbolKind, + TextEdit, WillRenameFiles, WorkDoneProgressCancelParams, WorkspaceFolder, + notification::DidRenameFiles, }; use node_runtime::read_package_installed_version; use parking_lot::Mutex; @@ -58,8 +60,8 @@ use postage::watch; use rand::prelude::*; use rpc::{ - proto::{FromProto, ToProto}, AnyProtoClient, + proto::{FromProto, ToProto}, }; use serde::Serialize; use settings::{Settings, SettingsLocation, SettingsStore}; @@ -83,8 +85,8 @@ use std::{ use text::{Anchor, BufferId, LineEnding, OffsetRangeExt}; use url::Url; use util::{ - debug_panic, defer, maybe, merge_json_value_into, paths::SanitizedPath, post_inc, ResultExt, - TryFutureExt as _, + ResultExt, TryFutureExt as _, debug_panic, defer, maybe, merge_json_value_into, + paths::SanitizedPath, post_inc, }; pub use fs::*; @@ -92,8 +94,8 @@ pub use language::Location; #[cfg(any(test, feature = "test-support"))] pub use prettier::FORMAT_SUFFIX as TEST_PRETTIER_FORMAT_SUFFIX; pub use worktree::{ - Entry, EntryKind, File, LocalWorktree, PathChange, ProjectEntryId, UpdatedEntriesSet, - UpdatedGitRepositoriesSet, Worktree, WorktreeId, WorktreeSettings, FS_WATCH_LATENCY, + Entry, EntryKind, FS_WATCH_LATENCY, File, LocalWorktree, PathChange, ProjectEntryId, + UpdatedEntriesSet, UpdatedGitRepositoriesSet, Worktree, WorktreeId, WorktreeSettings, }; const SERVER_LAUNCHING_BEFORE_SHUTDOWN_TIMEOUT: Duration = Duration::from_secs(5); @@ -3785,8 +3787,7 @@ impl LspStore { irrefutable_let_patterns, reason = "Make sure to handle new event types in extension properly" )] - let extension::Event::ExtensionsInstalledChanged = evt - else { + let extension::Event::ExtensionsInstalledChanged = evt else { return; }; if self.as_local().is_none() { diff --git a/crates/project/src/lsp_store/lsp_ext_command.rs b/crates/project/src/lsp_store/lsp_ext_command.rs index 1e2b7e55b3..fed0106a68 100644 --- a/crates/project/src/lsp_store/lsp_ext_command.rs +++ b/crates/project/src/lsp_store/lsp_ext_command.rs @@ -2,7 +2,7 @@ use crate::{lsp_command::LspCommand, lsp_store::LspStore, make_text_document_ide use anyhow::{Context as _, Result}; use async_trait::async_trait; use gpui::{App, AsyncApp, Entity}; -use language::{point_to_lsp, proto::deserialize_anchor, Buffer}; +use language::{Buffer, point_to_lsp, proto::deserialize_anchor}; use lsp::{LanguageServer, LanguageServerId}; use rpc::proto::{self, PeerId}; use serde::{Deserialize, Serialize}; diff --git a/crates/project/src/manifest_tree.rs b/crates/project/src/manifest_tree.rs index fb501980b4..64b36212a9 100644 --- a/crates/project/src/manifest_tree.rs +++ b/crates/project/src/manifest_tree.rs @@ -9,7 +9,7 @@ mod server_tree; use std::{ borrow::Borrow, - collections::{hash_map::Entry, BTreeMap}, + collections::{BTreeMap, hash_map::Entry}, ops::ControlFlow, sync::Arc, }; @@ -23,8 +23,8 @@ use settings::{SettingsStore, WorktreeId}; use worktree::{Event as WorktreeEvent, Worktree}; use crate::{ - worktree_store::{WorktreeStore, WorktreeStoreEvent}, ProjectPath, + worktree_store::{WorktreeStore, WorktreeStoreEvent}, }; pub(crate) use server_tree::{AdapterQuery, LanguageServerTree, LaunchDisposition}; diff --git a/crates/project/src/manifest_tree/path_trie.rs b/crates/project/src/manifest_tree/path_trie.rs index 8151b39e4d..5dd14ecf8f 100644 --- a/crates/project/src/manifest_tree/path_trie.rs +++ b/crates/project/src/manifest_tree/path_trie.rs @@ -1,5 +1,5 @@ use std::{ - collections::{btree_map::Entry, BTreeMap}, + collections::{BTreeMap, btree_map::Entry}, ffi::OsStr, ops::ControlFlow, path::{Path, PathBuf}, diff --git a/crates/project/src/manifest_tree/server_tree.rs b/crates/project/src/manifest_tree/server_tree.rs index 8aba35a03e..0a8cbbedb4 100644 --- a/crates/project/src/manifest_tree/server_tree.rs +++ b/crates/project/src/manifest_tree/server_tree.rs @@ -16,14 +16,14 @@ use std::{ use collections::{HashMap, IndexMap}; use gpui::{App, AppContext as _, Entity, Subscription}; use language::{ - language_settings::AllLanguageSettings, Attach, CachedLspAdapter, LanguageName, - LanguageRegistry, LspAdapterDelegate, + Attach, CachedLspAdapter, LanguageName, LanguageRegistry, LspAdapterDelegate, + language_settings::AllLanguageSettings, }; use lsp::LanguageServerName; use settings::{Settings, SettingsLocation, WorktreeId}; use std::sync::OnceLock; -use crate::{project_settings::LspSettings, LanguageServerId, ProjectPath}; +use crate::{LanguageServerId, ProjectPath, project_settings::LspSettings}; use super::{ManifestTree, ManifestTreeEvent}; diff --git a/crates/project/src/prettier_store.rs b/crates/project/src/prettier_store.rs index a51bec3df4..d3b681fec6 100644 --- a/crates/project/src/prettier_store.rs +++ b/crates/project/src/prettier_store.rs @@ -4,18 +4,18 @@ use std::{ sync::Arc, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::{HashMap, HashSet}; use fs::Fs; use futures::{ + FutureExt, future::{self, Shared}, stream::FuturesUnordered, - FutureExt, }; use gpui::{AppContext as _, AsyncApp, Context, Entity, EventEmitter, Task, WeakEntity}; use language::{ - language_settings::{Formatter, LanguageSettings, SelectedFormatter}, Buffer, LanguageRegistry, LocalFile, + language_settings::{Formatter, LanguageSettings, SelectedFormatter}, }; use lsp::{LanguageServer, LanguageServerId, LanguageServerName}; use node_runtime::NodeRuntime; @@ -25,8 +25,8 @@ use smol::stream::StreamExt; use util::{ResultExt, TryFutureExt}; use crate::{ - lsp_store::WorktreeId, worktree_store::WorktreeStore, File, PathChange, ProjectEntryId, - Worktree, + File, PathChange, ProjectEntryId, Worktree, lsp_store::WorktreeId, + worktree_store::WorktreeStore, }; pub struct PrettierStore { diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 44d8c01890..625108fc15 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -31,14 +31,14 @@ mod yarn; use crate::git_store::GitStore; pub use git_store::git_traversal::{ChildEntriesGitIter, GitEntry, GitEntryRef, GitTraversal}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use buffer_store::{BufferStore, BufferStoreEvent}; use client::{ - proto, Client, Collaborator, PendingEntitySubscription, ProjectId, TypedEnvelope, UserStore, + Client, Collaborator, PendingEntitySubscription, ProjectId, TypedEnvelope, UserStore, proto, }; use clock::ReplicaId; -use dap::{client::DebugAdapterClient, DapRegistry, DebugAdapterConfig}; +use dap::{DapRegistry, DebugAdapterConfig, client::DebugAdapterClient}; use collections::{BTreeSet, HashMap, HashSet}; use debounced_delay::DebouncedDelay; @@ -49,9 +49,9 @@ use debugger::{ }; pub use environment::ProjectEnvironment; use futures::{ + StreamExt, channel::mpsc::{self, UnboundedReceiver}, future::try_join_all, - StreamExt, }; pub use image_store::{ImageItem, ImageStore}; use image_store::{ImageItemEvent, ImageStoreEvent}; @@ -63,9 +63,9 @@ use gpui::{ }; use itertools::Itertools; use language::{ - language_settings::InlayHintKind, proto::split_operations, Buffer, BufferEvent, Capability, - CodeLabel, File as _, Language, LanguageName, LanguageRegistry, PointUtf16, ToOffset, - ToPointUtf16, Toolchain, ToolchainList, Transaction, Unclipped, + Buffer, BufferEvent, Capability, CodeLabel, File as _, Language, LanguageName, + LanguageRegistry, PointUtf16, ToOffset, ToPointUtf16, Toolchain, ToolchainList, Transaction, + Unclipped, language_settings::InlayHintKind, proto::split_operations, }; use lsp::{ CodeActionKind, CompletionContext, CompletionItemKind, DocumentHighlightKind, LanguageServerId, @@ -80,8 +80,8 @@ pub use prettier_store::PrettierStore; use project_settings::{ProjectSettings, SettingsObserver, SettingsObserverEvent}; use remote::{SshConnectionOptions, SshRemoteClient}; use rpc::{ - proto::{FromProto, LanguageServerPromptResponse, ToProto, SSH_PROJECT_ID}, AnyProtoClient, ErrorCode, + proto::{FromProto, LanguageServerPromptResponse, SSH_PROJECT_ID, ToProto}, }; use search::{SearchInputKind, SearchQuery, SearchResult}; use search_history::SearchHistory; @@ -104,14 +104,13 @@ use terminals::Terminals; use text::{Anchor, BufferId}; use toolchain_store::EmptyToolchainStore; use util::{ - maybe, - paths::{compare_paths, SanitizedPath}, - ResultExt as _, + ResultExt as _, maybe, + paths::{SanitizedPath, compare_paths}, }; use worktree::{CreatedEntry, Snapshot, Traversal}; pub use worktree::{ - Entry, EntryKind, File, LocalWorktree, PathChange, ProjectEntryId, UpdatedEntriesSet, - UpdatedGitRepositoriesSet, Worktree, WorktreeId, WorktreeSettings, FS_WATCH_LATENCY, + Entry, EntryKind, FS_WATCH_LATENCY, File, LocalWorktree, PathChange, ProjectEntryId, + UpdatedEntriesSet, UpdatedGitRepositoriesSet, Worktree, WorktreeId, WorktreeSettings, }; use worktree_store::{WorktreeStore, WorktreeStoreEvent}; @@ -2988,29 +2987,31 @@ impl Project { } fn recalculate_buffer_diffs(&mut self, cx: &mut Context) -> Task<()> { - cx.spawn(async move |this, cx| loop { - let task = this - .update(cx, |this, cx| { - let buffers = this - .buffers_needing_diff - .drain() - .filter_map(|buffer| buffer.upgrade()) - .collect::>(); - if buffers.is_empty() { - None - } else { - Some(this.git_store.update(cx, |git_store, cx| { - git_store.recalculate_buffer_diffs(buffers, cx) - })) - } - }) - .ok() - .flatten(); + cx.spawn(async move |this, cx| { + loop { + let task = this + .update(cx, |this, cx| { + let buffers = this + .buffers_needing_diff + .drain() + .filter_map(|buffer| buffer.upgrade()) + .collect::>(); + if buffers.is_empty() { + None + } else { + Some(this.git_store.update(cx, |git_store, cx| { + git_store.recalculate_buffer_diffs(buffers, cx) + })) + } + }) + .ok() + .flatten(); - if let Some(task) = task { - task.await; - } else { - break; + if let Some(task) = task { + task.await; + } else { + break; + } } }) } diff --git a/crates/project/src/project_settings.rs b/crates/project/src/project_settings.rs index 4800ce524c..f660d236a4 100644 --- a/crates/project/src/project_settings.rs +++ b/crates/project/src/project_settings.rs @@ -6,18 +6,18 @@ use futures::StreamExt as _; use gpui::{App, AsyncApp, BorrowAppContext, Context, Entity, EventEmitter, Task}; use lsp::LanguageServerName; use paths::{ - local_debug_file_relative_path, local_settings_file_relative_path, - local_tasks_file_relative_path, local_vscode_tasks_file_relative_path, EDITORCONFIG_NAME, + EDITORCONFIG_NAME, local_debug_file_relative_path, local_settings_file_relative_path, + local_tasks_file_relative_path, local_vscode_tasks_file_relative_path, }; use rpc::{ - proto::{self, FromProto, ToProto}, AnyProtoClient, TypedEnvelope, + proto::{self, FromProto, ToProto}, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use settings::{ - parse_json_with_comments, watch_config_file, InvalidSettingsError, LocalSettingsKind, Settings, - SettingsLocation, SettingsSources, SettingsStore, TaskKind, + InvalidSettingsError, LocalSettingsKind, Settings, SettingsLocation, SettingsSources, + SettingsStore, TaskKind, parse_json_with_comments, watch_config_file, }; use std::{ path::{Path, PathBuf}, diff --git a/crates/project/src/project_tests.rs b/crates/project/src/project_tests.rs index 71dee7bc9f..9aa3482833 100644 --- a/crates/project/src/project_tests.rs +++ b/crates/project/src/project_tests.rs @@ -1,23 +1,23 @@ #![allow(clippy::format_collect)] -use crate::{task_inventory::TaskContexts, task_store::TaskSettingsLocation, Event, *}; +use crate::{Event, task_inventory::TaskContexts, task_store::TaskSettingsLocation, *}; use buffer_diff::{ - assert_hunks, BufferDiffEvent, DiffHunkSecondaryStatus, DiffHunkStatus, DiffHunkStatusKind, + BufferDiffEvent, DiffHunkSecondaryStatus, DiffHunkStatus, DiffHunkStatusKind, assert_hunks, }; use fs::FakeFs; -use futures::{future, StreamExt}; +use futures::{StreamExt, future}; use git::repository::RepoPath; use gpui::{App, BackgroundExecutor, SemanticVersion, UpdateGlobal}; use http_client::Url; use language::{ - language_settings::{language_settings, AllLanguageSettings, LanguageSettingsContent}, - tree_sitter_rust, tree_sitter_typescript, Diagnostic, DiagnosticEntry, DiagnosticSet, - DiskState, FakeLspAdapter, LanguageConfig, LanguageMatcher, LanguageName, LineEnding, - OffsetRangeExt, Point, ToPoint, + Diagnostic, DiagnosticEntry, DiagnosticSet, DiskState, FakeLspAdapter, LanguageConfig, + LanguageMatcher, LanguageName, LineEnding, OffsetRangeExt, Point, ToPoint, + language_settings::{AllLanguageSettings, LanguageSettingsContent, language_settings}, + tree_sitter_rust, tree_sitter_typescript, }; use lsp::{ - notification::DidRenameFiles, DiagnosticSeverity, DocumentChanges, FileOperationFilter, - NumberOrString, TextDocumentEdit, WillRenameFiles, + DiagnosticSeverity, DocumentChanges, FileOperationFilter, NumberOrString, TextDocumentEdit, + WillRenameFiles, notification::DidRenameFiles, }; use parking_lot::Mutex; use paths::tasks_file; @@ -29,11 +29,11 @@ use std::{mem, num::NonZeroU32, ops::Range, str::FromStr, sync::OnceLock, task:: use task::{ResolvedTask, TaskContext}; use unindent::Unindent as _; use util::{ - assert_set_eq, path, + TryFutureExt as _, assert_set_eq, path, paths::PathMatcher, separator, - test::{marked_text_offsets, TempTree}, - uri, TryFutureExt as _, + test::{TempTree, marked_text_offsets}, + uri, }; use worktree::WorktreeModelHandle as _; diff --git a/crates/project/src/task_inventory.rs b/crates/project/src/task_inventory.rs index 3e68dac156..1a303a9943 100644 --- a/crates/project/src/task_inventory.rs +++ b/crates/project/src/task_inventory.rs @@ -13,13 +13,13 @@ use collections::{HashMap, HashSet, VecDeque}; use gpui::{App, AppContext as _, Entity, SharedString, Task}; use itertools::Itertools; use language::{ContextProvider, File, Language, LanguageToolchainStore, Location}; -use settings::{parse_json_with_comments, InvalidSettingsError, TaskKind}; +use settings::{InvalidSettingsError, TaskKind, parse_json_with_comments}; use task::{ DebugTaskDefinition, ResolvedTask, TaskContext, TaskId, TaskTemplate, TaskTemplates, TaskVariables, VariableName, }; use text::{Point, ToPoint}; -use util::{paths::PathExt as _, post_inc, NumericPrefixWithSuffix, ResultExt as _}; +use util::{NumericPrefixWithSuffix, ResultExt as _, paths::PathExt as _, post_inc}; use worktree::WorktreeId; use crate::{task_store::TaskSettingsLocation, worktree_store::WorktreeStore}; diff --git a/crates/project/src/task_store.rs b/crates/project/src/task_store.rs index e4fd9bd119..188534d75e 100644 --- a/crates/project/src/task_store.rs +++ b/crates/project/src/task_store.rs @@ -7,18 +7,18 @@ use anyhow::Context as _; use collections::HashMap; use gpui::{App, AsyncApp, Context, Entity, EventEmitter, Task, WeakEntity}; use language::{ - proto::{deserialize_anchor, serialize_anchor}, ContextProvider as _, LanguageToolchainStore, Location, + proto::{deserialize_anchor, serialize_anchor}, }; -use rpc::{proto, AnyProtoClient, TypedEnvelope}; +use rpc::{AnyProtoClient, TypedEnvelope, proto}; use settings::{InvalidSettingsError, SettingsLocation, TaskKind}; use task::{TaskContext, TaskVariables, VariableName}; use text::{BufferId, OffsetRangeExt}; use util::ResultExt; use crate::{ - buffer_store::BufferStore, worktree_store::WorktreeStore, BasicContextProvider, Inventory, - ProjectEnvironment, + BasicContextProvider, Inventory, ProjectEnvironment, buffer_store::BufferStore, + worktree_store::WorktreeStore, }; #[allow(clippy::large_enum_variant)] // platform-dependent warning diff --git a/crates/project/src/terminals.rs b/crates/project/src/terminals.rs index f26cae3da6..6e24259ebd 100644 --- a/crates/project/src/terminals.rs +++ b/crates/project/src/terminals.rs @@ -15,8 +15,8 @@ use std::{ }; use task::{Shell, ShellBuilder, SpawnInTerminal}; use terminal::{ - terminal_settings::{self, TerminalSettings, VenvSettings}, TaskState, TaskStatus, Terminal, TerminalBuilder, + terminal_settings::{self, TerminalSettings, VenvSettings}, }; use util::ResultExt; diff --git a/crates/project/src/toolchain_store.rs b/crates/project/src/toolchain_store.rs index df9842f783..054379231e 100644 --- a/crates/project/src/toolchain_store.rs +++ b/crates/project/src/toolchain_store.rs @@ -4,7 +4,7 @@ use std::{ sync::Arc, }; -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use async_trait::async_trait; use collections::BTreeMap; @@ -13,13 +13,13 @@ use gpui::{ }; use language::{LanguageName, LanguageRegistry, LanguageToolchainStore, Toolchain, ToolchainList}; use rpc::{ - proto::{self, FromProto, ToProto}, AnyProtoClient, TypedEnvelope, + proto::{self, FromProto, ToProto}, }; use settings::WorktreeId; use util::ResultExt as _; -use crate::{worktree_store::WorktreeStore, ProjectEnvironment, ProjectPath}; +use crate::{ProjectEnvironment, ProjectPath, worktree_store::WorktreeStore}; pub struct ToolchainStore(ToolchainStoreInner); enum ToolchainStoreInner { diff --git a/crates/project/src/worktree_store.rs b/crates/project/src/worktree_store.rs index 20ac7ae0fe..26974992b2 100644 --- a/crates/project/src/worktree_store.rs +++ b/crates/project/src/worktree_store.rs @@ -2,36 +2,36 @@ use std::{ io::{BufRead, BufReader}, path::{Path, PathBuf}, pin::pin, - sync::{atomic::AtomicUsize, Arc}, + sync::{Arc, atomic::AtomicUsize}, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::{HashMap, HashSet}; use fs::Fs; use futures::{ - future::{BoxFuture, Shared}, FutureExt, SinkExt, + future::{BoxFuture, Shared}, }; use gpui::{ App, AppContext as _, AsyncApp, Context, Entity, EntityId, EventEmitter, Task, WeakEntity, }; use postage::oneshot; use rpc::{ - proto::{self, FromProto, ToProto, SSH_PROJECT_ID}, AnyProtoClient, ErrorExt, TypedEnvelope, + proto::{self, FromProto, SSH_PROJECT_ID, ToProto}, }; use smol::{ channel::{Receiver, Sender}, stream::StreamExt, }; use text::ReplicaId; -use util::{paths::SanitizedPath, ResultExt}; +use util::{ResultExt, paths::SanitizedPath}; use worktree::{ Entry, ProjectEntryId, UpdatedEntriesSet, UpdatedGitRepositoriesSet, Worktree, WorktreeId, WorktreeSettings, }; -use crate::{search::SearchQuery, ProjectPath}; +use crate::{ProjectPath, search::SearchQuery}; struct MatchingEntry { worktree_path: Arc, diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 7b9238bb0c..35f84c0ce4 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -1,42 +1,43 @@ mod project_panel_settings; mod utils; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use client::{ErrorCode, ErrorExt}; -use collections::{hash_map, BTreeSet, HashMap}; +use collections::{BTreeSet, HashMap, hash_map}; use command_palette_hooks::CommandPaletteFilter; use db::kvp::KEY_VALUE_STORE; use editor::{ + Editor, EditorEvent, EditorSettings, ShowScrollbar, items::{ entry_diagnostic_aware_icon_decoration_and_color, entry_diagnostic_aware_icon_name_and_color, entry_git_aware_label_color, }, scroll::{Autoscroll, ScrollbarAutoHide}, - Editor, EditorEvent, EditorSettings, ShowScrollbar, }; use file_icons::FileIcons; use git::status::GitSummary; use gpui::{ - actions, anchored, deferred, div, impl_actions, point, px, size, uniform_list, Action, - AnyElement, App, ArcCow, AsyncWindowContext, Bounds, ClipboardItem, Context, DismissEvent, Div, - DragMoveEvent, Entity, EventEmitter, ExternalPaths, FocusHandle, Focusable, Hsla, - InteractiveElement, KeyContext, ListHorizontalSizingBehavior, ListSizingBehavior, MouseButton, - MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Render, ScrollStrategy, Stateful, - Styled, Subscription, Task, UniformListScrollHandle, WeakEntity, Window, + Action, AnyElement, App, ArcCow, AsyncWindowContext, Bounds, ClipboardItem, Context, + DismissEvent, Div, DragMoveEvent, Entity, EventEmitter, ExternalPaths, FocusHandle, Focusable, + Hsla, InteractiveElement, KeyContext, ListHorizontalSizingBehavior, ListSizingBehavior, + MouseButton, MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Render, ScrollStrategy, + Stateful, Styled, Subscription, Task, UniformListScrollHandle, WeakEntity, Window, actions, + anchored, deferred, div, impl_actions, point, px, size, uniform_list, }; use indexmap::IndexMap; use language::DiagnosticSeverity; use menu::{Confirm, SelectFirst, SelectLast, SelectNext, SelectPrevious}; use project::{ - git_store::git_traversal::ChildEntriesGitIter, relativize_path, Entry, EntryKind, Fs, GitEntry, - GitEntryRef, GitTraversal, Project, ProjectEntryId, ProjectPath, Worktree, WorktreeId, + Entry, EntryKind, Fs, GitEntry, GitEntryRef, GitTraversal, Project, ProjectEntryId, + ProjectPath, Worktree, WorktreeId, git_store::git_traversal::ChildEntriesGitIter, + relativize_path, }; use project_panel_settings::{ ProjectPanelDockPosition, ProjectPanelSettings, ShowDiagnostics, ShowIndentGuides, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use settings::{update_settings_file, Settings, SettingsStore}; +use settings::{Settings, SettingsStore, update_settings_file}; use smallvec::SmallVec; use std::any::TypeId; use std::{ @@ -51,16 +52,16 @@ use std::{ }; use theme::ThemeSettings; use ui::{ - prelude::*, v_flex, ContextMenu, DecoratedIcon, Icon, IconDecoration, IconDecorationKind, - IndentGuideColors, IndentGuideLayout, KeyBinding, Label, ListItem, ListItemSpacing, Scrollbar, - ScrollbarState, Tooltip, + ContextMenu, DecoratedIcon, Icon, IconDecoration, IconDecorationKind, IndentGuideColors, + IndentGuideLayout, KeyBinding, Label, ListItem, ListItemSpacing, Scrollbar, ScrollbarState, + Tooltip, prelude::*, v_flex, }; -use util::{maybe, paths::compare_paths, ResultExt, TakeUntilExt, TryFutureExt}; +use util::{ResultExt, TakeUntilExt, TryFutureExt, maybe, paths::compare_paths}; use workspace::{ - dock::{DockPosition, Panel, PanelEvent}, - notifications::{DetachAndPromptErr, NotifyTaskExt}, DraggedSelection, OpenInTerminal, OpenOptions, OpenVisible, PreviewTabsSettings, SelectedEntry, Workspace, + dock::{DockPosition, Panel, PanelEvent}, + notifications::{DetachAndPromptErr, NotifyTaskExt}, }; use worktree::CreatedEntry; @@ -4424,26 +4425,28 @@ impl Render for ProjectPanel { return; }; let adjustment = point(px(0.), px(vertical_scroll_offset)); - this.hover_scroll_task = Some(cx.spawn_in(window, async move |this, cx| loop { - let should_stop_scrolling = this - .update(cx, |this, cx| { - this.hover_scroll_task.as_ref()?; - let handle = this.scroll_handle.0.borrow_mut(); - let offset = handle.base_handle.offset(); + this.hover_scroll_task = Some(cx.spawn_in(window, async move |this, cx| { + loop { + let should_stop_scrolling = this + .update(cx, |this, cx| { + this.hover_scroll_task.as_ref()?; + let handle = this.scroll_handle.0.borrow_mut(); + let offset = handle.base_handle.offset(); - handle.base_handle.set_offset(offset + adjustment); - cx.notify(); - Some(()) - }) - .ok() - .flatten() - .is_some(); - if should_stop_scrolling { - return; + handle.base_handle.set_offset(offset + adjustment); + cx.notify(); + Some(()) + }) + .ok() + .flatten() + .is_some(); + if should_stop_scrolling { + return; + } + cx.background_executor() + .timer(Duration::from_millis(16)) + .await; } - cx.background_executor() - .timer(Duration::from_millis(16)) - .await; })); } h_flex() diff --git a/crates/project_panel/src/project_panel_tests.rs b/crates/project_panel/src/project_panel_tests.rs index dc73ca5f20..851a385e0d 100644 --- a/crates/project_panel/src/project_panel_tests.rs +++ b/crates/project_panel/src/project_panel_tests.rs @@ -8,8 +8,9 @@ use settings::SettingsStore; use std::path::{Path, PathBuf}; use util::{path, separator}; use workspace::{ + AppState, Pane, item::{Item, ProjectItem}, - register_project_item, AppState, Pane, + register_project_item, }; #[gpui::test] @@ -4950,11 +4951,7 @@ fn visible_entries_as_strings( let indent = " ".repeat(details.depth); let icon = if details.kind.is_dir() { - if details.is_expanded { - "v " - } else { - "> " - } + if details.is_expanded { "v " } else { "> " } } else { " " }; diff --git a/crates/project_symbols/src/project_symbols.rs b/crates/project_symbols/src/project_symbols.rs index 0f7ebf3a2a..cb8b05f2bc 100644 --- a/crates/project_symbols/src/project_symbols.rs +++ b/crates/project_symbols/src/project_symbols.rs @@ -1,8 +1,8 @@ -use editor::{scroll::Autoscroll, styled_runs_for_code_label, Bias, Editor}; +use editor::{Bias, Editor, scroll::Autoscroll, styled_runs_for_code_label}; use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - rems, App, Context, DismissEvent, Entity, FontWeight, ParentElement, StyledText, Task, - WeakEntity, Window, + App, Context, DismissEvent, Entity, FontWeight, ParentElement, StyledText, Task, WeakEntity, + Window, rems, }; use ordered_float::OrderedFloat; use picker::{Picker, PickerDelegate}; @@ -11,8 +11,8 @@ use std::{borrow::Cow, cmp::Reverse, sync::Arc}; use theme::ActiveTheme; use util::ResultExt; use workspace::{ - ui::{v_flex, Color, Label, LabelCommon, LabelLike, ListItem, ListItemSpacing, Toggleable}, Workspace, + ui::{Color, Label, LabelCommon, LabelLike, ListItem, ListItemSpacing, Toggleable, v_flex}, }; pub fn init(cx: &mut App) { diff --git a/crates/prompt_library/src/prompt_library.rs b/crates/prompt_library/src/prompt_library.rs index f68d4a4b85..48d6c5e8f8 100644 --- a/crates/prompt_library/src/prompt_library.rs +++ b/crates/prompt_library/src/prompt_library.rs @@ -1,13 +1,13 @@ use anyhow::Result; use collections::{HashMap, HashSet}; use editor::CompletionProvider; -use editor::{actions::Tab, CurrentLineHighlight, Editor, EditorElement, EditorEvent, EditorStyle}; +use editor::{CurrentLineHighlight, Editor, EditorElement, EditorEvent, EditorStyle, actions::Tab}; use gpui::{ - actions, point, size, transparent_black, Action, App, Bounds, Entity, EventEmitter, Focusable, - PromptLevel, Subscription, Task, TextStyle, TitlebarOptions, WindowBounds, WindowHandle, - WindowOptions, + Action, App, Bounds, Entity, EventEmitter, Focusable, PromptLevel, Subscription, Task, + TextStyle, TitlebarOptions, WindowBounds, WindowHandle, WindowOptions, actions, point, size, + transparent_black, }; -use language::{language_settings::SoftWrap, Buffer, LanguageRegistry}; +use language::{Buffer, LanguageRegistry, language_settings::SoftWrap}; use language_model::{ LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, Role, }; @@ -19,8 +19,8 @@ use std::sync::Arc; use std::time::Duration; use theme::ThemeSettings; use ui::{ - div, prelude::*, Context, IconButtonShape, KeyBinding, ListItem, ListItemSpacing, - ParentElement, Render, SharedString, Styled, Tooltip, Window, + Context, IconButtonShape, KeyBinding, ListItem, ListItemSpacing, ParentElement, Render, + SharedString, Styled, Tooltip, Window, div, prelude::*, }; use util::{ResultExt, TryFutureExt}; use workspace::Workspace; diff --git a/crates/prompt_store/src/prompt_store.rs b/crates/prompt_store/src/prompt_store.rs index 0993d55b38..57e3e04e79 100644 --- a/crates/prompt_store/src/prompt_store.rs +++ b/crates/prompt_store/src/prompt_store.rs @@ -1,15 +1,15 @@ mod prompts; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use chrono::{DateTime, Utc}; use collections::HashMap; -use futures::future::{self, BoxFuture, Shared}; use futures::FutureExt as _; +use futures::future::{self, BoxFuture, Shared}; use fuzzy::StringMatchCandidate; use gpui::{App, BackgroundExecutor, Global, ReadGlobal, SharedString, Task}; use heed::{ - types::{SerdeBincode, SerdeJson, Str}, Database, RoTxn, + types::{SerdeBincode, SerdeJson, Str}, }; use parking_lot::RwLock; pub use prompts::*; @@ -19,7 +19,7 @@ use std::{ cmp::Reverse, future::Future, path::PathBuf, - sync::{atomic::AtomicBool, Arc}, + sync::{Arc, atomic::AtomicBool}, }; use text::LineEnding; use util::ResultExt; diff --git a/crates/proto/src/typed_envelope.rs b/crates/proto/src/typed_envelope.rs index e45f17f548..6f63c0b94a 100644 --- a/crates/proto/src/typed_envelope.rs +++ b/crates/proto/src/typed_envelope.rs @@ -1,5 +1,5 @@ use crate::{PeerId, RequestMessage}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use std::{marker::PhantomData, time::Instant}; pub struct Receipt { diff --git a/crates/recent_projects/src/disconnected_overlay.rs b/crates/recent_projects/src/disconnected_overlay.rs index ff5883a0d2..a6cd26355c 100644 --- a/crates/recent_projects/src/disconnected_overlay.rs +++ b/crates/recent_projects/src/disconnected_overlay.rs @@ -5,11 +5,11 @@ use project::project_settings::ProjectSettings; use remote::SshConnectionOptions; use settings::Settings; use ui::{ - div, h_flex, rems, Button, ButtonCommon, ButtonStyle, Clickable, Context, ElevationIndex, - FluentBuilder, Headline, HeadlineSize, IconName, IconPosition, InteractiveElement, IntoElement, - Label, Modal, ModalFooter, ModalHeader, ParentElement, Section, Styled, StyledExt, Window, + Button, ButtonCommon, ButtonStyle, Clickable, Context, ElevationIndex, FluentBuilder, Headline, + HeadlineSize, IconName, IconPosition, InteractiveElement, IntoElement, Label, Modal, + ModalFooter, ModalHeader, ParentElement, Section, Styled, StyledExt, Window, div, h_flex, rems, }; -use workspace::{notifications::DetachAndPromptErr, ModalView, OpenOptions, Workspace}; +use workspace::{ModalView, OpenOptions, Workspace, notifications::DetachAndPromptErr}; use crate::open_ssh_project; diff --git a/crates/recent_projects/src/recent_projects.rs b/crates/recent_projects/src/recent_projects.rs index 45fa03dbf1..77feba9f2c 100644 --- a/crates/recent_projects/src/recent_projects.rs +++ b/crates/recent_projects/src/recent_projects.rs @@ -11,8 +11,8 @@ use gpui::{ }; use ordered_float::OrderedFloat; use picker::{ - highlighted_match_with_paths::{HighlightedMatch, HighlightedMatchWithPaths}, Picker, PickerDelegate, + highlighted_match_with_paths::{HighlightedMatch, HighlightedMatchWithPaths}, }; pub use remote_servers::RemoteServerProjects; use settings::Settings; @@ -21,11 +21,11 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use ui::{prelude::*, tooltip_container, KeyBinding, ListItem, ListItemSpacing, Tooltip}; -use util::{paths::PathExt, ResultExt}; +use ui::{KeyBinding, ListItem, ListItemSpacing, Tooltip, prelude::*, tooltip_container}; +use util::{ResultExt, paths::PathExt}; use workspace::{ - CloseIntent, ModalView, OpenOptions, SerializedWorkspaceLocation, Workspace, WorkspaceId, - WORKSPACE_DB, + CloseIntent, ModalView, OpenOptions, SerializedWorkspaceLocation, WORKSPACE_DB, Workspace, + WorkspaceId, }; use zed_actions::{OpenRecent, OpenRemote}; @@ -594,11 +594,11 @@ mod tests { use dap::debugger_settings::DebuggerSettings; use editor::Editor; use gpui::{TestAppContext, UpdateGlobal, WindowHandle}; - use project::{project_settings::ProjectSettings, Project}; + use project::{Project, project_settings::ProjectSettings}; use serde_json::json; use settings::SettingsStore; use util::path; - use workspace::{open_paths, AppState}; + use workspace::{AppState, open_paths}; use super::*; diff --git a/crates/recent_projects/src/remote_servers.rs b/crates/recent_projects/src/remote_servers.rs index 6308b6843c..392ee3048c 100644 --- a/crates/recent_projects/src/remote_servers.rs +++ b/crates/recent_projects/src/remote_servers.rs @@ -4,38 +4,37 @@ use std::sync::Arc; use editor::Editor; use file_finder::OpenPathDelegate; +use futures::FutureExt; use futures::channel::oneshot; use futures::future::Shared; -use futures::FutureExt; -use gpui::canvas; use gpui::ClipboardItem; use gpui::Task; use gpui::WeakEntity; +use gpui::canvas; use gpui::{ AnyElement, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, PromptLevel, ScrollHandle, Window, }; use picker::Picker; use project::Project; -use remote::ssh_session::ConnectionIdentifier; use remote::SshConnectionOptions; use remote::SshRemoteClient; -use settings::update_settings_file; +use remote::ssh_session::ConnectionIdentifier; use settings::Settings; +use settings::update_settings_file; use ui::Navigable; use ui::NavigableEntry; use ui::{ - prelude::*, IconButtonShape, List, ListItem, ListSeparator, Modal, ModalHeader, Scrollbar, - ScrollbarState, Section, Tooltip, + IconButtonShape, List, ListItem, ListSeparator, Modal, ModalHeader, Scrollbar, ScrollbarState, + Section, Tooltip, prelude::*, }; use util::ResultExt; -use workspace::notifications::NotificationId; use workspace::OpenOptions; use workspace::Toast; -use workspace::{notifications::DetachAndPromptErr, ModalView, Workspace}; +use workspace::notifications::NotificationId; +use workspace::{ModalView, Workspace, notifications::DetachAndPromptErr}; -use crate::ssh_connections::connect_over_ssh; -use crate::ssh_connections::open_ssh_project; +use crate::OpenRemote; use crate::ssh_connections::RemoteSettingsContent; use crate::ssh_connections::SshConnection; use crate::ssh_connections::SshConnectionHeader; @@ -43,7 +42,8 @@ use crate::ssh_connections::SshConnectionModal; use crate::ssh_connections::SshProject; use crate::ssh_connections::SshPrompt; use crate::ssh_connections::SshSettings; -use crate::OpenRemote; +use crate::ssh_connections::connect_over_ssh; +use crate::ssh_connections::open_ssh_project; mod navigation_base {} pub struct RemoteServerProjects { diff --git a/crates/recent_projects/src/ssh_connections.rs b/crates/recent_projects/src/ssh_connections.rs index a5fc7d7433..988f5880e0 100644 --- a/crates/recent_projects/src/ssh_connections.rs +++ b/crates/recent_projects/src/ssh_connections.rs @@ -1,15 +1,15 @@ use std::collections::BTreeSet; use std::{path::PathBuf, sync::Arc, time::Duration}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use auto_update::AutoUpdater; use editor::Editor; use extension_host::ExtensionStore; use futures::channel::oneshot; use gpui::{ - percentage, Animation, AnimationExt, AnyWindowHandle, App, AsyncApp, DismissEvent, Entity, - EventEmitter, Focusable, FontFeatures, ParentElement as _, PromptLevel, Render, - SemanticVersion, SharedString, Task, TextStyleRefinement, Transformation, WeakEntity, + Animation, AnimationExt, AnyWindowHandle, App, AsyncApp, DismissEvent, Entity, EventEmitter, + Focusable, FontFeatures, ParentElement as _, PromptLevel, Render, SemanticVersion, + SharedString, Task, TextStyleRefinement, Transformation, WeakEntity, percentage, }; use language::CursorShape; @@ -22,8 +22,8 @@ use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsSources}; use theme::ThemeSettings; use ui::{ - prelude::*, ActiveTheme, Color, Context, Icon, IconName, IconSize, InteractiveElement, - IntoElement, Label, LabelCommon, Styled, Window, + ActiveTheme, Color, Context, Icon, IconName, IconSize, InteractiveElement, IntoElement, Label, + LabelCommon, Styled, Window, prelude::*, }; use workspace::{AppState, ModalView, Workspace}; diff --git a/crates/refineable/derive_refineable/src/derive_refineable.rs b/crates/refineable/derive_refineable/src/derive_refineable.rs index 7df59faeaa..aa297a8c0d 100644 --- a/crates/refineable/derive_refineable/src/derive_refineable.rs +++ b/crates/refineable/derive_refineable/src/derive_refineable.rs @@ -2,8 +2,8 @@ use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; use quote::{format_ident, quote}; use syn::{ - parse_macro_input, parse_quote, DeriveInput, Field, FieldsNamed, PredicateType, TraitBound, - Type, TypeParamBound, WhereClause, WherePredicate, + DeriveInput, Field, FieldsNamed, PredicateType, TraitBound, Type, TypeParamBound, WhereClause, + WherePredicate, parse_macro_input, parse_quote, }; #[proc_macro_derive(Refineable, attributes(refineable))] diff --git a/crates/remote/src/ssh_session.rs b/crates/remote/src/ssh_session.rs index 7f430f05be..8dad4780fb 100644 --- a/crates/remote/src/ssh_session.rs +++ b/crates/remote/src/ssh_session.rs @@ -1,20 +1,21 @@ use crate::{ json_log::LogRecord, protocol::{ - message_len_from_buffer, read_message_with_len, write_message, MessageId, MESSAGE_LEN_SIZE, + MESSAGE_LEN_SIZE, MessageId, message_len_from_buffer, read_message_with_len, write_message, }, proxy::ProxyLaunchError, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_trait::async_trait; use collections::HashMap; use futures::{ + AsyncReadExt as _, Future, FutureExt as _, StreamExt as _, channel::{ mpsc::{self, Sender, UnboundedReceiver, UnboundedSender}, oneshot, }, future::{BoxFuture, Shared}, - select, select_biased, AsyncReadExt as _, Future, FutureExt as _, StreamExt as _, + select, select_biased, }; use gpui::{ App, AppContext as _, AsyncApp, BorrowAppContext, Context, Entity, EventEmitter, Global, @@ -25,9 +26,9 @@ use parking_lot::Mutex; use paths; use release_channel::{AppCommitSha, AppVersion, ReleaseChannel}; use rpc::{ - proto::{self, build_typed_envelope, Envelope, EnvelopedMessage, PeerId, RequestMessage}, AnyProtoClient, EntityMessageSubscriber, ErrorExt, ProtoClient, ProtoMessageHandlerSet, RpcError, + proto::{self, Envelope, EnvelopedMessage, PeerId, RequestMessage, build_typed_envelope}, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -42,8 +43,8 @@ use std::{ ops::ControlFlow, path::{Path, PathBuf}, sync::{ - atomic::{AtomicU32, AtomicU64, Ordering::SeqCst}, Arc, Weak, + atomic::{AtomicU32, AtomicU64, Ordering::SeqCst}, }, time::{Duration, Instant}, }; @@ -1291,7 +1292,7 @@ trait RemoteConnection: Send + Sync { cx: &mut AsyncApp, ) -> Task>; fn upload_directory(&self, src_path: PathBuf, dest_path: PathBuf, cx: &App) - -> Task>; + -> Task>; async fn kill(&self) -> Result<()>; fn has_been_killed(&self) -> bool; fn ssh_args(&self) -> Vec; @@ -2371,11 +2372,12 @@ mod fake { use anyhow::Result; use async_trait::async_trait; use futures::{ + FutureExt, SinkExt, StreamExt, channel::{ mpsc::{self, Sender}, oneshot, }, - select_biased, FutureExt, SinkExt, StreamExt, + select_biased, }; use gpui::{App, AppContext as _, AsyncApp, SemanticVersion, Task, TestAppContext}; use release_channel::ReleaseChannel; diff --git a/crates/remote_server/src/headless_project.rs b/crates/remote_server/src/headless_project.rs index b1c2a7ec12..4855c16b31 100644 --- a/crates/remote_server/src/headless_project.rs +++ b/crates/remote_server/src/headless_project.rs @@ -1,14 +1,15 @@ use ::proto::{FromProto, ToProto}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use dap::DapRegistry; use extension::ExtensionHostProxy; use extension_host::headless_host::HeadlessExtensionStore; use fs::Fs; use gpui::{App, AppContext as _, AsyncApp, Context, Entity, PromptLevel}; use http_client::HttpClient; -use language::{proto::serialize_operation, Buffer, BufferEvent, LanguageRegistry}; +use language::{Buffer, BufferEvent, LanguageRegistry, proto::serialize_operation}; use node_runtime::NodeRuntime; use project::{ + LspStore, LspStoreEvent, PrettierStore, ProjectPath, ToolchainStore, WorktreeId, buffer_store::{BufferStore, BufferStoreEvent}, debugger::{breakpoint_store::BreakpointStore, dap_store::DapStore}, git_store::GitStore, @@ -16,19 +17,18 @@ use project::{ search::SearchQuery, task_store::TaskStore, worktree_store::WorktreeStore, - LspStore, LspStoreEvent, PrettierStore, ProjectPath, ToolchainStore, WorktreeId, }; use remote::ssh_session::ChannelClient; use rpc::{ - proto::{self, SSH_PEER_ID, SSH_PROJECT_ID}, AnyProtoClient, TypedEnvelope, + proto::{self, SSH_PEER_ID, SSH_PROJECT_ID}, }; use settings::initial_server_settings_content; use smol::stream::StreamExt; use std::{ path::{Path, PathBuf}, - sync::{atomic::AtomicUsize, Arc}, + sync::{Arc, atomic::AtomicUsize}, }; use util::ResultExt; use worktree::Worktree; @@ -371,8 +371,10 @@ impl HeadlessProject { parent = util::paths::home_dir(); } let parent = fs.canonicalize(parent).await.map_err(|_| { - anyhow!(proto::ErrorCode::DevServerProjectPathDoesNotExist - .with_tag("path", &path.to_string_lossy().as_ref())) + anyhow!( + proto::ErrorCode::DevServerProjectPathDoesNotExist + .with_tag("path", &path.to_string_lossy().as_ref()) + ) })?; parent.join(path.file_name().unwrap()) } diff --git a/crates/remote_server/src/main.rs b/crates/remote_server/src/main.rs index 715380dbf9..c43db645f8 100644 --- a/crates/remote_server/src/main.rs +++ b/crates/remote_server/src/main.rs @@ -40,7 +40,7 @@ fn main() { #[cfg(not(windows))] fn main() { - use release_channel::{ReleaseChannel, RELEASE_CHANNEL}; + use release_channel::{RELEASE_CHANNEL, ReleaseChannel}; use remote::proxy::ProxyLaunchError; use remote_server::unix::{execute_proxy, execute_run}; diff --git a/crates/remote_server/src/remote_editing_tests.rs b/crates/remote_server/src/remote_editing_tests.rs index 438ac5c07c..30fd2d8940 100644 --- a/crates/remote_server/src/remote_editing_tests.rs +++ b/crates/remote_server/src/remote_editing_tests.rs @@ -10,18 +10,18 @@ use fs::{FakeFs, Fs}; use gpui::{AppContext as _, Entity, SemanticVersion, TestAppContext}; use http_client::{BlockedHttpClient, FakeHttpClient}; use language::{ - language_settings::{language_settings, AllLanguageSettings}, Buffer, FakeLspAdapter, LanguageConfig, LanguageMatcher, LanguageRegistry, LineEnding, + language_settings::{AllLanguageSettings, language_settings}, }; use lsp::{CompletionContext, CompletionResponse, CompletionTriggerKind, LanguageServerName}; use node_runtime::NodeRuntime; use project::{ - search::{SearchQuery, SearchResult}, Project, ProjectPath, + search::{SearchQuery, SearchResult}, }; use remote::SshRemoteClient; use serde_json::json; -use settings::{initial_server_settings_content, Settings, SettingsLocation, SettingsStore}; +use settings::{Settings, SettingsLocation, SettingsStore, initial_server_settings_content}; use smol::stream::StreamExt; use std::{ collections::HashSet, diff --git a/crates/remote_server/src/unix.rs b/crates/remote_server/src/unix.rs index b1bff8c1a0..0218835f5d 100644 --- a/crates/remote_server/src/unix.rs +++ b/crates/remote_server/src/unix.rs @@ -1,23 +1,23 @@ -use crate::headless_project::HeadlessAppState; use crate::HeadlessProject; -use anyhow::{anyhow, Context as _, Result}; +use crate::headless_project::HeadlessAppState; +use anyhow::{Context as _, Result, anyhow}; use chrono::Utc; -use client::{telemetry, ProxySettings}; +use client::{ProxySettings, telemetry}; use dap::DapRegistry; use extension::ExtensionHostProxy; use fs::{Fs, RealFs}; use futures::channel::mpsc; -use futures::{select, select_biased, AsyncRead, AsyncWrite, AsyncWriteExt, FutureExt, SinkExt}; +use futures::{AsyncRead, AsyncWrite, AsyncWriteExt, FutureExt, SinkExt, select, select_biased}; use git::GitHostingProviderRegistry; use gpui::{App, AppContext as _, Context, Entity, SemanticVersion, UpdateGlobal as _}; use gpui_tokio::Tokio; -use http_client::{read_proxy_from_env, Uri}; +use http_client::{Uri, read_proxy_from_env}; use language::LanguageRegistry; use node_runtime::{NodeBinaryOptions, NodeRuntime}; use paths::logs_dir; use project::project_settings::ProjectSettings; -use release_channel::{AppVersion, ReleaseChannel, RELEASE_CHANNEL}; +use release_channel::{AppVersion, RELEASE_CHANNEL, ReleaseChannel}; use remote::proxy::ProxyLaunchError; use remote::ssh_session::ChannelClient; use remote::{ @@ -27,7 +27,7 @@ use remote::{ use reqwest_client::ReqwestClient; use rpc::proto::{self, Envelope, SSH_PROJECT_ID}; use rpc::{AnyProtoClient, TypedEnvelope}; -use settings::{watch_config_file, Settings, SettingsStore}; +use settings::{Settings, SettingsStore, watch_config_file}; use smol::channel::{Receiver, Sender}; use smol::io::AsyncReadExt; diff --git a/crates/repl/src/components/kernel_list_item.rs b/crates/repl/src/components/kernel_list_item.rs index 7412960535..467407fbd2 100644 --- a/crates/repl/src/components/kernel_list_item.rs +++ b/crates/repl/src/components/kernel_list_item.rs @@ -1,5 +1,5 @@ use gpui::AnyElement; -use ui::{prelude::*, Indicator, ListItem}; +use ui::{Indicator, ListItem, prelude::*}; use crate::KernelSpecification; diff --git a/crates/repl/src/components/kernel_options.rs b/crates/repl/src/components/kernel_options.rs index 57ee4cdcef..0623fd7ea5 100644 --- a/crates/repl/src/components/kernel_options.rs +++ b/crates/repl/src/components/kernel_options.rs @@ -1,6 +1,6 @@ +use crate::KERNEL_DOCS_URL; use crate::kernels::KernelSpecification; use crate::repl_store::ReplStore; -use crate::KERNEL_DOCS_URL; use gpui::AnyView; use gpui::DismissEvent; @@ -15,7 +15,7 @@ use ui::ListItemSpacing; use gpui::SharedString; use gpui::Task; -use ui::{prelude::*, ListItem, PopoverMenu, PopoverMenuHandle, PopoverTrigger}; +use ui::{ListItem, PopoverMenu, PopoverMenuHandle, PopoverTrigger, prelude::*}; type OnSelect = Box; diff --git a/crates/repl/src/kernels/native_kernel.rs b/crates/repl/src/kernels/native_kernel.rs index 0ed933c626..a79f14f6e8 100644 --- a/crates/repl/src/kernels/native_kernel.rs +++ b/crates/repl/src/kernels/native_kernel.rs @@ -1,14 +1,14 @@ use anyhow::{Context as _, Result}; use futures::{ + AsyncBufReadExt as _, SinkExt as _, channel::mpsc::{self}, io::BufReader, stream::{SelectAll, StreamExt}, - AsyncBufReadExt as _, SinkExt as _, }; use gpui::{App, AppContext as _, Entity, EntityId, Task, Window}; use jupyter_protocol::{ - connection_info::{ConnectionInfo, Transport}, ExecutionState, JupyterKernelspec, JupyterMessage, JupyterMessageContent, KernelInfoReply, + connection_info::{ConnectionInfo, Transport}, }; use project::Fs; use runtimelib::dirs; diff --git a/crates/repl/src/kernels/remote_kernels.rs b/crates/repl/src/kernels/remote_kernels.rs index fd487e56ca..e895608270 100644 --- a/crates/repl/src/kernels/remote_kernels.rs +++ b/crates/repl/src/kernels/remote_kernels.rs @@ -1,4 +1,4 @@ -use futures::{channel::mpsc, SinkExt as _}; +use futures::{SinkExt as _, channel::mpsc}; use gpui::{App, AppContext as _, Entity, Task, Window}; use http_client::{AsyncBody, HttpClient, Request}; use jupyter_protocol::{ExecutionState, JupyterKernelspec, JupyterMessage, KernelInfoReply}; diff --git a/crates/repl/src/notebook/cell.rs b/crates/repl/src/notebook/cell.rs index 7d0a35ccdc..75fe44a191 100644 --- a/crates/repl/src/notebook/cell.rs +++ b/crates/repl/src/notebook/cell.rs @@ -3,18 +3,18 @@ use std::sync::Arc; use editor::{Editor, EditorMode, MultiBuffer}; use futures::future::Shared; -use gpui::{prelude::*, App, Entity, Hsla, Task, TextStyleRefinement}; +use gpui::{App, Entity, Hsla, Task, TextStyleRefinement, prelude::*}; use language::{Buffer, Language, LanguageRegistry}; use markdown_preview::{markdown_parser::parse_markdown, markdown_renderer::render_markdown_block}; use nbformat::v4::{CellId, CellMetadata, CellType}; use settings::Settings as _; use theme::ThemeSettings; -use ui::{prelude::*, IconButtonShape}; +use ui::{IconButtonShape, prelude::*}; use util::ResultExt; use crate::{ notebook::{CODE_BLOCK_INSET, GUTTER_WIDTH}, - outputs::{plain::TerminalOutput, user_error::ErrorView, Output}, + outputs::{Output, plain::TerminalOutput, user_error::ErrorView}, }; #[derive(Copy, Clone, PartialEq, PartialOrd)] diff --git a/crates/repl/src/notebook/notebook_ui.rs b/crates/repl/src/notebook/notebook_ui.rs index 15bae33ba5..4a539a64a7 100644 --- a/crates/repl/src/notebook/notebook_ui.rs +++ b/crates/repl/src/notebook/notebook_ui.rs @@ -6,15 +6,15 @@ use anyhow::{Context as _, Result}; use client::proto::ViewId; use collections::HashMap; use feature_flags::{FeatureFlagAppExt as _, NotebookFeatureFlag}; -use futures::future::Shared; use futures::FutureExt; +use futures::future::Shared; use gpui::{ - actions, list, prelude::*, AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, - ListScrollEvent, ListState, Point, Task, + AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, ListScrollEvent, ListState, + Point, Task, actions, list, prelude::*, }; use language::{Language, LanguageRegistry}; use project::{Project, ProjectEntryId, ProjectPath}; -use ui::{prelude::*, Tooltip}; +use ui::{Tooltip, prelude::*}; use workspace::item::{ItemEvent, TabContentParams}; use workspace::searchable::SearchableItemHandle; use workspace::{Item, ItemHandle, Pane, ProjectItem, ToolbarItemLocation}; diff --git a/crates/repl/src/outputs.rs b/crates/repl/src/outputs.rs index 226dcab85a..15062dec3b 100644 --- a/crates/repl/src/outputs.rs +++ b/crates/repl/src/outputs.rs @@ -37,12 +37,12 @@ use std::time::Duration; use editor::{Editor, MultiBuffer}; use gpui::{ - percentage, Animation, AnimationExt, AnyElement, ClipboardItem, Entity, Render, Transformation, - WeakEntity, + Animation, AnimationExt, AnyElement, ClipboardItem, Entity, Render, Transformation, WeakEntity, + percentage, }; use language::Buffer; use runtimelib::{ExecutionState, JupyterMessageContent, MimeBundle, MimeType}; -use ui::{div, prelude::*, v_flex, Context, IntoElement, Styled, Tooltip, Window}; +use ui::{Context, IntoElement, Styled, Tooltip, Window, div, prelude::*, v_flex}; mod image; use image::ImageView; diff --git a/crates/repl/src/outputs/image.rs b/crates/repl/src/outputs/image.rs index 6e574c565e..c5b54df77a 100644 --- a/crates/repl/src/outputs/image.rs +++ b/crates/repl/src/outputs/image.rs @@ -1,12 +1,11 @@ use anyhow::Result; use base64::{ - alphabet, + Engine as _, alphabet, engine::{DecodePaddingMode, GeneralPurpose, GeneralPurposeConfig}, - Engine as _, }; -use gpui::{img, App, ClipboardItem, Image, ImageFormat, Pixels, RenderImage, Window}; +use gpui::{App, ClipboardItem, Image, ImageFormat, Pixels, RenderImage, Window, img}; use std::sync::Arc; -use ui::{div, prelude::*, IntoElement, Styled}; +use ui::{IntoElement, Styled, div, prelude::*}; use crate::outputs::OutputContent; diff --git a/crates/repl/src/outputs/markdown.rs b/crates/repl/src/outputs/markdown.rs index a5013f691b..fb04c9fd44 100644 --- a/crates/repl/src/outputs/markdown.rs +++ b/crates/repl/src/outputs/markdown.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use gpui::{div, prelude::*, App, ClipboardItem, Context, Entity, Task, Window}; +use gpui::{App, ClipboardItem, Context, Entity, Task, Window, div, prelude::*}; use language::Buffer; use markdown_preview::{ markdown_elements::ParsedMarkdown, markdown_parser::parse_markdown, diff --git a/crates/repl/src/outputs/plain.rs b/crates/repl/src/outputs/plain.rs index 09df40410a..89ae10eee3 100644 --- a/crates/repl/src/outputs/plain.rs +++ b/crates/repl/src/outputs/plain.rs @@ -22,12 +22,12 @@ use alacritty_terminal::{ term::Config, vte::ansi::Processor, }; -use gpui::{canvas, size, Bounds, ClipboardItem, Entity, FontStyle, TextStyle, WhiteSpace}; +use gpui::{Bounds, ClipboardItem, Entity, FontStyle, TextStyle, WhiteSpace, canvas, size}; use language::Buffer; use settings::Settings as _; use terminal_view::terminal_element::TerminalElement; use theme::ThemeSettings; -use ui::{prelude::*, IntoElement}; +use ui::{IntoElement, prelude::*}; use crate::outputs::OutputContent; diff --git a/crates/repl/src/outputs/table.rs b/crates/repl/src/outputs/table.rs index 04eb2cc6e7..cb626da895 100644 --- a/crates/repl/src/outputs/table.rs +++ b/crates/repl/src/outputs/table.rs @@ -60,7 +60,7 @@ use runtimelib::media::datatable::TabularDataResource; use serde_json::Value; use settings::Settings; use theme::ThemeSettings; -use ui::{div, prelude::*, v_flex, IntoElement, Styled}; +use ui::{IntoElement, Styled, div, prelude::*, v_flex}; use util::markdown::MarkdownString; use crate::outputs::OutputContent; diff --git a/crates/repl/src/outputs/user_error.rs b/crates/repl/src/outputs/user_error.rs index f27d71e6eb..f42be1c867 100644 --- a/crates/repl/src/outputs/user_error.rs +++ b/crates/repl/src/outputs/user_error.rs @@ -1,5 +1,5 @@ use gpui::{AnyElement, App, Entity, FontWeight, Window}; -use ui::{h_flex, prelude::*, v_flex, Label}; +use ui::{Label, h_flex, prelude::*, v_flex}; use crate::outputs::plain::TerminalOutput; diff --git a/crates/repl/src/repl.rs b/crates/repl/src/repl.rs index 722e88b078..7c17b5fac2 100644 --- a/crates/repl/src/repl.rs +++ b/crates/repl/src/repl.rs @@ -10,7 +10,7 @@ mod session; use std::{sync::Arc, time::Duration}; -use async_dispatcher::{set_dispatcher, Dispatcher, Runnable}; +use async_dispatcher::{Dispatcher, Runnable, set_dispatcher}; use gpui::{App, PlatformDispatcher}; use project::Fs; pub use runtimelib::ExecutionState; diff --git a/crates/repl/src/repl_editor.rs b/crates/repl/src/repl_editor.rs index 2e919caa72..05b10f3f95 100644 --- a/crates/repl/src/repl_editor.rs +++ b/crates/repl/src/repl_editor.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use anyhow::{Context as _, Result}; use editor::Editor; -use gpui::{prelude::*, App, Entity, WeakEntity, Window}; +use gpui::{App, Entity, WeakEntity, Window, prelude::*}; use language::{BufferSnapshot, Language, LanguageName, Point}; use project::{ProjectItem as _, WorktreeId}; diff --git a/crates/repl/src/repl_sessions_ui.rs b/crates/repl/src/repl_sessions_ui.rs index 3655ed0136..abae381276 100644 --- a/crates/repl/src/repl_sessions_ui.rs +++ b/crates/repl/src/repl_sessions_ui.rs @@ -1,14 +1,14 @@ use editor::Editor; use gpui::{ - actions, prelude::*, AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, - Subscription, + AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, Subscription, actions, + prelude::*, }; use project::ProjectItem as _; -use ui::{prelude::*, ButtonLike, ElevationIndex, KeyBinding}; +use ui::{ButtonLike, ElevationIndex, KeyBinding, prelude::*}; use util::ResultExt as _; -use workspace::item::ItemEvent; use workspace::WorkspaceId; -use workspace::{item::Item, Workspace}; +use workspace::item::ItemEvent; +use workspace::{Workspace, item::Item}; use crate::jupyter_settings::JupyterSettings; use crate::repl_store::ReplStore; diff --git a/crates/repl/src/repl_store.rs b/crates/repl/src/repl_store.rs index 8597cedadd..e6a80e3224 100644 --- a/crates/repl/src/repl_store.rs +++ b/crates/repl/src/repl_store.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use anyhow::Result; use collections::HashMap; use command_palette_hooks::CommandPaletteFilter; -use gpui::{prelude::*, App, Context, Entity, EntityId, Global, Subscription, Task}; +use gpui::{App, Context, Entity, EntityId, Global, Subscription, Task, prelude::*}; use jupyter_websocket_client::RemoteServer; use language::Language; use project::{Fs, Project, WorktreeId}; diff --git a/crates/repl/src/session.rs b/crates/repl/src/session.rs index 08aaeb605e..82d0f915f8 100644 --- a/crates/repl/src/session.rs +++ b/crates/repl/src/session.rs @@ -2,22 +2,22 @@ use crate::components::KernelListItem; use crate::kernels::RemoteRunningKernel; use crate::setup_editor_session_actions; use crate::{ + KernelStatus, kernels::{Kernel, KernelSpecification, NativeRunningKernel}, outputs::{ExecutionStatus, ExecutionView}, - KernelStatus, }; use collections::{HashMap, HashSet}; use editor::{ + Anchor, AnchorRangeExt as _, Editor, MultiBuffer, ToPoint, display_map::{ BlockContext, BlockId, BlockPlacement, BlockProperties, BlockStyle, CustomBlockId, RenderBlock, }, scroll::Autoscroll, - Anchor, AnchorRangeExt as _, Editor, MultiBuffer, ToPoint, }; use futures::FutureExt as _; use gpui::{ - div, prelude::*, Context, Entity, EventEmitter, Render, Subscription, Task, WeakEntity, Window, + Context, Entity, EventEmitter, Render, Subscription, Task, WeakEntity, Window, div, prelude::*, }; use language::Point; use project::Fs; @@ -27,7 +27,7 @@ use runtimelib::{ }; use std::{env::temp_dir, ops::Range, sync::Arc, time::Duration}; use theme::ActiveTheme; -use ui::{prelude::*, IconButtonShape, Tooltip}; +use ui::{IconButtonShape, Tooltip, prelude::*}; use util::ResultExt as _; pub struct Session { diff --git a/crates/reqwest_client/examples/client.rs b/crates/reqwest_client/examples/client.rs index 3a94ca4a83..71af8d72cb 100644 --- a/crates/reqwest_client/examples/client.rs +++ b/crates/reqwest_client/examples/client.rs @@ -1,7 +1,7 @@ use std::time::Instant; -use futures::stream::FuturesUnordered; use futures::AsyncReadExt as _; +use futures::stream::FuturesUnordered; use http_client::AsyncBody; use http_client::HttpClient; use reqwest_client::ReqwestClient; diff --git a/crates/reqwest_client/src/reqwest_client.rs b/crates/reqwest_client/src/reqwest_client.rs index c523aba5ae..11afe18ce9 100644 --- a/crates/reqwest_client/src/reqwest_client.rs +++ b/crates/reqwest_client/src/reqwest_client.rs @@ -4,7 +4,7 @@ use std::{any::type_name, borrow::Cow, mem, pin::Pin, task::Poll, time::Duration use anyhow::anyhow; use bytes::{BufMut, Bytes, BytesMut}; use futures::{AsyncRead, TryStreamExt as _}; -use http_client::{http, RedirectPolicy}; +use http_client::{RedirectPolicy, http}; use regex::Regex; use reqwest::{ header::{HeaderMap, HeaderValue}, @@ -256,7 +256,7 @@ impl http_client::HttpClient for ReqwestClient { #[cfg(test)] mod tests { - use http_client::{http, HttpClient}; + use http_client::{HttpClient, http}; use crate::ReqwestClient; diff --git a/crates/rope/benches/rope_benchmark.rs b/crates/rope/benches/rope_benchmark.rs index 01811c0c86..2233708525 100644 --- a/crates/rope/benches/rope_benchmark.rs +++ b/crates/rope/benches/rope_benchmark.rs @@ -1,7 +1,7 @@ use std::ops::Range; use criterion::{ - black_box, criterion_group, criterion_main, BatchSize, BenchmarkId, Criterion, Throughput, + BatchSize, BenchmarkId, Criterion, Throughput, black_box, criterion_group, criterion_main, }; use rand::prelude::*; use rand::rngs::StdRng; diff --git a/crates/rope/src/rope.rs b/crates/rope/src/rope.rs index f0d0af76bd..efd89a0f72 100644 --- a/crates/rope/src/rope.rs +++ b/crates/rope/src/rope.rs @@ -1428,10 +1428,10 @@ where #[cfg(test)] mod tests { use super::*; + use Bias::{Left, Right}; use rand::prelude::*; use std::{cmp::Ordering, env, io::Read}; use util::RandomCharIter; - use Bias::{Left, Right}; #[ctor::ctor] fn init_logger() { @@ -1900,12 +1900,14 @@ mod tests { let correct_substring = &text[start..end]; // Test that correct range returns true - assert!(rope - .chunks_in_range(range.clone()) - .equals_str(correct_substring)); - assert!(rope - .reversed_chunks_in_range(range.clone()) - .equals_str(correct_substring)); + assert!( + rope.chunks_in_range(range.clone()) + .equals_str(correct_substring) + ); + assert!( + rope.reversed_chunks_in_range(range.clone()) + .equals_str(correct_substring) + ); // Test that all other ranges return false (unless they happen to match) for other_start in 0..text.len() { @@ -1919,12 +1921,16 @@ mod tests { if other_substring == correct_substring { continue; } - assert!(!rope - .chunks_in_range(range.clone()) - .equals_str(other_substring)); - assert!(!rope - .reversed_chunks_in_range(range.clone()) - .equals_str(other_substring)); + assert!( + !rope + .chunks_in_range(range.clone()) + .equals_str(other_substring) + ); + assert!( + !rope + .reversed_chunks_in_range(range.clone()) + .equals_str(other_substring) + ); } } } diff --git a/crates/rpc/src/auth.rs b/crates/rpc/src/auth.rs index 6cd3581671..2e3546289d 100644 --- a/crates/rpc/src/auth.rs +++ b/crates/rpc/src/auth.rs @@ -1,6 +1,6 @@ use anyhow::{Context as _, Result}; use base64::prelude::*; -use rand::{thread_rng, Rng as _}; +use rand::{Rng as _, thread_rng}; use rsa::pkcs1::{DecodeRsaPublicKey, EncodeRsaPublicKey}; use rsa::traits::PaddingScheme; use rsa::{Oaep, Pkcs1v15Encrypt, RsaPrivateKey, RsaPublicKey}; diff --git a/crates/rpc/src/conn.rs b/crates/rpc/src/conn.rs index 18bce4abba..2f7db713fd 100644 --- a/crates/rpc/src/conn.rs +++ b/crates/rpc/src/conn.rs @@ -37,8 +37,8 @@ impl Connection { executor: gpui::BackgroundExecutor, ) -> (Self, Self, std::sync::Arc) { use std::sync::{ - atomic::{AtomicBool, Ordering::SeqCst}, Arc, + atomic::{AtomicBool, Ordering::SeqCst}, }; let killed = Arc::new(AtomicBool::new(false)); diff --git a/crates/rpc/src/notification.rs b/crates/rpc/src/notification.rs index 52108f13dc..cb405b63ca 100644 --- a/crates/rpc/src/notification.rs +++ b/crates/rpc/src/notification.rs @@ -1,6 +1,6 @@ use crate::proto; use serde::{Deserialize, Serialize}; -use serde_json::{map, Value}; +use serde_json::{Value, map}; use strum::VariantNames; const KIND: &str = "kind"; diff --git a/crates/rpc/src/peer.rs b/crates/rpc/src/peer.rs index 36448a6967..67cc966d88 100644 --- a/crates/rpc/src/peer.rs +++ b/crates/rpc/src/peer.rs @@ -1,27 +1,27 @@ use super::{ + Connection, proto::{ self, AnyTypedEnvelope, EnvelopedMessage, MessageStream, PeerId, Receipt, RequestMessage, TypedEnvelope, }, - Connection, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::HashMap; use futures::{ + FutureExt, SinkExt, Stream, StreamExt, TryFutureExt, channel::{mpsc, oneshot}, stream::BoxStream, - FutureExt, SinkExt, Stream, StreamExt, TryFutureExt, }; use parking_lot::{Mutex, RwLock}; use proto::{ErrorCode, ErrorCodeExt, ErrorExt, RpcError}; -use serde::{ser::SerializeStruct, Serialize}; +use serde::{Serialize, ser::SerializeStruct}; use std::{ fmt, future, future::Future, sync::atomic::Ordering::SeqCst, sync::{ - atomic::{self, AtomicU32}, Arc, + atomic::{self, AtomicU32}, }, time::Duration, time::Instant, @@ -1030,10 +1030,12 @@ mod tests { let _ = io_ended_rx.await; let _ = messages_ended_rx.await; - assert!(server_conn - .send(WebSocketMessage::Binary(vec![])) - .await - .is_err()); + assert!( + server_conn + .send(WebSocketMessage::Binary(vec![])) + .await + .is_err() + ); } #[gpui::test(iterations = 50)] diff --git a/crates/rpc/src/proto_client.rs b/crates/rpc/src/proto_client.rs index f3dbf84da3..e5f7b781b8 100644 --- a/crates/rpc/src/proto_client.rs +++ b/crates/rpc/src/proto_client.rs @@ -1,13 +1,13 @@ use anyhow::anyhow; use collections::HashMap; use futures::{ - future::{BoxFuture, LocalBoxFuture}, Future, FutureExt as _, + future::{BoxFuture, LocalBoxFuture}, }; use gpui::{AnyEntity, AnyWeakEntity, AsyncApp, Entity}; use proto::{ - error::ErrorExt as _, AnyTypedEnvelope, EntityMessage, Envelope, EnvelopedMessage, - RequestMessage, TypedEnvelope, + AnyTypedEnvelope, EntityMessage, Envelope, EnvelopedMessage, RequestMessage, TypedEnvelope, + error::ErrorExt as _, }; use std::{ any::TypeId, diff --git a/crates/rpc/src/rpc.rs b/crates/rpc/src/rpc.rs index 9c62238733..c168c20fa8 100644 --- a/crates/rpc/src/rpc.rs +++ b/crates/rpc/src/rpc.rs @@ -11,7 +11,7 @@ pub use extension::*; pub use llm::*; pub use notification::*; pub use peer::*; -pub use proto::{error::*, Receipt, TypedEnvelope}; +pub use proto::{Receipt, TypedEnvelope, error::*}; mod macros; #[cfg(feature = "gpui")] diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index 90da46fa52..e9a837b168 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -1,22 +1,22 @@ mod registrar; use crate::{ - search_bar::render_nav_button, FocusSearch, NextHistoryQuery, PreviousHistoryQuery, ReplaceAll, - ReplaceNext, SearchOptions, SelectAllMatches, SelectNextMatch, SelectPreviousMatch, - ToggleCaseSensitive, ToggleRegex, ToggleReplace, ToggleSelection, ToggleWholeWord, + FocusSearch, NextHistoryQuery, PreviousHistoryQuery, ReplaceAll, ReplaceNext, SearchOptions, + SelectAllMatches, SelectNextMatch, SelectPreviousMatch, ToggleCaseSensitive, ToggleRegex, + ToggleReplace, ToggleSelection, ToggleWholeWord, search_bar::render_nav_button, }; use any_vec::AnyVec; use anyhow::Context as _; use collections::HashMap; use editor::{ - actions::{Backtab, Tab}, DisplayPoint, Editor, EditorElement, EditorSettings, EditorStyle, + actions::{Backtab, Tab}, }; use futures::channel::oneshot; use gpui::{ - actions, div, impl_actions, Action, App, ClickEvent, Context, Entity, EventEmitter, - FocusHandle, Focusable, InteractiveElement as _, IntoElement, KeyContext, ParentElement as _, - Render, ScrollHandle, Styled, Subscription, Task, TextStyle, Window, + Action, App, ClickEvent, Context, Entity, EventEmitter, FocusHandle, Focusable, + InteractiveElement as _, IntoElement, KeyContext, ParentElement as _, Render, ScrollHandle, + Styled, Subscription, Task, TextStyle, Window, actions, div, impl_actions, }; use language::{Language, LanguageRegistry}; use project::{ @@ -31,14 +31,14 @@ use theme::ThemeSettings; use zed_actions::outline::ToggleOutline; use ui::{ - h_flex, prelude::*, utils::SearchInputWidth, IconButton, IconButtonShape, IconName, Tooltip, - BASE_REM_SIZE_IN_PX, + BASE_REM_SIZE_IN_PX, IconButton, IconButtonShape, IconName, Tooltip, h_flex, prelude::*, + utils::SearchInputWidth, }; use util::ResultExt; use workspace::{ + ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, item::ItemHandle, searchable::{Direction, SearchEvent, SearchableItemHandle, WeakSearchableItemHandle}, - ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, }; pub use registrar::DivRegistrar; @@ -1521,7 +1521,7 @@ mod tests { use std::ops::Range; use super::*; - use editor::{display_map::DisplayRow, DisplayPoint, Editor, MultiBuffer, SearchSettings}; + use editor::{DisplayPoint, Editor, MultiBuffer, SearchSettings, display_map::DisplayRow}; use gpui::{Hsla, TestAppContext, UpdateGlobal, VisualTestContext}; use language::{Buffer, Point}; use project::Project; diff --git a/crates/search/src/buffer_search/registrar.rs b/crates/search/src/buffer_search/registrar.rs index deda2fbfc6..4351e38618 100644 --- a/crates/search/src/buffer_search/registrar.rs +++ b/crates/search/src/buffer_search/registrar.rs @@ -1,4 +1,4 @@ -use gpui::{div, Action, Context, Div, Entity, InteractiveElement, Window}; +use gpui::{Action, Context, Div, Entity, InteractiveElement, Window, div}; use workspace::Workspace; use crate::BufferSearchBar; diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 4010554882..2b4872ae77 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -1,27 +1,27 @@ use crate::{ - buffer_search::Deploy, BufferSearchBar, FocusSearch, NextHistoryQuery, PreviousHistoryQuery, - ReplaceAll, ReplaceNext, SearchOptions, SelectNextMatch, SelectPreviousMatch, - ToggleCaseSensitive, ToggleIncludeIgnored, ToggleRegex, ToggleReplace, ToggleWholeWord, + BufferSearchBar, FocusSearch, NextHistoryQuery, PreviousHistoryQuery, ReplaceAll, ReplaceNext, + SearchOptions, SelectNextMatch, SelectPreviousMatch, ToggleCaseSensitive, ToggleIncludeIgnored, + ToggleRegex, ToggleReplace, ToggleWholeWord, buffer_search::Deploy, }; use anyhow::Context as _; use collections::{HashMap, HashSet}; use editor::{ - actions::SelectAll, items::active_match_index, scroll::Autoscroll, Anchor, Editor, - EditorElement, EditorEvent, EditorSettings, EditorStyle, MultiBuffer, MAX_TAB_TITLE_LEN, + Anchor, Editor, EditorElement, EditorEvent, EditorSettings, EditorStyle, MAX_TAB_TITLE_LEN, + MultiBuffer, actions::SelectAll, items::active_match_index, scroll::Autoscroll, }; use futures::StreamExt; use gpui::{ - actions, div, Action, AnyElement, AnyView, App, Axis, Context, Entity, EntityId, EventEmitter, - FocusHandle, Focusable, Global, Hsla, InteractiveElement, IntoElement, KeyContext, - ParentElement, Point, Render, SharedString, Styled, Subscription, Task, TextStyle, - UpdateGlobal, WeakEntity, Window, + Action, AnyElement, AnyView, App, Axis, Context, Entity, EntityId, EventEmitter, FocusHandle, + Focusable, Global, Hsla, InteractiveElement, IntoElement, KeyContext, ParentElement, Point, + Render, SharedString, Styled, Subscription, Task, TextStyle, UpdateGlobal, WeakEntity, Window, + actions, div, }; use language::{Buffer, Language}; use menu::Confirm; use project::{ + Project, ProjectPath, search::{SearchInputKind, SearchQuery}, search_history::SearchHistoryCursor, - Project, ProjectPath, }; use settings::Settings; use std::{ @@ -34,15 +34,15 @@ use std::{ }; use theme::ThemeSettings; use ui::{ - h_flex, prelude::*, utils::SearchInputWidth, v_flex, Icon, IconButton, IconButtonShape, - IconName, KeyBinding, Label, LabelCommon, LabelSize, Toggleable, Tooltip, + Icon, IconButton, IconButtonShape, IconName, KeyBinding, Label, LabelCommon, LabelSize, + Toggleable, Tooltip, h_flex, prelude::*, utils::SearchInputWidth, v_flex, }; use util::paths::PathMatcher; use workspace::{ - item::{BreadcrumbText, Item, ItemEvent, ItemHandle}, - searchable::{Direction, SearchableItem, SearchableItemHandle}, DeploySearch, ItemNavHistory, NewSearch, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, WorkspaceId, + item::{BreadcrumbText, Item, ItemEvent, ItemHandle}, + searchable::{Direction, SearchableItem, SearchableItemHandle}, }; actions!( @@ -943,11 +943,7 @@ impl ProjectSearchView { let editor = item.act_as::(cx)?; let query = editor.query_suggestion(window, cx); - if query.is_empty() { - None - } else { - Some(query) - } + if query.is_empty() { None } else { Some(query) } }); let search = if let Some(existing) = existing { @@ -2235,7 +2231,7 @@ pub mod tests { use std::{ops::Deref as _, sync::Arc}; use super::*; - use editor::{display_map::DisplayRow, DisplayPoint}; + use editor::{DisplayPoint, display_map::DisplayRow}; use gpui::{Action, TestAppContext, VisualTestContext, WindowHandle}; use project::FakeFs; use serde_json::json; @@ -3633,11 +3629,13 @@ pub mod tests { .unwrap() .unwrap(); assert_eq!(cx.update(|cx| second_pane.read(cx).items_len()), 1); - assert!(window - .update(cx, |_, window, cx| second_pane - .focus_handle(cx) - .contains_focused(window, cx)) - .unwrap()); + assert!( + window + .update(cx, |_, window, cx| second_pane + .focus_handle(cx) + .contains_focused(window, cx)) + .unwrap() + ); let search_bar = window.build_entity(cx, |_, _| ProjectSearchBar::new()); window .update(cx, { @@ -3726,11 +3724,12 @@ pub mod tests { window .update(cx, |_workspace, _, cx| { second_pane.update(cx, |pane, _cx| { - assert!(pane - .active_item() - .unwrap() - .downcast::() - .is_some()); + assert!( + pane.active_item() + .unwrap() + .downcast::() + .is_some() + ); assert_eq!(pane.items_len(), 2); }); diff --git a/crates/search/src/search.rs b/crates/search/src/search.rs index f1329270a8..593950d4e4 100644 --- a/crates/search/src/search.rs +++ b/crates/search/src/search.rs @@ -1,11 +1,11 @@ use bitflags::bitflags; pub use buffer_search::BufferSearchBar; use editor::SearchSettings; -use gpui::{actions, Action, App, FocusHandle, IntoElement}; +use gpui::{Action, App, FocusHandle, IntoElement, actions}; use project::search::SearchQuery; pub use project_search::ProjectSearchView; -use ui::{prelude::*, Tooltip}; use ui::{ButtonStyle, IconButton, IconButtonShape}; +use ui::{Tooltip, prelude::*}; use workspace::notifications::NotificationId; use workspace::{Toast, Workspace}; diff --git a/crates/search/src/search_bar.rs b/crates/search/src/search_bar.rs index 84fc534c2f..805664c794 100644 --- a/crates/search/src/search_bar.rs +++ b/crates/search/src/search_bar.rs @@ -1,6 +1,6 @@ use gpui::{Action, FocusHandle, IntoElement}; -use ui::{prelude::*, Tooltip}; use ui::{IconButton, IconButtonShape}; +use ui::{Tooltip, prelude::*}; pub(super) fn render_nav_button( icon: ui::IconName, diff --git a/crates/semantic_index/src/chunking.rs b/crates/semantic_index/src/chunking.rs index d7224d9a7e..c1dfb6ccb5 100644 --- a/crates/semantic_index/src/chunking.rs +++ b/crates/semantic_index/src/chunking.rs @@ -1,4 +1,4 @@ -use language::{with_parser, with_query_cursor, Language}; +use language::{Language, with_parser, with_query_cursor}; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; use std::{ @@ -203,7 +203,7 @@ fn chunk_text_with_syntactic_ranges( #[cfg(test)] mod tests { use super::*; - use language::{tree_sitter_rust, Language, LanguageConfig, LanguageMatcher}; + use language::{Language, LanguageConfig, LanguageMatcher, tree_sitter_rust}; use unindent::Unindent as _; #[test] diff --git a/crates/semantic_index/src/embedding.rs b/crates/semantic_index/src/embedding.rs index 6246347b9e..ef4443283f 100644 --- a/crates/semantic_index/src/embedding.rs +++ b/crates/semantic_index/src/embedding.rs @@ -10,7 +10,7 @@ pub use open_ai::*; use sha2::{Digest, Sha256}; use anyhow::Result; -use futures::{future::BoxFuture, FutureExt}; +use futures::{FutureExt, future::BoxFuture}; use serde::{Deserialize, Serialize}; use std::{fmt, future}; diff --git a/crates/semantic_index/src/embedding/cloud.rs b/crates/semantic_index/src/embedding/cloud.rs index a5cc2407b0..fdbfca5873 100644 --- a/crates/semantic_index/src/embedding/cloud.rs +++ b/crates/semantic_index/src/embedding/cloud.rs @@ -1,8 +1,8 @@ use crate::{Embedding, EmbeddingProvider, TextToEmbed}; -use anyhow::{anyhow, Context as _, Result}; -use client::{proto, Client}; +use anyhow::{Context as _, Result, anyhow}; +use client::{Client, proto}; use collections::HashMap; -use futures::{future::BoxFuture, FutureExt}; +use futures::{FutureExt, future::BoxFuture}; use std::sync::Arc; pub struct CloudEmbeddingProvider { diff --git a/crates/semantic_index/src/embedding/lmstudio.rs b/crates/semantic_index/src/embedding/lmstudio.rs index 56f70ed4b1..73e52aa0bf 100644 --- a/crates/semantic_index/src/embedding/lmstudio.rs +++ b/crates/semantic_index/src/embedding/lmstudio.rs @@ -1,5 +1,5 @@ use anyhow::{Context as _, Result}; -use futures::{future::BoxFuture, AsyncReadExt as _, FutureExt}; +use futures::{AsyncReadExt as _, FutureExt, future::BoxFuture}; use http_client::HttpClient; use serde::{Deserialize, Serialize}; use std::sync::Arc; diff --git a/crates/semantic_index/src/embedding/ollama.rs b/crates/semantic_index/src/embedding/ollama.rs index 6d3fa67902..5737609e24 100644 --- a/crates/semantic_index/src/embedding/ollama.rs +++ b/crates/semantic_index/src/embedding/ollama.rs @@ -1,5 +1,5 @@ use anyhow::{Context as _, Result}; -use futures::{future::BoxFuture, AsyncReadExt as _, FutureExt}; +use futures::{AsyncReadExt as _, FutureExt, future::BoxFuture}; use http_client::HttpClient; use serde::{Deserialize, Serialize}; use std::sync::Arc; diff --git a/crates/semantic_index/src/embedding/open_ai.rs b/crates/semantic_index/src/embedding/open_ai.rs index d07e7d6b53..da2b3bd2e4 100644 --- a/crates/semantic_index/src/embedding/open_ai.rs +++ b/crates/semantic_index/src/embedding/open_ai.rs @@ -1,6 +1,6 @@ use crate::{Embedding, EmbeddingProvider, TextToEmbed}; use anyhow::Result; -use futures::{future::BoxFuture, FutureExt}; +use futures::{FutureExt, future::BoxFuture}; use http_client::HttpClient; pub use open_ai::OpenAiEmbeddingModel; use std::sync::Arc; diff --git a/crates/semantic_index/src/embedding_index.rs b/crates/semantic_index/src/embedding_index.rs index 134b409551..022034bda6 100644 --- a/crates/semantic_index/src/embedding_index.rs +++ b/crates/semantic_index/src/embedding_index.rs @@ -3,12 +3,12 @@ use crate::{ embedding::{Embedding, EmbeddingProvider, TextToEmbed}, indexing::{IndexingEntryHandle, IndexingEntrySet}, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::Bound; use feature_flags::FeatureFlagAppExt; use fs::Fs; use fs::MTime; -use futures::{stream::StreamExt, FutureExt as _}; +use futures::{FutureExt as _, stream::StreamExt}; use futures_batch::ChunksTimeoutStreamExt; use gpui::{App, AppContext as _, Entity, Task}; use heed::types::{SerdeBincode, Str}; diff --git a/crates/semantic_index/src/project_index.rs b/crates/semantic_index/src/project_index.rs index e739d9b5b9..8558a1470e 100644 --- a/crates/semantic_index/src/project_index.rs +++ b/crates/semantic_index/src/project_index.rs @@ -3,7 +3,7 @@ use crate::{ summary_index::FileSummary, worktree_index::{WorktreeIndex, WorktreeIndexHandle}, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::HashMap; use fs::Fs; use futures::FutureExt; diff --git a/crates/semantic_index/src/project_index_debug_view.rs b/crates/semantic_index/src/project_index_debug_view.rs index 44a194ae45..140599d22a 100644 --- a/crates/semantic_index/src/project_index_debug_view.rs +++ b/crates/semantic_index/src/project_index_debug_view.rs @@ -1,8 +1,8 @@ use crate::ProjectIndex; use gpui::{ - canvas, div, list, uniform_list, AnyElement, App, CursorStyle, Entity, EventEmitter, - FocusHandle, Focusable, IntoElement, ListOffset, ListState, MouseMoveEvent, Render, - UniformListScrollHandle, + AnyElement, App, CursorStyle, Entity, EventEmitter, FocusHandle, Focusable, IntoElement, + ListOffset, ListState, MouseMoveEvent, Render, UniformListScrollHandle, canvas, div, list, + uniform_list, }; use project::WorktreeId; use settings::Settings; diff --git a/crates/semantic_index/src/semantic_index.rs b/crates/semantic_index/src/semantic_index.rs index 0ae076b40f..b2e565692d 100644 --- a/crates/semantic_index/src/semantic_index.rs +++ b/crates/semantic_index/src/semantic_index.rs @@ -269,7 +269,7 @@ mod tests { use embedding_index::{ChunkedFile, EmbeddingIndex}; use feature_flags::FeatureFlagAppExt; use fs::FakeFs; - use futures::{future::BoxFuture, FutureExt}; + use futures::{FutureExt, future::BoxFuture}; use gpui::TestAppContext; use indexing::IndexingEntrySet; use language::language_settings::AllLanguageSettings; diff --git a/crates/semantic_index/src/summary_index.rs b/crates/semantic_index/src/summary_index.rs index 4d954a2989..397b5f07d5 100644 --- a/crates/semantic_index/src/summary_index.rs +++ b/crates/semantic_index/src/summary_index.rs @@ -1,12 +1,12 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use arrayvec::ArrayString; use fs::{Fs, MTime}; -use futures::{stream::StreamExt, TryFutureExt}; +use futures::{TryFutureExt, stream::StreamExt}; use futures_batch::ChunksTimeoutStreamExt; use gpui::{App, AppContext as _, Entity, Task}; use heed::{ - types::{SerdeBincode, Str}, RoTxn, + types::{SerdeBincode, Str}, }; use language_model::{ LanguageModelCompletionEvent, LanguageModelId, LanguageModelRegistry, LanguageModelRequest, diff --git a/crates/semantic_version/src/semantic_version.rs b/crates/semantic_version/src/semantic_version.rs index 243ac91e13..c7519d4c7d 100644 --- a/crates/semantic_version/src/semantic_version.rs +++ b/crates/semantic_version/src/semantic_version.rs @@ -7,8 +7,8 @@ use std::{ str::FromStr, }; -use anyhow::{anyhow, Result}; -use serde::{de::Error, Deserialize, Serialize}; +use anyhow::{Result, anyhow}; +use serde::{Deserialize, Serialize, de::Error}; /// A [semantic version](https://semver.org/) number. #[derive(Clone, Copy, Debug, Default, Eq, Ord, PartialEq, PartialOrd)] diff --git a/crates/session/src/session.rs b/crates/session/src/session.rs index a37a2ebcbb..5705d23d3e 100644 --- a/crates/session/src/session.rs +++ b/crates/session/src/session.rs @@ -67,14 +67,16 @@ impl AppSession { pub fn new(session: Session, cx: &Context) -> Self { let _subscriptions = vec![cx.on_app_quit(Self::app_will_quit)]; - let _serialization_task = Some(cx.spawn(async move |_, cx| loop { - if let Some(windows) = cx.update(|cx| cx.window_stack()).ok().flatten() { - store_window_stack(windows).await; - } + let _serialization_task = Some(cx.spawn(async move |_, cx| { + loop { + if let Some(windows) = cx.update(|cx| cx.window_stack()).ok().flatten() { + store_window_stack(windows).await; + } - cx.background_executor() - .timer(Duration::from_millis(100)) - .await; + cx.background_executor() + .timer(Duration::from_millis(100)) + .await; + } })); Self { diff --git a/crates/settings/src/editable_setting_control.rs b/crates/settings/src/editable_setting_control.rs index 2893d209d4..0a5b3e9be0 100644 --- a/crates/settings/src/editable_setting_control.rs +++ b/crates/settings/src/editable_setting_control.rs @@ -1,7 +1,7 @@ use fs::Fs; use gpui::{App, RenderOnce, SharedString}; -use crate::{update_settings_file, Settings}; +use crate::{Settings, update_settings_file}; /// A UI control that can be used to edit a setting. pub trait EditableSettingControl: RenderOnce { diff --git a/crates/settings/src/keymap_file.rs b/crates/settings/src/keymap_file.rs index c355ba0ba8..937da91dfb 100644 --- a/crates/settings/src/keymap_file.rs +++ b/crates/settings/src/keymap_file.rs @@ -1,21 +1,21 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::{BTreeMap, HashMap, IndexMap}; use fs::Fs; use gpui::{ - Action, ActionBuildError, App, InvalidKeystrokeError, KeyBinding, KeyBindingContextPredicate, - NoAction, SharedString, KEYSTROKE_PARSE_EXPECTED_MESSAGE, + Action, ActionBuildError, App, InvalidKeystrokeError, KEYSTROKE_PARSE_EXPECTED_MESSAGE, + KeyBinding, KeyBindingContextPredicate, NoAction, SharedString, }; use schemars::{ + JsonSchema, r#gen::{SchemaGenerator, SchemaSettings}, schema::{ArrayValidation, InstanceType, Schema, SchemaObject, SubschemaValidation}, - JsonSchema, }; use serde::Deserialize; use serde_json::Value; use std::{any::TypeId, fmt::Write, rc::Rc, sync::Arc, sync::LazyLock}; use util::{asset_str, markdown::MarkdownString}; -use crate::{settings_store::parse_json_with_comments, SettingsAssets}; +use crate::{SettingsAssets, settings_store::parse_json_with_comments}; pub trait KeyBindingValidator: Send + Sync { fn action_type_id(&self) -> TypeId; diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs index ea6aba84f6..5f695cb62b 100644 --- a/crates/settings/src/settings.rs +++ b/crates/settings/src/settings.rs @@ -18,8 +18,8 @@ pub use keymap_file::{ }; pub use settings_file::*; pub use settings_store::{ - parse_json_with_comments, InvalidSettingsError, LocalSettingsKind, Settings, SettingsLocation, - SettingsSources, SettingsStore, TaskKind, + InvalidSettingsError, LocalSettingsKind, Settings, SettingsLocation, SettingsSources, + SettingsStore, TaskKind, parse_json_with_comments, }; #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, PartialOrd, Ord)] diff --git a/crates/settings/src/settings_file.rs b/crates/settings/src/settings_file.rs index 4580fa71a6..0fcdcde8ad 100644 --- a/crates/settings/src/settings_file.rs +++ b/crates/settings/src/settings_file.rs @@ -1,7 +1,7 @@ -use crate::{settings_store::SettingsStore, Settings}; +use crate::{Settings, settings_store::SettingsStore}; use collections::HashSet; use fs::{Fs, PathEventKind}; -use futures::{channel::mpsc, StreamExt}; +use futures::{StreamExt, channel::mpsc}; use gpui::{App, BackgroundExecutor, ReadGlobal}; use std::{path::PathBuf, sync::Arc, time::Duration}; diff --git a/crates/settings/src/settings_store.rs b/crates/settings/src/settings_store.rs index 8f0e4f071d..de696c69d0 100644 --- a/crates/settings/src/settings_store.rs +++ b/crates/settings/src/settings_store.rs @@ -1,18 +1,18 @@ -use anyhow::{anyhow, Context as _, Result}; -use collections::{btree_map, hash_map, BTreeMap, HashMap}; +use anyhow::{Context as _, Result, anyhow}; +use collections::{BTreeMap, HashMap, btree_map, hash_map}; use ec4rs::{ConfigParser, PropertiesSource, Section}; use fs::Fs; -use futures::{channel::mpsc, future::LocalBoxFuture, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, channel::mpsc, future::LocalBoxFuture}; use gpui::{App, AsyncApp, BorrowAppContext, Global, Task, UpdateGlobal}; use paths::{ - debug_task_file_name, local_settings_file_relative_path, task_file_name, EDITORCONFIG_NAME, + EDITORCONFIG_NAME, debug_task_file_name, local_settings_file_relative_path, task_file_name, }; -use schemars::{r#gen::SchemaGenerator, schema::RootSchema, JsonSchema}; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use schemars::{JsonSchema, r#gen::SchemaGenerator, schema::RootSchema}; +use serde::{Deserialize, Serialize, de::DeserializeOwned}; use smallvec::SmallVec; use std::{ - any::{type_name, Any, TypeId}, + any::{Any, TypeId, type_name}, fmt::Debug, ops::Range, path::{Path, PathBuf}, @@ -23,7 +23,7 @@ use streaming_iterator::StreamingIterator; use tree_sitter::Query; use util::RangeExt; -use util::{merge_non_null_json_value_into, ResultExt as _}; +use util::{ResultExt as _, merge_non_null_json_value_into}; pub type EditorconfigProperties = ec4rs::Properties; diff --git a/crates/settings_ui/src/appearance_settings_controls.rs b/crates/settings_ui/src/appearance_settings_controls.rs index d1cae1d8a7..fa7e31c5cd 100644 --- a/crates/settings_ui/src/appearance_settings_controls.rs +++ b/crates/settings_ui/src/appearance_settings_controls.rs @@ -4,8 +4,8 @@ use gpui::{App, FontFeatures, FontWeight}; use settings::{EditableSettingControl, Settings}; use theme::{FontFamilyCache, SystemAppearance, ThemeMode, ThemeRegistry, ThemeSettings}; use ui::{ - prelude::*, CheckboxWithLabel, ContextMenu, DropdownMenu, NumericStepper, SettingsContainer, - SettingsGroup, ToggleButton, + CheckboxWithLabel, ContextMenu, DropdownMenu, NumericStepper, SettingsContainer, SettingsGroup, + ToggleButton, prelude::*, }; #[derive(IntoElement)] diff --git a/crates/settings_ui/src/settings_ui.rs b/crates/settings_ui/src/settings_ui.rs index 8f044fb4b2..430997b6d3 100644 --- a/crates/settings_ui/src/settings_ui.rs +++ b/crates/settings_ui/src/settings_ui.rs @@ -5,10 +5,10 @@ use std::any::TypeId; use command_palette_hooks::CommandPaletteFilter; use editor::EditorSettingsControls; use feature_flags::{FeatureFlag, FeatureFlagViewExt}; -use gpui::{actions, App, Entity, EventEmitter, FocusHandle, Focusable}; +use gpui::{App, Entity, EventEmitter, FocusHandle, Focusable, actions}; use ui::prelude::*; -use workspace::item::{Item, ItemEvent}; use workspace::Workspace; +use workspace::item::{Item, ItemEvent}; use crate::appearance_settings_controls::AppearanceSettingsControls; diff --git a/crates/snippet/src/snippet.rs b/crates/snippet/src/snippet.rs index 4fadd9b2dd..3c6681def1 100644 --- a/crates/snippet/src/snippet.rs +++ b/crates/snippet/src/snippet.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use smallvec::SmallVec; use std::{collections::BTreeMap, ops::Range}; diff --git a/crates/snippet_provider/src/format.rs b/crates/snippet_provider/src/format.rs index 04f13f5634..69afe1f62a 100644 --- a/crates/snippet_provider/src/format.rs +++ b/crates/snippet_provider/src/format.rs @@ -1,8 +1,8 @@ use collections::HashMap; use schemars::{ + JsonSchema, r#gen::SchemaSettings, schema::{ObjectValidation, Schema, SchemaObject}, - JsonSchema, }; use serde::Deserialize; use serde_json_lenient::Value; diff --git a/crates/snippet_provider/src/registry.rs b/crates/snippet_provider/src/registry.rs index b4b3e3282a..7c4948a48d 100644 --- a/crates/snippet_provider/src/registry.rs +++ b/crates/snippet_provider/src/registry.rs @@ -5,7 +5,7 @@ use collections::HashMap; use gpui::{App, Global, ReadGlobal, UpdateGlobal}; use parking_lot::RwLock; -use crate::{file_stem_to_key, Snippet, SnippetKind}; +use crate::{Snippet, SnippetKind, file_stem_to_key}; struct GlobalSnippetRegistry(Arc); diff --git a/crates/snippets_ui/src/snippets_ui.rs b/crates/snippets_ui/src/snippets_ui.rs index 92261c5a8b..eb2c0b2030 100644 --- a/crates/snippets_ui/src/snippets_ui.rs +++ b/crates/snippets_ui/src/snippets_ui.rs @@ -1,15 +1,15 @@ -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{ - actions, App, Context, DismissEvent, Entity, EventEmitter, Focusable, ParentElement, Render, - Styled, WeakEntity, Window, + App, Context, DismissEvent, Entity, EventEmitter, Focusable, ParentElement, Render, Styled, + WeakEntity, Window, actions, }; use language::LanguageRegistry; use paths::config_dir; use picker::{Picker, PickerDelegate}; use std::{borrow::Borrow, fs, sync::Arc}; -use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; +use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; -use workspace::{notifications::NotifyResultExt, ModalView, OpenOptions, OpenVisible, Workspace}; +use workspace::{ModalView, OpenOptions, OpenVisible, Workspace, notifications::NotifyResultExt}; actions!(snippets, [ConfigureSnippets, OpenFolder]); diff --git a/crates/sqlez/src/connection.rs b/crates/sqlez/src/connection.rs index fdd8ec9ad4..a79f487ed9 100644 --- a/crates/sqlez/src/connection.rs +++ b/crates/sqlez/src/connection.rs @@ -6,7 +6,7 @@ use std::{ ptr, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use libsqlite3_sys::*; pub struct Connection { @@ -429,12 +429,16 @@ mod test { fn test_alter_table_syntax() { let connection = Connection::open_memory(Some("test_alter_table_syntax")); - assert!(connection - .sql_has_syntax_error("ALTER TABLE test ADD x TEXT") - .is_none()); + assert!( + connection + .sql_has_syntax_error("ALTER TABLE test ADD x TEXT") + .is_none() + ); - assert!(connection - .sql_has_syntax_error("ALTER TABLE test AAD x TEXT") - .is_some()); + assert!( + connection + .sql_has_syntax_error("ALTER TABLE test AAD x TEXT") + .is_some() + ); } } diff --git a/crates/sqlez/src/migrations.rs b/crates/sqlez/src/migrations.rs index 8cc79d9efb..9d0721b7b4 100644 --- a/crates/sqlez/src/migrations.rs +++ b/crates/sqlez/src/migrations.rs @@ -6,7 +6,7 @@ use std::ffi::CString; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use indoc::{formatdoc, indoc}; use libsqlite3_sys::sqlite3_exec; diff --git a/crates/sqlez/src/savepoint.rs b/crates/sqlez/src/savepoint.rs index 09c2e94148..94e2a20fb9 100644 --- a/crates/sqlez/src/savepoint.rs +++ b/crates/sqlez/src/savepoint.rs @@ -76,23 +76,25 @@ mod tests { connection.with_savepoint("first", || { connection.exec_bound("INSERT INTO text(text, idx) VALUES (?, ?)")?((save1_text, 1))?; - assert!(connection - .with_savepoint("second", || -> Result, anyhow::Error> { - connection.exec_bound("INSERT INTO text(text, idx) VALUES (?, ?)")?(( - save2_text, 2, - ))?; + assert!( + connection + .with_savepoint("second", || -> Result, anyhow::Error> { + connection.exec_bound("INSERT INTO text(text, idx) VALUES (?, ?)")?(( + save2_text, 2, + ))?; - assert_eq!( - connection - .select::("SELECT text FROM text ORDER BY text.idx ASC")?( - )?, - vec![save1_text, save2_text], - ); + assert_eq!( + connection + .select::("SELECT text FROM text ORDER BY text.idx ASC")?( + )?, + vec![save1_text, save2_text], + ); - anyhow::bail!("Failed second save point :(") - }) - .err() - .is_some()); + anyhow::bail!("Failed second save point :(") + }) + .err() + .is_some() + ); assert_eq!( connection.select::("SELECT text FROM text ORDER BY text.idx ASC")?()?, diff --git a/crates/sqlez/src/statement.rs b/crates/sqlez/src/statement.rs index 35f00050ed..772d679bcf 100644 --- a/crates/sqlez/src/statement.rs +++ b/crates/sqlez/src/statement.rs @@ -1,8 +1,8 @@ -use std::ffi::{c_int, CStr, CString}; +use std::ffi::{CStr, CString, c_int}; use std::marker::PhantomData; use std::{ptr, slice, str}; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use libsqlite3_sys::*; use crate::bindable::{Bind, Column}; @@ -477,11 +477,13 @@ mod test { .unwrap()() .unwrap(); - assert!(connection - .select_row::("SELECT text FROM texts") - .unwrap()() - .unwrap() - .is_none()); + assert!( + connection + .select_row::("SELECT text FROM texts") + .unwrap()() + .unwrap() + .is_none() + ); let text_to_insert = "This is a test"; diff --git a/crates/sqlez/src/thread_safe_connection.rs b/crates/sqlez/src/thread_safe_connection.rs index 1b9bcc1118..91cf63443c 100644 --- a/crates/sqlez/src/thread_safe_connection.rs +++ b/crates/sqlez/src/thread_safe_connection.rs @@ -1,6 +1,6 @@ use anyhow::Context as _; use collections::HashMap; -use futures::{channel::oneshot, Future, FutureExt}; +use futures::{Future, FutureExt, channel::oneshot}; use parking_lot::{Mutex, RwLock}; use std::{ marker::PhantomData, diff --git a/crates/story/src/story.rs b/crates/story/src/story.rs index d603dbbfd8..fddc8258f8 100644 --- a/crates/story/src/story.rs +++ b/crates/story/src/story.rs @@ -1,6 +1,6 @@ use gpui::{ - div, prelude::*, px, rems, AnyElement, App, DefaultColor, DefaultColors, Div, SharedString, - Window, + AnyElement, App, DefaultColor, DefaultColors, Div, SharedString, Window, div, prelude::*, px, + rems, }; use itertools::Itertools; use smallvec::SmallVec; diff --git a/crates/storybook/src/assets.rs b/crates/storybook/src/assets.rs index f45d1457df..4049de4934 100644 --- a/crates/storybook/src/assets.rs +++ b/crates/storybook/src/assets.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use gpui::{AssetSource, SharedString}; use rust_embed::RustEmbed; diff --git a/crates/storybook/src/stories/auto_height_editor.rs b/crates/storybook/src/stories/auto_height_editor.rs index b3b09c37e6..9abee60238 100644 --- a/crates/storybook/src/stories/auto_height_editor.rs +++ b/crates/storybook/src/stories/auto_height_editor.rs @@ -1,7 +1,7 @@ use editor::Editor; use gpui::{ - div, white, App, AppContext as _, Context, Entity, IntoElement, KeyBinding, ParentElement, - Render, Styled, Window, + App, AppContext as _, Context, Entity, IntoElement, KeyBinding, ParentElement, Render, Styled, + Window, div, white, }; pub struct AutoHeightEditorStory { diff --git a/crates/storybook/src/stories/default_colors.rs b/crates/storybook/src/stories/default_colors.rs index 78ece11314..4985b5b732 100644 --- a/crates/storybook/src/stories/default_colors.rs +++ b/crates/storybook/src/stories/default_colors.rs @@ -1,10 +1,10 @@ use gpui::{ - colors, div, prelude::*, App, Context, DefaultColor, DefaultThemeAppearance, Entity, Hsla, - Render, Window, + App, Context, DefaultColor, DefaultThemeAppearance, Entity, Hsla, Render, Window, colors, div, + prelude::*, }; use story::Story; use strum::IntoEnumIterator; -use ui::{h_flex, ActiveTheme}; +use ui::{ActiveTheme, h_flex}; pub struct DefaultColorsStory; diff --git a/crates/storybook/src/stories/focus.rs b/crates/storybook/src/stories/focus.rs index 68e5d0c5f4..a64c272ba7 100644 --- a/crates/storybook/src/stories/focus.rs +++ b/crates/storybook/src/stories/focus.rs @@ -1,5 +1,5 @@ use gpui::{ - actions, div, prelude::*, App, Entity, FocusHandle, KeyBinding, Render, Subscription, Window, + App, Entity, FocusHandle, KeyBinding, Render, Subscription, Window, actions, div, prelude::*, }; use ui::prelude::*; diff --git a/crates/storybook/src/stories/kitchen_sink.rs b/crates/storybook/src/stories/kitchen_sink.rs index d2e021d02f..0ad6c33eab 100644 --- a/crates/storybook/src/stories/kitchen_sink.rs +++ b/crates/storybook/src/stories/kitchen_sink.rs @@ -1,4 +1,4 @@ -use gpui::{prelude::*, Entity, Render}; +use gpui::{Entity, Render, prelude::*}; use story::Story; use strum::IntoEnumIterator; use ui::prelude::*; diff --git a/crates/storybook/src/stories/picker.rs b/crates/storybook/src/stories/picker.rs index a946bfed7c..723829d168 100644 --- a/crates/storybook/src/stories/picker.rs +++ b/crates/storybook/src/stories/picker.rs @@ -1,9 +1,9 @@ use fuzzy::StringMatchCandidate; -use gpui::{div, prelude::*, App, Entity, KeyBinding, Render, SharedString, Styled, Task, Window}; +use gpui::{App, Entity, KeyBinding, Render, SharedString, Styled, Task, Window, div, prelude::*}; use picker::{Picker, PickerDelegate}; use std::sync::Arc; -use ui::{prelude::*, ListItemSpacing}; use ui::{Label, ListItem}; +use ui::{ListItemSpacing, prelude::*}; pub struct PickerStory { picker: Entity>, diff --git a/crates/storybook/src/stories/scroll.rs b/crates/storybook/src/stories/scroll.rs index 764724c335..8a4c7ea768 100644 --- a/crates/storybook/src/stories/scroll.rs +++ b/crates/storybook/src/stories/scroll.rs @@ -1,6 +1,6 @@ -use gpui::{div, prelude::*, px, App, Entity, Render, SharedString, Styled, Window}; -use ui::prelude::*; +use gpui::{App, Entity, Render, SharedString, Styled, Window, div, prelude::*, px}; use ui::Tooltip; +use ui::prelude::*; pub struct ScrollStory; diff --git a/crates/storybook/src/stories/text.rs b/crates/storybook/src/stories/text.rs index 0743a8b6c3..a4b8fc486d 100644 --- a/crates/storybook/src/stories/text.rs +++ b/crates/storybook/src/stories/text.rs @@ -1,6 +1,6 @@ use gpui::{ - div, green, red, App, AppContext as _, Context, Entity, HighlightStyle, InteractiveText, - IntoElement, ParentElement, Render, Styled, StyledText, Window, + App, AppContext as _, Context, Entity, HighlightStyle, InteractiveText, IntoElement, + ParentElement, Render, Styled, StyledText, Window, div, green, red, }; use indoc::indoc; use story::*; diff --git a/crates/storybook/src/story_selector.rs b/crates/storybook/src/story_selector.rs index a481440413..492b06c6ac 100644 --- a/crates/storybook/src/story_selector.rs +++ b/crates/storybook/src/story_selector.rs @@ -3,8 +3,8 @@ use std::sync::OnceLock; use crate::stories::*; use anyhow::anyhow; -use clap::builder::PossibleValue; use clap::ValueEnum; +use clap::builder::PossibleValue; use gpui::AnyView; use strum::{EnumIter, EnumString, IntoEnumIterator}; use ui::prelude::*; diff --git a/crates/storybook/src/storybook.rs b/crates/storybook/src/storybook.rs index 2129b04143..c2ae4ef04d 100644 --- a/crates/storybook/src/storybook.rs +++ b/crates/storybook/src/storybook.rs @@ -9,7 +9,7 @@ use std::sync::Arc; use clap::Parser; use dialoguer::FuzzySelect; use gpui::{ - div, px, size, AnyView, App, Bounds, Context, Render, Window, WindowBounds, WindowOptions, + AnyView, App, Bounds, Context, Render, Window, WindowBounds, WindowOptions, div, px, size, }; use log::LevelFilter; use project::Project; diff --git a/crates/sum_tree/src/sum_tree.rs b/crates/sum_tree/src/sum_tree.rs index 14b4614e75..5b53bf7cbf 100644 --- a/crates/sum_tree/src/sum_tree.rs +++ b/crates/sum_tree/src/sum_tree.rs @@ -134,7 +134,7 @@ where D3: Dimension<'a, S>, { fn cmp(&self, cursor_location: &((D1, D2), D3), cx: &S::Context) -> Ordering { - self.cmp(&cursor_location.0 .0, cx) + self.cmp(&cursor_location.0.0, cx) } } @@ -1418,11 +1418,7 @@ mod tests { let mut ix = 0; let iterator = std::iter::from_fn(|| { ix = (ix + 1) % 2; - if ix == 1 { - Some(1) - } else { - None - } + if ix == 1 { Some(1) } else { None } }); assert_eq!(SumTree::from_iter(iterator, &()).items(&()), vec![1]); } diff --git a/crates/supermaven/src/supermaven.rs b/crates/supermaven/src/supermaven.rs index 9c7e0b1c78..410cc94c88 100644 --- a/crates/supermaven/src/supermaven.rs +++ b/crates/supermaven/src/supermaven.rs @@ -5,13 +5,13 @@ pub use supermaven_completion_provider::*; use anyhow::{Context as _, Result}; #[allow(unused_imports)] -use client::{proto, Client}; +use client::{Client, proto}; use collections::BTreeMap; -use futures::{channel::mpsc, io::BufReader, AsyncBufReadExt, StreamExt}; -use gpui::{actions, App, AsyncApp, Context, Entity, EntityId, Global, Task, WeakEntity}; +use futures::{AsyncBufReadExt, StreamExt, channel::mpsc, io::BufReader}; +use gpui::{App, AsyncApp, Context, Entity, EntityId, Global, Task, WeakEntity, actions}; use language::{ - language_settings::all_language_settings, Anchor, Buffer, BufferSnapshot, ToOffset, + Anchor, Buffer, BufferSnapshot, ToOffset, language_settings::all_language_settings, }; use messages::*; use postage::watch; diff --git a/crates/supermaven_api/src/supermaven_api.rs b/crates/supermaven_api/src/supermaven_api.rs index 6d3bb44984..3dede695dd 100644 --- a/crates/supermaven_api/src/supermaven_api.rs +++ b/crates/supermaven_api/src/supermaven_api.rs @@ -1,6 +1,6 @@ -use anyhow::{anyhow, Context as _, Result}; -use futures::io::BufReader; +use anyhow::{Context as _, Result, anyhow}; use futures::AsyncReadExt; +use futures::io::BufReader; use http_client::{AsyncBody, HttpClient, Request as HttpRequest}; use paths::supermaven_dir; use serde::{Deserialize, Serialize}; diff --git a/crates/tab_switcher/src/tab_switcher.rs b/crates/tab_switcher/src/tab_switcher.rs index 983e29ec4f..2f3b4a65ae 100644 --- a/crates/tab_switcher/src/tab_switcher.rs +++ b/crates/tab_switcher/src/tab_switcher.rs @@ -4,9 +4,9 @@ mod tab_switcher_tests; use collections::HashMap; use editor::items::entry_git_aware_label_color; use gpui::{ - actions, impl_actions, rems, Action, AnyElement, App, Context, DismissEvent, Entity, EntityId, - EventEmitter, FocusHandle, Focusable, Modifiers, ModifiersChangedEvent, MouseButton, - MouseUpEvent, ParentElement, Render, Styled, Task, WeakEntity, Window, + Action, AnyElement, App, Context, DismissEvent, Entity, EntityId, EventEmitter, FocusHandle, + Focusable, Modifiers, ModifiersChangedEvent, MouseButton, MouseUpEvent, ParentElement, Render, + Styled, Task, WeakEntity, Window, actions, impl_actions, rems, }; use picker::{Picker, PickerDelegate}; use project::Project; @@ -14,12 +14,12 @@ use schemars::JsonSchema; use serde::Deserialize; use settings::Settings; use std::sync::Arc; -use ui::{prelude::*, ListItem, ListItemSpacing, Tooltip}; +use ui::{ListItem, ListItemSpacing, Tooltip, prelude::*}; use util::ResultExt; use workspace::{ - item::{ItemHandle, ItemSettings, TabContentParams}, - pane::{render_item_indicator, tab_details, Event as PaneEvent}, ModalView, Pane, SaveIntent, Workspace, + item::{ItemHandle, ItemSettings, TabContentParams}, + pane::{Event as PaneEvent, render_item_indicator, tab_details}, }; const PANEL_WIDTH_REMS: f32 = 28.; diff --git a/crates/task/src/debug_format.rs b/crates/task/src/debug_format.rs index 5eb8e535a8..ccbd67bfa6 100644 --- a/crates/task/src/debug_format.rs +++ b/crates/task/src/debug_format.rs @@ -1,11 +1,11 @@ use dap_types::StartDebuggingRequestArguments; -use schemars::{r#gen::SchemaSettings, JsonSchema}; +use schemars::{JsonSchema, r#gen::SchemaSettings}; use serde::{Deserialize, Serialize}; use std::net::Ipv4Addr; use std::path::PathBuf; use util::ResultExt; -use crate::{task_template::DebugArgs, TaskTemplate, TaskTemplates, TaskType}; +use crate::{TaskTemplate, TaskTemplates, TaskType, task_template::DebugArgs}; impl Default for DebugConnectionType { fn default() -> Self { diff --git a/crates/task/src/lib.rs b/crates/task/src/lib.rs index bb96f32af9..3258728f4b 100644 --- a/crates/task/src/lib.rs +++ b/crates/task/src/lib.rs @@ -6,7 +6,7 @@ pub mod static_source; mod task_template; mod vscode_format; -use collections::{hash_map, HashMap, HashSet}; +use collections::{HashMap, HashSet, hash_map}; use gpui::SharedString; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; diff --git a/crates/task/src/static_source.rs b/crates/task/src/static_source.rs index f53c35e25a..0e7a021b06 100644 --- a/crates/task/src/static_source.rs +++ b/crates/task/src/static_source.rs @@ -2,7 +2,7 @@ use std::sync::Arc; -use futures::{channel::mpsc::UnboundedSender, StreamExt}; +use futures::{StreamExt, channel::mpsc::UnboundedSender}; use gpui::{App, AppContext}; use parking_lot::RwLock; use serde::Deserialize; diff --git a/crates/task/src/task_template.rs b/crates/task/src/task_template.rs index def5fb1a09..c78ec93885 100644 --- a/crates/task/src/task_template.rs +++ b/crates/task/src/task_template.rs @@ -1,12 +1,12 @@ use std::path::PathBuf; use util::serde::default_true; -use anyhow::{bail, Context}; +use anyhow::{Context, bail}; use collections::{HashMap, HashSet}; -use schemars::{r#gen::SchemaSettings, JsonSchema}; +use schemars::{JsonSchema, r#gen::SchemaSettings}; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; -use util::{truncate_and_remove_front, ResultExt}; +use util::{ResultExt, truncate_and_remove_front}; use crate::{ AttachConfig, ResolvedTask, RevealTarget, Shell, SpawnInTerminal, TCPHost, TaskContext, TaskId, @@ -722,9 +722,10 @@ mod tests { args: vec!["$ZED_VARIABLE".into()], ..TaskTemplate::default() }; - assert!(task - .resolve_task(TEST_ID_BASE, &TaskContext::default()) - .is_none()); + assert!( + task.resolve_task(TEST_ID_BASE, &TaskContext::default()) + .is_none() + ); } #[test] diff --git a/crates/task/src/vscode_format.rs b/crates/task/src/vscode_format.rs index c150ee807f..3e82d6abba 100644 --- a/crates/task/src/vscode_format.rs +++ b/crates/task/src/vscode_format.rs @@ -154,8 +154,8 @@ mod tests { use std::collections::HashMap; use crate::{ - vscode_format::{Command, VsCodeTaskDefinition}, TaskTemplate, TaskTemplates, VsCodeTaskFile, + vscode_format::{Command, VsCodeTaskDefinition}, }; use super::EnvVariableReplacer; diff --git a/crates/tasks_ui/src/modal.rs b/crates/tasks_ui/src/modal.rs index f058582ec4..77a1db5372 100644 --- a/crates/tasks_ui/src/modal.rs +++ b/crates/tasks_ui/src/modal.rs @@ -3,23 +3,23 @@ use std::sync::Arc; use crate::TaskContexts; use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - rems, Action, AnyElement, App, AppContext as _, Context, DismissEvent, Entity, EventEmitter, + Action, AnyElement, App, AppContext as _, Context, DismissEvent, Entity, EventEmitter, Focusable, InteractiveElement, ParentElement, Render, SharedString, Styled, Subscription, Task, - WeakEntity, Window, + WeakEntity, Window, rems, }; -use picker::{highlighted_match_with_paths::HighlightedMatch, Picker, PickerDelegate}; -use project::{task_store::TaskStore, TaskSourceKind}; +use picker::{Picker, PickerDelegate, highlighted_match_with_paths::HighlightedMatch}; +use project::{TaskSourceKind, task_store::TaskStore}; use task::{ DebugRequestType, DebugTaskDefinition, ResolvedTask, RevealTarget, TaskContext, TaskModal, TaskTemplate, TaskType, }; use ui::{ - div, h_flex, v_flex, ActiveTheme, Button, ButtonCommon, ButtonSize, Clickable, Color, - FluentBuilder as _, Icon, IconButton, IconButtonShape, IconName, IconSize, IntoElement, - KeyBinding, LabelSize, ListItem, ListItemSpacing, RenderOnce, Toggleable, Tooltip, + ActiveTheme, Button, ButtonCommon, ButtonSize, Clickable, Color, FluentBuilder as _, Icon, + IconButton, IconButtonShape, IconName, IconSize, IntoElement, KeyBinding, LabelSize, ListItem, + ListItemSpacing, RenderOnce, Toggleable, Tooltip, div, h_flex, v_flex, }; use util::ResultExt; -use workspace::{tasks::schedule_resolved_task, ModalView, Workspace}; +use workspace::{ModalView, Workspace, tasks::schedule_resolved_task}; pub use zed_actions::{Rerun, Spawn}; /// A modal used to spawn new tasks. diff --git a/crates/tasks_ui/src/tasks_ui.rs b/crates/tasks_ui/src/tasks_ui.rs index f18afa1b87..016f231b1a 100644 --- a/crates/tasks_ui/src/tasks_ui.rs +++ b/crates/tasks_ui/src/tasks_ui.rs @@ -8,7 +8,7 @@ use modal::{TaskOverrides, TasksModal}; use project::{Location, TaskContexts, Worktree}; use task::{RevealTarget, TaskContext, TaskId, TaskModal, TaskVariables, VariableName}; use workspace::tasks::schedule_task; -use workspace::{tasks::schedule_resolved_task, Start, Workspace}; +use workspace::{Start, Workspace, tasks::schedule_resolved_task}; mod modal; @@ -347,7 +347,7 @@ mod tests { use editor::Editor; use gpui::TestAppContext; use language::{Language, LanguageConfig}; - use project::{task_store::TaskStore, BasicContextProvider, FakeFs, Project}; + use project::{BasicContextProvider, FakeFs, Project, task_store::TaskStore}; use serde_json::json; use task::{TaskContext, TaskVariables, VariableName}; use ui::VisualContext; diff --git a/crates/terminal/src/mappings/mouse.rs b/crates/terminal/src/mappings/mouse.rs index bd91009a56..8c3eed8b54 100644 --- a/crates/terminal/src/mappings/mouse.rs +++ b/crates/terminal/src/mappings/mouse.rs @@ -6,7 +6,7 @@ use alacritty_terminal::grid::Dimensions; /// with modifications for our circumstances use alacritty_terminal::index::{Column as GridCol, Line as GridLine, Point as AlacPoint, Side}; use alacritty_terminal::term::TermMode; -use gpui::{px, Modifiers, MouseButton, Pixels, Point, ScrollWheelEvent}; +use gpui::{Modifiers, MouseButton, Pixels, Point, ScrollWheelEvent, px}; use crate::TerminalBounds; diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index 9668c788dc..954dbf4cb8 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -6,6 +6,7 @@ mod pty_info; pub mod terminal_settings; use alacritty_terminal::{ + Term, event::{Event as AlacTermEvent, EventListener, Notify, WindowSize}, event_loop::{EventLoop, Msg, Notifier}, grid::{Dimensions, Grid, Row, Scroll as AlacScroll}, @@ -13,22 +14,21 @@ use alacritty_terminal::{ selection::{Selection, SelectionRange, SelectionType}, sync::FairMutex, term::{ + Config, RenderableCursor, TermMode, cell::{Cell, Flags}, search::{Match, RegexIter, RegexSearch}, - Config, RenderableCursor, TermMode, }, tty::{self}, vi_mode::{ViModeCursor, ViMotion}, vte::ansi::{ ClearMode, CursorStyle as AlacCursorStyle, Handler, NamedPrivateMode, PrivateMode, }, - Term, }; -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use futures::{ - channel::mpsc::{unbounded, UnboundedReceiver, UnboundedSender}, FutureExt, + channel::mpsc::{UnboundedReceiver, UnboundedSender, unbounded}, }; use mappings::mouse::{ @@ -59,10 +59,9 @@ use std::{ use thiserror::Error; use gpui::{ - actions, black, px, AnyWindowHandle, App, AppContext as _, Bounds, ClipboardItem, Context, - EventEmitter, Hsla, Keystroke, Modifiers, MouseButton, MouseDownEvent, MouseMoveEvent, - MouseUpEvent, Pixels, Point, Rgba, ScrollWheelEvent, SharedString, Size, Task, TouchPhase, - Window, + AnyWindowHandle, App, AppContext as _, Bounds, ClipboardItem, Context, EventEmitter, Hsla, + Keystroke, Modifiers, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, + Rgba, ScrollWheelEvent, SharedString, Size, Task, TouchPhase, Window, actions, black, px, }; use crate::mappings::{colors::to_alac_rgb, keys::to_esc_str}; @@ -2146,12 +2145,12 @@ mod tests { index::{Column, Line, Point as AlacPoint}, term::cell::Cell, }; - use gpui::{bounds, point, size, Pixels, Point}; - use rand::{distributions::Alphanumeric, rngs::ThreadRng, thread_rng, Rng}; + use gpui::{Pixels, Point, bounds, point, size}; + use rand::{Rng, distributions::Alphanumeric, rngs::ThreadRng, thread_rng}; use crate::{ - content_index_for_mouse, python_extract_path_and_line, rgb_for_index, IndexedCell, - TerminalBounds, TerminalContent, + IndexedCell, TerminalBounds, TerminalContent, content_index_for_mouse, + python_extract_path_and_line, rgb_for_index, }; #[test] diff --git a/crates/terminal/src/terminal_settings.rs b/crates/terminal/src/terminal_settings.rs index cd0c6d65a1..29be1144fe 100644 --- a/crates/terminal/src/terminal_settings.rs +++ b/crates/terminal/src/terminal_settings.rs @@ -3,11 +3,11 @@ use alacritty_terminal::vte::ansi::{ }; use collections::HashMap; use gpui::{ - px, AbsoluteLength, App, FontFallbacks, FontFeatures, FontWeight, Pixels, SharedString, + AbsoluteLength, App, FontFallbacks, FontFeatures, FontWeight, Pixels, SharedString, px, }; -use schemars::{r#gen::SchemaGenerator, schema::RootSchema, JsonSchema}; +use schemars::{JsonSchema, r#gen::SchemaGenerator, schema::RootSchema}; use serde_derive::{Deserialize, Serialize}; -use settings::{add_references_to_properties, SettingsJsonSchemaParams, SettingsSources}; +use settings::{SettingsJsonSchemaParams, SettingsSources, add_references_to_properties}; use std::path::PathBuf; use task::Shell; diff --git a/crates/terminal_view/src/persistence.rs b/crates/terminal_view/src/persistence.rs index ff8a80a726..6d29630a79 100644 --- a/crates/terminal_view/src/persistence.rs +++ b/crates/terminal_view/src/persistence.rs @@ -1,9 +1,9 @@ use anyhow::Result; use async_recursion::async_recursion; use collections::HashSet; -use futures::{stream::FuturesUnordered, StreamExt as _}; +use futures::{StreamExt as _, stream::FuturesUnordered}; use gpui::{AppContext as _, AsyncWindowContext, Axis, Entity, Task, WeakEntity}; -use project::{terminals::TerminalKind, Project}; +use project::{Project, terminals::TerminalKind}; use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; use ui::{App, Context, Pixels, Window}; @@ -16,9 +16,8 @@ use workspace::{ }; use crate::{ - default_working_directory, - terminal_panel::{new_terminal_pane, TerminalPanel}, - TerminalView, + TerminalView, default_working_directory, + terminal_panel::{TerminalPanel, new_terminal_pane}, }; pub(crate) fn serialize_pane_group( diff --git a/crates/terminal_view/src/terminal_element.rs b/crates/terminal_view/src/terminal_element.rs index cbcc0a0f26..66a7b83771 100644 --- a/crates/terminal_view/src/terminal_element.rs +++ b/crates/terminal_view/src/terminal_element.rs @@ -1,27 +1,28 @@ use editor::{CursorLayout, HighlightedRange, HighlightedRangeLine}; use gpui::{ - div, fill, point, px, relative, size, AnyElement, App, AvailableSpace, Bounds, ContentMask, - Context, DispatchPhase, Element, ElementId, Entity, FocusHandle, Font, FontStyle, FontWeight, - GlobalElementId, HighlightStyle, Hitbox, Hsla, InputHandler, InteractiveElement, Interactivity, - IntoElement, LayoutId, ModifiersChangedEvent, MouseButton, MouseMoveEvent, Pixels, Point, - ShapedLine, StatefulInteractiveElement, StrikethroughStyle, Styled, TextRun, TextStyle, - UTF16Selection, UnderlineStyle, WeakEntity, WhiteSpace, Window, WindowTextSystem, + AnyElement, App, AvailableSpace, Bounds, ContentMask, Context, DispatchPhase, Element, + ElementId, Entity, FocusHandle, Font, FontStyle, FontWeight, GlobalElementId, HighlightStyle, + Hitbox, Hsla, InputHandler, InteractiveElement, Interactivity, IntoElement, LayoutId, + ModifiersChangedEvent, MouseButton, MouseMoveEvent, Pixels, Point, ShapedLine, + StatefulInteractiveElement, StrikethroughStyle, Styled, TextRun, TextStyle, UTF16Selection, + UnderlineStyle, WeakEntity, WhiteSpace, Window, WindowTextSystem, div, fill, point, px, + relative, size, }; use itertools::Itertools; use language::CursorShape; use settings::Settings; use terminal::{ + IndexedCell, Terminal, TerminalBounds, TerminalContent, alacritty_terminal::{ grid::Dimensions, index::Point as AlacPoint, - term::{cell::Flags, TermMode}, + term::{TermMode, cell::Flags}, vte::ansi::{ Color::{self as AnsiColor, Named}, CursorShape as AlacCursorShape, NamedColor, }, }, terminal_settings::TerminalSettings, - IndexedCell, Terminal, TerminalBounds, TerminalContent, }; use theme::{ActiveTheme, Theme, ThemeSettings}; use ui::{ParentElement, Tooltip}; diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index 370172cede..75f7b35e17 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -1,48 +1,47 @@ use std::{cmp, ops::ControlFlow, path::PathBuf, sync::Arc, time::Duration}; use crate::{ - default_working_directory, + TerminalView, default_working_directory, persistence::{ - deserialize_terminal_panel, serialize_pane_group, SerializedItems, SerializedTerminalPanel, + SerializedItems, SerializedTerminalPanel, deserialize_terminal_panel, serialize_pane_group, }, - TerminalView, }; use breadcrumbs::Breadcrumbs; use collections::HashMap; use db::kvp::KEY_VALUE_STORE; use futures::future::join_all; use gpui::{ - actions, Action, AnyView, App, AsyncApp, AsyncWindowContext, Context, Corner, Entity, - EventEmitter, ExternalPaths, FocusHandle, Focusable, IntoElement, ParentElement, Pixels, - Render, Styled, Task, WeakEntity, Window, + Action, AnyView, App, AsyncApp, AsyncWindowContext, Context, Corner, Entity, EventEmitter, + ExternalPaths, FocusHandle, Focusable, IntoElement, ParentElement, Pixels, Render, Styled, + Task, WeakEntity, Window, actions, }; use itertools::Itertools; -use project::{terminals::TerminalKind, Fs, Project, ProjectEntryId}; -use search::{buffer_search::DivRegistrar, BufferSearchBar}; +use project::{Fs, Project, ProjectEntryId, terminals::TerminalKind}; +use search::{BufferSearchBar, buffer_search::DivRegistrar}; use settings::Settings; use task::{RevealStrategy, RevealTarget, ShellBuilder, SpawnInTerminal, TaskId}; use terminal::{ - terminal_settings::{TerminalDockPosition, TerminalSettings}, Terminal, + terminal_settings::{TerminalDockPosition, TerminalSettings}, }; use ui::{ - prelude::*, ButtonCommon, Clickable, ContextMenu, FluentBuilder, PopoverMenu, Toggleable, - Tooltip, + ButtonCommon, Clickable, ContextMenu, FluentBuilder, PopoverMenu, Toggleable, Tooltip, + prelude::*, }; use util::{ResultExt, TryFutureExt}; use workspace::{ - dock::{DockPosition, Panel, PanelEvent, PanelHandle}, - item::SerializableItem, - move_active_item, move_item, pane, - ui::IconName, ActivateNextPane, ActivatePane, ActivatePaneDown, ActivatePaneLeft, ActivatePaneRight, ActivatePaneUp, ActivatePreviousPane, DraggedSelection, DraggedTab, ItemId, MoveItemToPane, MoveItemToPaneInDirection, NewTerminal, Pane, PaneGroup, SplitDirection, SplitDown, SplitLeft, SplitRight, SplitUp, SwapPaneDown, SwapPaneLeft, SwapPaneRight, SwapPaneUp, ToggleZoom, Workspace, + dock::{DockPosition, Panel, PanelEvent, PanelHandle}, + item::SerializableItem, + move_active_item, move_item, pane, + ui::IconName, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use zed_actions::assistant::InlineAssist; const TERMINAL_PANEL_KEY: &str = "TerminalPanel"; diff --git a/crates/terminal_view/src/terminal_scrollbar.rs b/crates/terminal_view/src/terminal_scrollbar.rs index e72a1e7419..89b63d7f7b 100644 --- a/crates/terminal_view/src/terminal_scrollbar.rs +++ b/crates/terminal_view/src/terminal_scrollbar.rs @@ -4,9 +4,9 @@ use std::{ rc::Rc, }; -use gpui::{size, Bounds, Point}; +use gpui::{Bounds, Point, size}; use terminal::Terminal; -use ui::{px, ContentSize, Pixels, ScrollableHandle}; +use ui::{ContentSize, Pixels, ScrollableHandle, px}; #[derive(Debug)] struct ScrollHandleState { diff --git a/crates/terminal_view/src/terminal_tab_tooltip.rs b/crates/terminal_view/src/terminal_tab_tooltip.rs index a8fea72c6b..2e25e4798f 100644 --- a/crates/terminal_view/src/terminal_tab_tooltip.rs +++ b/crates/terminal_view/src/terminal_tab_tooltip.rs @@ -1,5 +1,5 @@ use gpui::{IntoElement, Render}; -use ui::{prelude::*, tooltip_container, Divider}; +use ui::{Divider, prelude::*, tooltip_container}; pub struct TerminalTooltip { title: SharedString, diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs index 4f4abaae0b..4940b655aa 100644 --- a/crates/terminal_view/src/terminal_view.rs +++ b/crates/terminal_view/src/terminal_view.rs @@ -4,42 +4,42 @@ pub mod terminal_panel; pub mod terminal_scrollbar; pub mod terminal_tab_tooltip; -use editor::{actions::SelectAll, scroll::ScrollbarAutoHide, Editor, EditorSettings}; +use editor::{Editor, EditorSettings, actions::SelectAll, scroll::ScrollbarAutoHide}; use gpui::{ - anchored, deferred, div, impl_actions, AnyElement, App, DismissEvent, Entity, EventEmitter, - FocusHandle, Focusable, KeyContext, KeyDownEvent, Keystroke, MouseButton, MouseDownEvent, - Pixels, Render, ScrollWheelEvent, Stateful, Styled, Subscription, Task, WeakEntity, + AnyElement, App, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, KeyContext, + KeyDownEvent, Keystroke, MouseButton, MouseDownEvent, Pixels, Render, ScrollWheelEvent, + Stateful, Styled, Subscription, Task, WeakEntity, anchored, deferred, div, impl_actions, }; use itertools::Itertools; use persistence::TERMINAL_DB; -use project::{search::SearchQuery, terminals::TerminalKind, Entry, Metadata, Project}; +use project::{Entry, Metadata, Project, search::SearchQuery, terminals::TerminalKind}; use schemars::JsonSchema; use terminal::{ - alacritty_terminal::{ - index::Point, - term::{search::RegexSearch, TermMode}, - }, - terminal_settings::{self, CursorShape, TerminalBlink, TerminalSettings, WorkingDirectory}, Clear, Copy, Event, MaybeNavigationTarget, Paste, ScrollLineDown, ScrollLineUp, ScrollPageDown, ScrollPageUp, ScrollToBottom, ScrollToTop, ShowCharacterPalette, TaskState, TaskStatus, Terminal, TerminalBounds, ToggleViMode, + alacritty_terminal::{ + index::Point, + term::{TermMode, search::RegexSearch}, + }, + terminal_settings::{self, CursorShape, TerminalBlink, TerminalSettings, WorkingDirectory}, }; -use terminal_element::{is_blank, TerminalElement}; +use terminal_element::{TerminalElement, is_blank}; use terminal_panel::TerminalPanel; use terminal_scrollbar::TerminalScrollHandle; use terminal_tab_tooltip::TerminalTooltip; use ui::{ - h_flex, prelude::*, ContextMenu, Icon, IconName, Label, Scrollbar, ScrollbarState, Tooltip, + ContextMenu, Icon, IconName, Label, Scrollbar, ScrollbarState, Tooltip, h_flex, prelude::*, }; -use util::{debug_panic, paths::PathWithPosition, ResultExt}; +use util::{ResultExt, debug_panic, paths::PathWithPosition}; use workspace::{ + CloseActiveItem, NewCenterTerminal, NewTerminal, OpenOptions, OpenVisible, ToolbarItemLocation, + Workspace, WorkspaceId, item::{ BreadcrumbText, Item, ItemEvent, SerializableItem, TabContentParams, TabTooltipContent, }, register_serializable_item, searchable::{Direction, SearchEvent, SearchOptions, SearchableItem, SearchableItemHandle}, - CloseActiveItem, NewCenterTerminal, NewTerminal, OpenOptions, OpenVisible, ToolbarItemLocation, - Workspace, WorkspaceId, }; use anyhow::Context as _; diff --git a/crates/text/src/anchor.rs b/crates/text/src/anchor.rs index d29dfc0bb5..83a4fc8429 100644 --- a/crates/text/src/anchor.rs +++ b/crates/text/src/anchor.rs @@ -1,6 +1,6 @@ use crate::{ - locator::Locator, BufferId, BufferSnapshot, Point, PointUtf16, TextDimension, ToOffset, - ToPoint, ToPointUtf16, + BufferId, BufferSnapshot, Point, PointUtf16, TextDimension, ToOffset, ToPoint, ToPointUtf16, + locator::Locator, }; use std::{cmp::Ordering, fmt::Debug, ops::Range}; use sum_tree::Bias; diff --git a/crates/text/src/locator.rs b/crates/text/src/locator.rs index e38b9b58af..d529e60d48 100644 --- a/crates/text/src/locator.rs +++ b/crates/text/src/locator.rs @@ -1,4 +1,4 @@ -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use std::iter; use std::sync::LazyLock; diff --git a/crates/text/src/text.rs b/crates/text/src/text.rs index 98d622f547..d042ebf6d0 100644 --- a/crates/text/src/text.rs +++ b/crates/text/src/text.rs @@ -11,9 +11,9 @@ mod tests; mod undo_map; pub use anchor::*; -use anyhow::{anyhow, Context as _, Result}; -pub use clock::ReplicaId; +use anyhow::{Context as _, Result, anyhow}; use clock::LOCAL_BRANCH_REPLICA_ID; +pub use clock::ReplicaId; use collections::{HashMap, HashSet}; use locator::Locator; use operation_queue::OperationQueue; diff --git a/crates/theme/src/default_colors.rs b/crates/theme/src/default_colors.rs index 251f597eaf..0b7eeb4958 100644 --- a/crates/theme/src/default_colors.rs +++ b/crates/theme/src/default_colors.rs @@ -1,7 +1,7 @@ use gpui::{Hsla, Rgba}; -use crate::scale::{ColorScaleSet, ColorScales}; use crate::ColorScale; +use crate::scale::{ColorScaleSet, ColorScales}; use crate::{SystemColors, ThemeColors}; pub(crate) fn neutral() -> ColorScaleSet { diff --git a/crates/theme/src/fallback_themes.rs b/crates/theme/src/fallback_themes.rs index e4ce1d669f..cc91895ca0 100644 --- a/crates/theme/src/fallback_themes.rs +++ b/crates/theme/src/fallback_themes.rs @@ -1,11 +1,10 @@ use std::sync::Arc; -use gpui::{hsla, FontStyle, FontWeight, HighlightStyle, Hsla, WindowBackgroundAppearance}; +use gpui::{FontStyle, FontWeight, HighlightStyle, Hsla, WindowBackgroundAppearance, hsla}; use crate::{ - default_color_scales, AccentColors, Appearance, PlayerColors, StatusColors, - StatusColorsRefinement, SyntaxTheme, SystemColors, Theme, ThemeColors, ThemeFamily, - ThemeStyles, + AccentColors, Appearance, PlayerColors, StatusColors, StatusColorsRefinement, SyntaxTheme, + SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, default_color_scales, }; /// The default theme family for Zed. diff --git a/crates/theme/src/registry.rs b/crates/theme/src/registry.rs index 43328aaad2..f0f0776582 100644 --- a/crates/theme/src/registry.rs +++ b/crates/theme/src/registry.rs @@ -12,9 +12,9 @@ use thiserror::Error; use util::ResultExt; use crate::{ - default_icon_theme, read_icon_theme, read_user_theme, refine_theme_family, Appearance, - AppearanceContent, ChevronIcons, DirectoryIcons, IconDefinition, IconTheme, Theme, ThemeFamily, - ThemeFamilyContent, DEFAULT_ICON_THEME_NAME, + Appearance, AppearanceContent, ChevronIcons, DEFAULT_ICON_THEME_NAME, DirectoryIcons, + IconDefinition, IconTheme, Theme, ThemeFamily, ThemeFamilyContent, default_icon_theme, + read_icon_theme, read_user_theme, refine_theme_family, }; /// The metadata for a theme. diff --git a/crates/theme/src/schema.rs b/crates/theme/src/schema.rs index 52dbbc31ef..b300a2737a 100644 --- a/crates/theme/src/schema.rs +++ b/crates/theme/src/schema.rs @@ -4,9 +4,9 @@ use anyhow::Result; use gpui::{FontStyle, FontWeight, HighlightStyle, Hsla, WindowBackgroundAppearance}; use indexmap::IndexMap; use palette::FromColor; +use schemars::JsonSchema; use schemars::r#gen::SchemaGenerator; use schemars::schema::{Schema, SchemaObject}; -use schemars::JsonSchema; use serde::{Deserialize, Deserializer, Serialize}; use serde_json::Value; use serde_repr::{Deserialize_repr, Serialize_repr}; diff --git a/crates/theme/src/settings.rs b/crates/theme/src/settings.rs index 4c8d185890..99480d04a7 100644 --- a/crates/theme/src/settings.rs +++ b/crates/theme/src/settings.rs @@ -1,23 +1,23 @@ use crate::fallback_themes::zed_default_dark; use crate::{ - Appearance, IconTheme, IconThemeNotFoundError, SyntaxTheme, Theme, ThemeNotFoundError, - ThemeRegistry, ThemeStyleContent, DEFAULT_ICON_THEME_NAME, + Appearance, DEFAULT_ICON_THEME_NAME, IconTheme, IconThemeNotFoundError, SyntaxTheme, Theme, + ThemeNotFoundError, ThemeRegistry, ThemeStyleContent, }; use anyhow::Result; use derive_more::{Deref, DerefMut}; use gpui::{ - px, App, Context, Font, FontFallbacks, FontFeatures, FontStyle, FontWeight, Global, Pixels, - Subscription, Window, + App, Context, Font, FontFallbacks, FontFeatures, FontStyle, FontWeight, Global, Pixels, + Subscription, Window, px, }; use refineable::Refineable; use schemars::{ + JsonSchema, r#gen::SchemaGenerator, schema::{InstanceType, Schema, SchemaObject}, - JsonSchema, }; use serde::{Deserialize, Serialize}; use serde_json::Value; -use settings::{add_references_to_properties, Settings, SettingsJsonSchemaParams, SettingsSources}; +use settings::{Settings, SettingsJsonSchemaParams, SettingsSources, add_references_to_properties}; use std::sync::Arc; use util::ResultExt as _; diff --git a/crates/theme/src/styles/accents.rs b/crates/theme/src/styles/accents.rs index 773e3319ac..54d4be3b63 100644 --- a/crates/theme/src/styles/accents.rs +++ b/crates/theme/src/styles/accents.rs @@ -2,8 +2,8 @@ use gpui::Hsla; use serde_derive::Deserialize; use crate::{ - amber, blue, cyan, gold, grass, indigo, iris, jade, lime, orange, pink, purple, tomato, - try_parse_color, AccentContent, + AccentContent, amber, blue, cyan, gold, grass, indigo, iris, jade, lime, orange, pink, purple, + tomato, try_parse_color, }; /// A collection of colors that are used to color indent aware lines in the editor. diff --git a/crates/theme/src/styles/players.rs b/crates/theme/src/styles/players.rs index 262048f2c6..79369594b4 100644 --- a/crates/theme/src/styles/players.rs +++ b/crates/theme/src/styles/players.rs @@ -4,7 +4,7 @@ use gpui::Hsla; use serde_derive::Deserialize; use crate::{ - amber, blue, jade, lime, orange, pink, purple, red, try_parse_color, PlayerColorContent, + PlayerColorContent, amber, blue, jade, lime, orange, pink, purple, red, try_parse_color, }; #[derive(Debug, Clone, Copy, Deserialize, Default, PartialEq)] diff --git a/crates/theme/src/styles/system.rs b/crates/theme/src/styles/system.rs index 4f33711793..64dd964b79 100644 --- a/crates/theme/src/styles/system.rs +++ b/crates/theme/src/styles/system.rs @@ -1,6 +1,6 @@ #![allow(missing_docs)] -use gpui::{hsla, Hsla}; +use gpui::{Hsla, hsla}; #[derive(Clone, PartialEq)] pub struct SystemColors { diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index fd3bdb6dc0..3b5306c216 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -28,8 +28,8 @@ use anyhow::Result; use fallback_themes::apply_status_color_defaults; use fs::Fs; use gpui::{ - px, App, AssetSource, HighlightStyle, Hsla, Pixels, Refineable, SharedString, WindowAppearance, - WindowBackgroundAppearance, + App, AssetSource, HighlightStyle, Hsla, Pixels, Refineable, SharedString, WindowAppearance, + WindowBackgroundAppearance, px, }; use serde::Deserialize; use uuid::Uuid; diff --git a/crates/theme_importer/src/assets.rs b/crates/theme_importer/src/assets.rs index 85318d8ed8..6ced84ced4 100644 --- a/crates/theme_importer/src/assets.rs +++ b/crates/theme_importer/src/assets.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use gpui::{AssetSource, SharedString}; use rust_embed::RustEmbed; diff --git a/crates/theme_importer/src/vscode/converter.rs b/crates/theme_importer/src/vscode/converter.rs index a1a6c7a27c..85ebe03767 100644 --- a/crates/theme_importer/src/vscode/converter.rs +++ b/crates/theme_importer/src/vscode/converter.rs @@ -6,8 +6,8 @@ use theme::{ ThemeColorsContent, ThemeContent, ThemeStyleContent, }; -use crate::vscode::{VsCodeTheme, VsCodeTokenScope}; use crate::ThemeMetadata; +use crate::vscode::{VsCodeTheme, VsCodeTokenScope}; use super::ZedSyntaxToken; diff --git a/crates/theme_selector/src/icon_theme_selector.rs b/crates/theme_selector/src/icon_theme_selector.rs index 35fc9bab5c..fe6b9ba8ee 100644 --- a/crates/theme_selector/src/icon_theme_selector.rs +++ b/crates/theme_selector/src/icon_theme_selector.rs @@ -1,16 +1,16 @@ use fs::Fs; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{ App, Context, DismissEvent, Entity, EventEmitter, Focusable, Render, UpdateGlobal, WeakEntity, Window, }; use picker::{Picker, PickerDelegate}; -use settings::{update_settings_file, Settings as _, SettingsStore}; +use settings::{Settings as _, SettingsStore, update_settings_file}; use std::sync::Arc; use theme::{Appearance, IconTheme, ThemeMeta, ThemeRegistry, ThemeSettings}; -use ui::{prelude::*, v_flex, ListItem, ListItemSpacing}; +use ui::{ListItem, ListItemSpacing, prelude::*, v_flex}; use util::ResultExt; -use workspace::{ui::HighlightedLabel, ModalView}; +use workspace::{ModalView, ui::HighlightedLabel}; use zed_actions::{ExtensionCategoryFilter, Extensions}; pub(crate) struct IconThemeSelector { diff --git a/crates/theme_selector/src/theme_selector.rs b/crates/theme_selector/src/theme_selector.rs index f4787c6008..8494709065 100644 --- a/crates/theme_selector/src/theme_selector.rs +++ b/crates/theme_selector/src/theme_selector.rs @@ -1,18 +1,18 @@ mod icon_theme_selector; use fs::Fs; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{ - actions, App, Context, DismissEvent, Entity, EventEmitter, Focusable, Render, UpdateGlobal, - WeakEntity, Window, + App, Context, DismissEvent, Entity, EventEmitter, Focusable, Render, UpdateGlobal, WeakEntity, + Window, actions, }; use picker::{Picker, PickerDelegate}; -use settings::{update_settings_file, SettingsStore}; +use settings::{SettingsStore, update_settings_file}; use std::sync::Arc; use theme::{Appearance, Theme, ThemeMeta, ThemeRegistry, ThemeSettings}; -use ui::{prelude::*, v_flex, ListItem, ListItemSpacing}; +use ui::{ListItem, ListItemSpacing, prelude::*, v_flex}; use util::ResultExt; -use workspace::{ui::HighlightedLabel, ModalView, Workspace}; +use workspace::{ModalView, Workspace, ui::HighlightedLabel}; use zed_actions::{ExtensionCategoryFilter, Extensions}; use crate::icon_theme_selector::{IconThemeSelector, IconThemeSelectorDelegate}; diff --git a/crates/time_format/src/time_format.rs b/crates/time_format/src/time_format.rs index fe9a96b87b..7dc0702fbf 100644 --- a/crates/time_format/src/time_format.rs +++ b/crates/time_format/src/time_format.rs @@ -274,8 +274,8 @@ mod macos { use core_foundation_sys::{ base::kCFAllocatorDefault, date_formatter::{ - kCFDateFormatterMediumStyle, kCFDateFormatterNoStyle, kCFDateFormatterShortStyle, - CFDateFormatterCreate, + CFDateFormatterCreate, kCFDateFormatterMediumStyle, kCFDateFormatterNoStyle, + kCFDateFormatterShortStyle, }, locale::CFLocaleCopyCurrent, }; diff --git a/crates/title_bar/src/application_menu.rs b/crates/title_bar/src/application_menu.rs index dec281b472..5ce5bd1599 100644 --- a/crates/title_bar/src/application_menu.rs +++ b/crates/title_bar/src/application_menu.rs @@ -9,7 +9,7 @@ use schemars::JsonSchema; use serde::Deserialize; use smallvec::SmallVec; -use ui::{prelude::*, ContextMenu, PopoverMenu, PopoverMenuHandle, Tooltip}; +use ui::{ContextMenu, PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*}; #[cfg(not(target_os = "macos"))] impl_actions!(app_menu, [OpenApplicationMenu]); diff --git a/crates/title_bar/src/collab.rs b/crates/title_bar/src/collab.rs index b5cdb7acc6..20dec0e6ea 100644 --- a/crates/title_bar/src/collab.rs +++ b/crates/title_bar/src/collab.rs @@ -1,12 +1,12 @@ use std::sync::Arc; use call::{ActiveCall, ParticipantLocation, Room}; -use client::{proto::PeerId, User}; -use gpui::{actions, App, Task, Window}; -use gpui::{canvas, point, AnyElement, Hsla, IntoElement, MouseButton, Path, Styled}; +use client::{User, proto::PeerId}; +use gpui::{AnyElement, Hsla, IntoElement, MouseButton, Path, Styled, canvas, point}; +use gpui::{App, Task, Window, actions}; use rpc::proto::{self}; use theme::ActiveTheme; -use ui::{prelude::*, Avatar, AvatarAudioStatusIndicator, Facepile, TintColor, Tooltip}; +use ui::{Avatar, AvatarAudioStatusIndicator, Facepile, TintColor, Tooltip, prelude::*}; use workspace::notifications::DetachAndPromptErr; use crate::TitleBar; diff --git a/crates/title_bar/src/onboarding_banner.rs b/crates/title_bar/src/onboarding_banner.rs index 51f6bd2447..169f555f3f 100644 --- a/crates/title_bar/src/onboarding_banner.rs +++ b/crates/title_bar/src/onboarding_banner.rs @@ -1,5 +1,5 @@ use gpui::{Action, Entity, Global, Render, SharedString}; -use ui::{prelude::*, ButtonLike, Tooltip}; +use ui::{ButtonLike, Tooltip, prelude::*}; use util::ResultExt; /// Prompts the user to try newly released Zed's features diff --git a/crates/title_bar/src/platforms/platform_linux.rs b/crates/title_bar/src/platforms/platform_linux.rs index df7ccf141a..e175a391ef 100644 --- a/crates/title_bar/src/platforms/platform_linux.rs +++ b/crates/title_bar/src/platforms/platform_linux.rs @@ -1,4 +1,4 @@ -use gpui::{prelude::*, Action, MouseButton}; +use gpui::{Action, MouseButton, prelude::*}; use ui::prelude::*; diff --git a/crates/title_bar/src/platforms/platform_windows.rs b/crates/title_bar/src/platforms/platform_windows.rs index 5bc5560427..96ce6d7380 100644 --- a/crates/title_bar/src/platforms/platform_windows.rs +++ b/crates/title_bar/src/platforms/platform_windows.rs @@ -1,4 +1,4 @@ -use gpui::{prelude::*, Rgba, WindowAppearance}; +use gpui::{Rgba, WindowAppearance, prelude::*}; use ui::prelude::*; diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs index 9f5073e794..d19e973394 100644 --- a/crates/title_bar/src/title_bar.rs +++ b/crates/title_bar/src/title_bar.rs @@ -20,9 +20,9 @@ use call::ActiveCall; use client::{Client, UserStore}; use feature_flags::{FeatureFlagAppExt, ZedPro}; use gpui::{ - actions, div, px, Action, AnyElement, App, Context, Corner, Decorations, Element, Entity, - InteractiveElement, Interactivity, IntoElement, MouseButton, ParentElement, Render, Stateful, - StatefulInteractiveElement, Styled, Subscription, WeakEntity, Window, + Action, AnyElement, App, Context, Corner, Decorations, Element, Entity, InteractiveElement, + Interactivity, IntoElement, MouseButton, ParentElement, Render, Stateful, + StatefulInteractiveElement, Styled, Subscription, WeakEntity, Window, actions, div, px, }; use onboarding_banner::OnboardingBanner; use project::Project; @@ -32,11 +32,11 @@ use smallvec::SmallVec; use std::sync::Arc; use theme::ActiveTheme; use ui::{ - h_flex, prelude::*, Avatar, Button, ButtonLike, ButtonStyle, ContextMenu, Icon, IconName, - IconSize, IconWithIndicator, Indicator, PopoverMenu, Tooltip, + Avatar, Button, ButtonLike, ButtonStyle, ContextMenu, Icon, IconName, IconSize, + IconWithIndicator, Indicator, PopoverMenu, Tooltip, h_flex, prelude::*, }; use util::ResultExt; -use workspace::{notifications::NotifyResultExt, Workspace}; +use workspace::{Workspace, notifications::NotifyResultExt}; use zed_actions::{OpenBrowser, OpenRecent, OpenRemote}; pub use onboarding_banner::restore_banner; diff --git a/crates/title_bar/src/window_controls.rs b/crates/title_bar/src/window_controls.rs index a9930ebc25..a4e3ddc234 100644 --- a/crates/title_bar/src/window_controls.rs +++ b/crates/title_bar/src/window_controls.rs @@ -1,4 +1,4 @@ -use gpui::{svg, Action, Hsla}; +use gpui::{Action, Hsla, svg}; use ui::prelude::*; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)] diff --git a/crates/toolchain_selector/src/active_toolchain.rs b/crates/toolchain_selector/src/active_toolchain.rs index 4bddeb0bb8..04e2e8c19e 100644 --- a/crates/toolchain_selector/src/active_toolchain.rs +++ b/crates/toolchain_selector/src/active_toolchain.rs @@ -2,13 +2,13 @@ use std::sync::Arc; use editor::Editor; use gpui::{ - div, AsyncWindowContext, Context, Entity, IntoElement, ParentElement, Render, Subscription, - Task, WeakEntity, Window, + AsyncWindowContext, Context, Entity, IntoElement, ParentElement, Render, Subscription, Task, + WeakEntity, Window, div, }; use language::{Buffer, BufferEvent, LanguageName, Toolchain}; use project::{Project, ProjectPath, WorktreeId}; use ui::{Button, ButtonCommon, Clickable, FluentBuilder, LabelSize, SharedString, Tooltip}; -use workspace::{item::ItemHandle, StatusItemView, Workspace}; +use workspace::{StatusItemView, Workspace, item::ItemHandle}; use crate::ToolchainSelector; diff --git a/crates/toolchain_selector/src/toolchain_selector.rs b/crates/toolchain_selector/src/toolchain_selector.rs index 37afd2942b..92620b68b8 100644 --- a/crates/toolchain_selector/src/toolchain_selector.rs +++ b/crates/toolchain_selector/src/toolchain_selector.rs @@ -2,16 +2,16 @@ mod active_toolchain; pub use active_toolchain::ActiveToolchain; use editor::Editor; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{ - actions, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, - ParentElement, Render, Styled, Task, WeakEntity, Window, + App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, ParentElement, + Render, Styled, Task, WeakEntity, Window, actions, }; use language::{LanguageName, Toolchain, ToolchainList}; use picker::{Picker, PickerDelegate}; use project::{Project, ProjectPath, WorktreeId}; use std::{path::Path, sync::Arc}; -use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; +use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::{ModalView, Workspace}; diff --git a/crates/ui/src/components/avatar.rs b/crates/ui/src/components/avatar.rs index 074f0d99f4..f7badf2ef0 100644 --- a/crates/ui/src/components/avatar.rs +++ b/crates/ui/src/components/avatar.rs @@ -1,6 +1,6 @@ use crate::prelude::*; -use gpui::{img, AnyElement, Hsla, ImageSource, Img, IntoElement, Styled}; +use gpui::{AnyElement, Hsla, ImageSource, Img, IntoElement, Styled, img}; /// An element that renders a user avatar with customizable appearance options. /// diff --git a/crates/ui/src/components/button/button.rs b/crates/ui/src/components/button/button.rs index 7317d05f73..78fc882e37 100644 --- a/crates/ui/src/components/button/button.rs +++ b/crates/ui/src/components/button/button.rs @@ -1,12 +1,12 @@ -use component::{example_group_with_title, single_example, ComponentPreview}; +use component::{ComponentPreview, example_group_with_title, single_example}; use gpui::{AnyElement, AnyView, DefiniteLength}; use ui_macros::IntoComponent; -use crate::{ - prelude::*, Color, DynamicSpacing, ElevationIndex, IconPosition, KeyBinding, - KeybindingPosition, TintColor, -}; use crate::{ButtonCommon, ButtonLike, ButtonSize, ButtonStyle, IconName, IconSize, Label}; +use crate::{ + Color, DynamicSpacing, ElevationIndex, IconPosition, KeyBinding, KeybindingPosition, TintColor, + prelude::*, +}; use super::button_icon::ButtonIcon; diff --git a/crates/ui/src/components/button/button_icon.rs b/crates/ui/src/components/button/button_icon.rs index 337f10700a..6c1bab316c 100644 --- a/crates/ui/src/components/button/button_icon.rs +++ b/crates/ui/src/components/button/button_icon.rs @@ -1,4 +1,4 @@ -use crate::{prelude::*, Icon, IconName, IconSize, IconWithIndicator, Indicator}; +use crate::{Icon, IconName, IconSize, IconWithIndicator, Indicator, prelude::*}; use gpui::Hsla; /// An icon that appears within a button. diff --git a/crates/ui/src/components/button/button_like.rs b/crates/ui/src/components/button/button_like.rs index dc5aca8ca3..f44c2e8b98 100644 --- a/crates/ui/src/components/button/button_like.rs +++ b/crates/ui/src/components/button/button_like.rs @@ -1,8 +1,8 @@ -use gpui::{relative, CursorStyle, DefiniteLength, MouseButton, MouseDownEvent, MouseUpEvent}; -use gpui::{transparent_black, AnyElement, AnyView, ClickEvent, Hsla, Rems}; +use gpui::{AnyElement, AnyView, ClickEvent, Hsla, Rems, transparent_black}; +use gpui::{CursorStyle, DefiniteLength, MouseButton, MouseDownEvent, MouseUpEvent, relative}; use smallvec::SmallVec; -use crate::{prelude::*, DynamicSpacing, ElevationIndex}; +use crate::{DynamicSpacing, ElevationIndex, prelude::*}; /// A trait for buttons that can be Selected. Enables setting the [`ButtonStyle`] of a button when it is selected. pub trait SelectableButton: Toggleable { diff --git a/crates/ui/src/components/button/icon_button.rs b/crates/ui/src/components/button/icon_button.rs index 611a81f6d5..fb56980dca 100644 --- a/crates/ui/src/components/button/icon_button.rs +++ b/crates/ui/src/components/button/icon_button.rs @@ -1,7 +1,7 @@ use gpui::{AnyView, DefiniteLength, Hsla}; use super::button_like::{ButtonCommon, ButtonLike, ButtonSize, ButtonStyle}; -use crate::{prelude::*, ElevationIndex, Indicator, SelectableButton, TintColor}; +use crate::{ElevationIndex, Indicator, SelectableButton, TintColor, prelude::*}; use crate::{IconName, IconSize}; use super::button_icon::ButtonIcon; diff --git a/crates/ui/src/components/button/split_button.rs b/crates/ui/src/components/button/split_button.rs index 84b381768d..6ceeb88377 100644 --- a/crates/ui/src/components/button/split_button.rs +++ b/crates/ui/src/components/button/split_button.rs @@ -1,10 +1,10 @@ use gpui::{ - div, hsla, point, px, AnyElement, App, BoxShadow, IntoElement, ParentElement, RenderOnce, - Styled, Window, + AnyElement, App, BoxShadow, IntoElement, ParentElement, RenderOnce, Styled, Window, div, hsla, + point, px, }; use theme::ActiveTheme; -use crate::{h_flex, ElevationIndex}; +use crate::{ElevationIndex, h_flex}; use super::ButtonLike; diff --git a/crates/ui/src/components/button/toggle_button.rs b/crates/ui/src/components/button/toggle_button.rs index 7e114b989c..5cfccd8246 100644 --- a/crates/ui/src/components/button/toggle_button.rs +++ b/crates/ui/src/components/button/toggle_button.rs @@ -1,6 +1,6 @@ use gpui::{AnyView, ClickEvent}; -use crate::{prelude::*, ButtonLike, ButtonLikeRounding, ElevationIndex}; +use crate::{ButtonLike, ButtonLikeRounding, ElevationIndex, prelude::*}; /// The position of a [`ToggleButton`] within a group of buttons. #[derive(Debug, PartialEq, Eq, Clone, Copy)] diff --git a/crates/ui/src/components/content_group.rs b/crates/ui/src/components/content_group.rs index 2c5fd88847..5b26793e56 100644 --- a/crates/ui/src/components/content_group.rs +++ b/crates/ui/src/components/content_group.rs @@ -1,5 +1,5 @@ use crate::prelude::*; -use component::{example_group, single_example, ComponentPreview}; +use component::{ComponentPreview, example_group, single_example}; use gpui::{AnyElement, IntoElement, ParentElement, StyleRefinement, Styled}; use smallvec::SmallVec; diff --git a/crates/ui/src/components/context_menu.rs b/crates/ui/src/components/context_menu.rs index 2728b5f6c8..4cf73133e2 100644 --- a/crates/ui/src/components/context_menu.rs +++ b/crates/ui/src/components/context_menu.rs @@ -1,10 +1,10 @@ use crate::{ - h_flex, prelude::*, utils::WithRemSize, v_flex, Icon, IconName, IconSize, KeyBinding, Label, - List, ListItem, ListSeparator, ListSubHeader, + Icon, IconName, IconSize, KeyBinding, Label, List, ListItem, ListSeparator, ListSubHeader, + h_flex, prelude::*, utils::WithRemSize, v_flex, }; use gpui::{ - px, Action, AnyElement, App, AppContext as _, DismissEvent, Entity, EventEmitter, FocusHandle, - Focusable, IntoElement, Render, Subscription, + Action, AnyElement, App, AppContext as _, DismissEvent, Entity, EventEmitter, FocusHandle, + Focusable, IntoElement, Render, Subscription, px, }; use menu::{SelectFirst, SelectLast, SelectNext, SelectPrevious}; use settings::Settings; diff --git a/crates/ui/src/components/disclosure.rs b/crates/ui/src/components/disclosure.rs index 1bf34ad6ed..ce307e5cc2 100644 --- a/crates/ui/src/components/disclosure.rs +++ b/crates/ui/src/components/disclosure.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use gpui::{ClickEvent, CursorStyle}; -use crate::{prelude::*, Color, IconButton, IconButtonShape, IconName, IconSize}; +use crate::{Color, IconButton, IconButtonShape, IconName, IconSize, prelude::*}; #[derive(IntoElement)] pub struct Disclosure { diff --git a/crates/ui/src/components/dropdown_menu.rs b/crates/ui/src/components/dropdown_menu.rs index b057e35249..c981636670 100644 --- a/crates/ui/src/components/dropdown_menu.rs +++ b/crates/ui/src/components/dropdown_menu.rs @@ -1,6 +1,6 @@ use gpui::{ClickEvent, Corner, CursorStyle, Entity, MouseButton}; -use crate::{prelude::*, ContextMenu, PopoverMenu}; +use crate::{ContextMenu, PopoverMenu, prelude::*}; #[derive(IntoElement)] pub struct DropdownMenu { diff --git a/crates/ui/src/components/facepile.rs b/crates/ui/src/components/facepile.rs index fb610f0cbf..47be6a373d 100644 --- a/crates/ui/src/components/facepile.rs +++ b/crates/ui/src/components/facepile.rs @@ -1,4 +1,4 @@ -use crate::{prelude::*, Avatar}; +use crate::{Avatar, prelude::*}; use gpui::{AnyElement, StyleRefinement}; use smallvec::SmallVec; diff --git a/crates/ui/src/components/group.rs b/crates/ui/src/components/group.rs index f49ab9fe13..12462bb24b 100644 --- a/crates/ui/src/components/group.rs +++ b/crates/ui/src/components/group.rs @@ -1,4 +1,4 @@ -use gpui::{div, prelude::*, Div}; +use gpui::{Div, div, prelude::*}; /// Creates a horizontal group with tight, consistent spacing. /// diff --git a/crates/ui/src/components/icon.rs b/crates/ui/src/components/icon.rs index a01dc7627d..24170c1f11 100644 --- a/crates/ui/src/components/icon.rs +++ b/crates/ui/src/components/icon.rs @@ -5,11 +5,11 @@ use std::path::{Path, PathBuf}; use std::sync::Arc; pub use decorated_icon::*; -use gpui::{img, svg, AnimationElement, AnyElement, Hsla, IntoElement, Rems, Transformation}; +use gpui::{AnimationElement, AnyElement, Hsla, IntoElement, Rems, Transformation, img, svg}; pub use icon_decoration::*; pub use icons::*; -use crate::{prelude::*, Indicator}; +use crate::{Indicator, prelude::*}; #[derive(IntoElement)] pub enum AnyIcon { diff --git a/crates/ui/src/components/icon/decorated_icon.rs b/crates/ui/src/components/icon/decorated_icon.rs index fbe0a09563..99e20e6f02 100644 --- a/crates/ui/src/components/icon/decorated_icon.rs +++ b/crates/ui/src/components/icon/decorated_icon.rs @@ -1,6 +1,6 @@ use gpui::{AnyElement, IntoElement, Point}; -use crate::{prelude::*, IconDecoration, IconDecorationKind}; +use crate::{IconDecoration, IconDecorationKind, prelude::*}; #[derive(IntoElement, IntoComponent)] pub struct DecoratedIcon { diff --git a/crates/ui/src/components/icon/icon_decoration.rs b/crates/ui/src/components/icon/icon_decoration.rs index ba73e5a2cb..f7287145f6 100644 --- a/crates/ui/src/components/icon/icon_decoration.rs +++ b/crates/ui/src/components/icon/icon_decoration.rs @@ -1,4 +1,4 @@ -use gpui::{svg, Hsla, IntoElement, Point}; +use gpui::{Hsla, IntoElement, Point, svg}; use strum::{EnumIter, EnumString, IntoStaticStr}; use ui_macros::DerivePathStr; diff --git a/crates/ui/src/components/image.rs b/crates/ui/src/components/image.rs index cee5cb3538..e20433a4ae 100644 --- a/crates/ui/src/components/image.rs +++ b/crates/ui/src/components/image.rs @@ -1,7 +1,7 @@ -use gpui::{svg, App, IntoElement, Rems, RenderOnce, Size, Styled, Window}; +use gpui::{App, IntoElement, Rems, RenderOnce, Size, Styled, Window, svg}; use serde::{Deserialize, Serialize}; use strum::{EnumIter, EnumString, IntoStaticStr}; -use ui_macros::{path_str, DerivePathStr}; +use ui_macros::{DerivePathStr, path_str}; use crate::Color; diff --git a/crates/ui/src/components/indent_guides.rs b/crates/ui/src/components/indent_guides.rs index 8c99ba0d8e..3a5ba8d835 100644 --- a/crates/ui/src/components/indent_guides.rs +++ b/crates/ui/src/components/indent_guides.rs @@ -1,7 +1,7 @@ use std::{cmp::Ordering, ops::Range, rc::Rc}; use gpui::{ - fill, point, size, AnyElement, App, Bounds, Entity, Hsla, Point, UniformListDecoration, + AnyElement, App, Bounds, Entity, Hsla, Point, UniformListDecoration, fill, point, size, }; use smallvec::SmallVec; @@ -49,8 +49,13 @@ pub fn indent_guides( entity: Entity, indent_size: Pixels, colors: IndentGuideColors, - compute_indents_fn: impl Fn(&mut V, Range, &mut Window, &mut Context) -> SmallVec<[usize; 64]> - + 'static, + compute_indents_fn: impl Fn( + &mut V, + Range, + &mut Window, + &mut Context, + ) -> SmallVec<[usize; 64]> + + 'static, ) -> IndentGuides { let compute_indents_fn = Box::new(move |range, window: &mut Window, cx: &mut App| { entity.update(cx, |this, cx| compute_indents_fn(this, range, window, cx)) @@ -79,12 +84,12 @@ impl IndentGuides { mut self, entity: Entity, render_fn: impl Fn( - &mut V, - RenderIndentGuideParams, - &mut Window, - &mut App, - ) -> SmallVec<[RenderedIndentGuide; 12]> - + 'static, + &mut V, + RenderIndentGuideParams, + &mut Window, + &mut App, + ) -> SmallVec<[RenderedIndentGuide; 12]> + + 'static, ) -> Self { let render_fn = move |params, window: &mut Window, cx: &mut App| { entity.update(cx, |this, cx| render_fn(this, params, window, cx)) diff --git a/crates/ui/src/components/indicator.rs b/crates/ui/src/components/indicator.rs index c9c27fd561..693ba80c9c 100644 --- a/crates/ui/src/components/indicator.rs +++ b/crates/ui/src/components/indicator.rs @@ -1,4 +1,4 @@ -use crate::{prelude::*, AnyIcon}; +use crate::{AnyIcon, prelude::*}; #[derive(Default)] enum IndicatorKind { diff --git a/crates/ui/src/components/keybinding.rs b/crates/ui/src/components/keybinding.rs index 5f99b14298..1d3e80c4fd 100644 --- a/crates/ui/src/components/keybinding.rs +++ b/crates/ui/src/components/keybinding.rs @@ -1,8 +1,8 @@ use crate::PlatformStyle; -use crate::{h_flex, prelude::*, Icon, IconName, IconSize}; +use crate::{Icon, IconName, IconSize, h_flex, prelude::*}; use gpui::{ - relative, Action, AnyElement, App, FocusHandle, Global, IntoElement, Keystroke, Modifiers, - Window, + Action, AnyElement, App, FocusHandle, Global, IntoElement, Keystroke, Modifiers, Window, + relative, }; use itertools::Itertools; diff --git a/crates/ui/src/components/keybinding_hint.rs b/crates/ui/src/components/keybinding_hint.rs index 6fc2b50ce8..2423de5188 100644 --- a/crates/ui/src/components/keybinding_hint.rs +++ b/crates/ui/src/components/keybinding_hint.rs @@ -1,6 +1,6 @@ use crate::KeyBinding; use crate::{h_flex, prelude::*}; -use gpui::{point, AnyElement, App, BoxShadow, FontStyle, Hsla, IntoElement, Window}; +use gpui::{AnyElement, App, BoxShadow, FontStyle, Hsla, IntoElement, Window, point}; use smallvec::smallvec; use theme::Appearance; diff --git a/crates/ui/src/components/label/highlighted_label.rs b/crates/ui/src/components/label/highlighted_label.rs index 065041dae9..6362945091 100644 --- a/crates/ui/src/components/label/highlighted_label.rs +++ b/crates/ui/src/components/label/highlighted_label.rs @@ -2,7 +2,7 @@ use std::ops::Range; use gpui::{FontWeight, HighlightStyle, StyledText}; -use crate::{prelude::*, LabelCommon, LabelLike, LabelSize, LineHeightStyle}; +use crate::{LabelCommon, LabelLike, LabelSize, LineHeightStyle, prelude::*}; #[derive(IntoElement)] pub struct HighlightedLabel { diff --git a/crates/ui/src/components/label/label.rs b/crates/ui/src/components/label/label.rs index 3fc1dd2826..388984d3c9 100644 --- a/crates/ui/src/components/label/label.rs +++ b/crates/ui/src/components/label/label.rs @@ -1,4 +1,4 @@ -use crate::{prelude::*, LabelLike}; +use crate::{LabelLike, prelude::*}; use gpui::StyleRefinement; /// A struct representing a label element in the UI. diff --git a/crates/ui/src/components/list/list.rs b/crates/ui/src/components/list/list.rs index 7cd81a5164..1402b5d3d3 100644 --- a/crates/ui/src/components/list/list.rs +++ b/crates/ui/src/components/list/list.rs @@ -1,7 +1,7 @@ use gpui::AnyElement; use smallvec::SmallVec; -use crate::{prelude::*, v_flex, Label, ListHeader}; +use crate::{Label, ListHeader, prelude::*, v_flex}; pub enum EmptyMessage { Text(SharedString), diff --git a/crates/ui/src/components/list/list_header.rs b/crates/ui/src/components/list/list_header.rs index 91bb0ca76a..d64f5c7263 100644 --- a/crates/ui/src/components/list/list_header.rs +++ b/crates/ui/src/components/list/list_header.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use crate::{h_flex, prelude::*, Disclosure, Label}; +use crate::{Disclosure, Label, h_flex, prelude::*}; use gpui::{AnyElement, ClickEvent}; use settings::Settings; use theme::ThemeSettings; diff --git a/crates/ui/src/components/list/list_item.rs b/crates/ui/src/components/list/list_item.rs index 25701b6ac0..8462e99eb8 100644 --- a/crates/ui/src/components/list/list_item.rs +++ b/crates/ui/src/components/list/list_item.rs @@ -1,9 +1,9 @@ use std::sync::Arc; -use gpui::{px, AnyElement, AnyView, ClickEvent, MouseButton, MouseDownEvent, Pixels}; +use gpui::{AnyElement, AnyView, ClickEvent, MouseButton, MouseDownEvent, Pixels, px}; use smallvec::SmallVec; -use crate::{prelude::*, Disclosure}; +use crate::{Disclosure, prelude::*}; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Default)] pub enum ListItemSpacing { diff --git a/crates/ui/src/components/list/list_sub_header.rs b/crates/ui/src/components/list/list_sub_header.rs index 3cf2fd51d7..a1f04af576 100644 --- a/crates/ui/src/components/list/list_sub_header.rs +++ b/crates/ui/src/components/list/list_sub_header.rs @@ -1,5 +1,5 @@ use crate::prelude::*; -use crate::{h_flex, Icon, IconName, IconSize, Label}; +use crate::{Icon, IconName, IconSize, Label, h_flex}; #[derive(IntoElement)] pub struct ListSubHeader { diff --git a/crates/ui/src/components/modal.rs b/crates/ui/src/components/modal.rs index 1a8d8b4ed5..a05c20f1a0 100644 --- a/crates/ui/src/components/modal.rs +++ b/crates/ui/src/components/modal.rs @@ -1,6 +1,6 @@ use crate::{ - h_flex, v_flex, Clickable, Color, DynamicSpacing, Headline, HeadlineSize, IconButton, - IconButtonShape, IconName, Label, LabelCommon, LabelSize, + Clickable, Color, DynamicSpacing, Headline, HeadlineSize, IconButton, IconButtonShape, + IconName, Label, LabelCommon, LabelSize, h_flex, v_flex, }; use gpui::{prelude::FluentBuilder, *}; use smallvec::SmallVec; diff --git a/crates/ui/src/components/notification/alert_modal.rs b/crates/ui/src/components/notification/alert_modal.rs index 5685c197a2..0145b7302a 100644 --- a/crates/ui/src/components/notification/alert_modal.rs +++ b/crates/ui/src/components/notification/alert_modal.rs @@ -1,6 +1,6 @@ use crate::prelude::*; use gpui::IntoElement; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; #[derive(IntoElement, IntoComponent)] #[component(scope = "Notification")] diff --git a/crates/ui/src/components/numeric_stepper.rs b/crates/ui/src/components/numeric_stepper.rs index 2c611bde37..f9e6e88f01 100644 --- a/crates/ui/src/components/numeric_stepper.rs +++ b/crates/ui/src/components/numeric_stepper.rs @@ -1,6 +1,6 @@ use gpui::ClickEvent; -use crate::{prelude::*, IconButtonShape}; +use crate::{IconButtonShape, prelude::*}; #[derive(IntoElement)] pub struct NumericStepper { diff --git a/crates/ui/src/components/popover.rs b/crates/ui/src/components/popover.rs index 2ac0b8f5fc..24460f6d9c 100644 --- a/crates/ui/src/components/popover.rs +++ b/crates/ui/src/components/popover.rs @@ -1,7 +1,7 @@ use crate::prelude::*; use crate::v_flex; use gpui::{ - div, AnyElement, App, Element, IntoElement, ParentElement, Pixels, RenderOnce, Styled, Window, + AnyElement, App, Element, IntoElement, ParentElement, Pixels, RenderOnce, Styled, Window, div, }; use smallvec::SmallVec; diff --git a/crates/ui/src/components/popover_menu.rs b/crates/ui/src/components/popover_menu.rs index 6be332b693..f0c9e74c86 100644 --- a/crates/ui/src/components/popover_menu.rs +++ b/crates/ui/src/components/popover_menu.rs @@ -1,10 +1,10 @@ use std::{cell::RefCell, rc::Rc}; use gpui::{ - anchored, deferred, div, point, prelude::FluentBuilder, px, size, AnyElement, AnyView, App, - Bounds, Corner, DismissEvent, DispatchPhase, Element, ElementId, Entity, Focusable as _, - GlobalElementId, HitboxId, InteractiveElement, IntoElement, LayoutId, Length, ManagedView, - MouseDownEvent, ParentElement, Pixels, Point, Style, Window, + AnyElement, AnyView, App, Bounds, Corner, DismissEvent, DispatchPhase, Element, ElementId, + Entity, Focusable as _, GlobalElementId, HitboxId, InteractiveElement, IntoElement, LayoutId, + Length, ManagedView, MouseDownEvent, ParentElement, Pixels, Point, Style, Window, anchored, + deferred, div, point, prelude::FluentBuilder, px, size, }; use crate::prelude::*; diff --git a/crates/ui/src/components/right_click_menu.rs b/crates/ui/src/components/right_click_menu.rs index 9d171e6daa..72a907e2b0 100644 --- a/crates/ui/src/components/right_click_menu.rs +++ b/crates/ui/src/components/right_click_menu.rs @@ -1,10 +1,10 @@ use std::{cell::RefCell, rc::Rc}; use gpui::{ - anchored, deferred, div, px, AnyElement, App, Bounds, Corner, DismissEvent, DispatchPhase, - Element, ElementId, Entity, Focusable as _, GlobalElementId, Hitbox, InteractiveElement, - IntoElement, LayoutId, ManagedView, MouseButton, MouseDownEvent, ParentElement, Pixels, Point, - Window, + AnyElement, App, Bounds, Corner, DismissEvent, DispatchPhase, Element, ElementId, Entity, + Focusable as _, GlobalElementId, Hitbox, InteractiveElement, IntoElement, LayoutId, + ManagedView, MouseButton, MouseDownEvent, ParentElement, Pixels, Point, Window, anchored, + deferred, div, px, }; pub struct RightClickMenu { diff --git a/crates/ui/src/components/scrollbar.rs b/crates/ui/src/components/scrollbar.rs index 5e76f57da1..5756ec20cd 100644 --- a/crates/ui/src/components/scrollbar.rs +++ b/crates/ui/src/components/scrollbar.rs @@ -1,11 +1,11 @@ use std::{any::Any, cell::Cell, fmt::Debug, ops::Range, rc::Rc, sync::Arc}; -use crate::{prelude::*, px, relative, IntoElement}; +use crate::{IntoElement, prelude::*, px, relative}; use gpui::{ - point, quad, Along, App, Axis as ScrollbarAxis, BorderStyle, Bounds, ContentMask, Corners, - Edges, Element, ElementId, Entity, EntityId, GlobalElementId, Hitbox, Hsla, LayoutId, - ListState, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, ScrollHandle, - ScrollWheelEvent, Size, Style, UniformListScrollHandle, Window, + Along, App, Axis as ScrollbarAxis, BorderStyle, Bounds, ContentMask, Corners, Edges, Element, + ElementId, Entity, EntityId, GlobalElementId, Hitbox, Hsla, LayoutId, ListState, + MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, ScrollHandle, ScrollWheelEvent, + Size, Style, UniformListScrollHandle, Window, point, quad, }; pub struct Scrollbar { @@ -171,11 +171,7 @@ impl ScrollbarState { let mut current_offset = self.scroll_handle.offset().along(axis).min(px(0.)).abs().0; if let Some(adjustment) = scroll_adjustment.and_then(|adjustment| { let adjust = adjustment.along(axis).0; - if adjust < 0.0 { - Some(adjust) - } else { - None - } + if adjust < 0.0 { Some(adjust) } else { None } }) { current_offset -= adjustment; } diff --git a/crates/ui/src/components/settings_group.rs b/crates/ui/src/components/settings_group.rs index 90cd1b1627..119727533d 100644 --- a/crates/ui/src/components/settings_group.rs +++ b/crates/ui/src/components/settings_group.rs @@ -1,7 +1,7 @@ use gpui::AnyElement; use smallvec::SmallVec; -use crate::{prelude::*, ListHeader}; +use crate::{ListHeader, prelude::*}; /// A group of settings. #[derive(IntoElement)] diff --git a/crates/ui/src/components/stack.rs b/crates/ui/src/components/stack.rs index 74a5e80575..2118757548 100644 --- a/crates/ui/src/components/stack.rs +++ b/crates/ui/src/components/stack.rs @@ -1,4 +1,4 @@ -use gpui::{div, Div}; +use gpui::{Div, div}; use crate::StyledExt; diff --git a/crates/ui/src/components/stories/context_menu.rs b/crates/ui/src/components/stories/context_menu.rs index d68c26fd6a..3a04e2449e 100644 --- a/crates/ui/src/components/stories/context_menu.rs +++ b/crates/ui/src/components/stories/context_menu.rs @@ -1,8 +1,8 @@ -use gpui::{actions, Corner, Entity, Render}; +use gpui::{Corner, Entity, Render, actions}; use story::Story; use crate::prelude::*; -use crate::{right_click_menu, ContextMenu, Label}; +use crate::{ContextMenu, Label, right_click_menu}; actions!(context_menu, [PrintCurrentDate, PrintBestFood]); diff --git a/crates/ui/src/components/stories/disclosure.rs b/crates/ui/src/components/stories/disclosure.rs index eb5a56cb95..6227351921 100644 --- a/crates/ui/src/components/stories/disclosure.rs +++ b/crates/ui/src/components/stories/disclosure.rs @@ -1,8 +1,8 @@ use gpui::Render; use story::Story; -use crate::prelude::*; use crate::Disclosure; +use crate::prelude::*; pub struct DisclosureStory; diff --git a/crates/ui/src/components/stories/icon_button.rs b/crates/ui/src/components/stories/icon_button.rs index 6aae32cbae..f396a31b29 100644 --- a/crates/ui/src/components/stories/icon_button.rs +++ b/crates/ui/src/components/stories/icon_button.rs @@ -1,8 +1,8 @@ use gpui::Render; use story::{Story, StoryItem, StorySection}; -use crate::{prelude::*, IconButtonShape, Tooltip}; use crate::{IconButton, IconName}; +use crate::{IconButtonShape, Tooltip, prelude::*}; pub struct IconButtonStory; diff --git a/crates/ui/src/components/stories/keybinding.rs b/crates/ui/src/components/stories/keybinding.rs index 2e2b952a4d..c2b5fde059 100644 --- a/crates/ui/src/components/stories/keybinding.rs +++ b/crates/ui/src/components/stories/keybinding.rs @@ -3,7 +3,7 @@ use gpui::Render; use itertools::Itertools; use story::Story; -use crate::{prelude::*, KeyBinding}; +use crate::{KeyBinding, prelude::*}; pub struct KeybindingStory; diff --git a/crates/ui/src/components/stories/list.rs b/crates/ui/src/components/stories/list.rs index ff45e14179..4d0bf6486f 100644 --- a/crates/ui/src/components/stories/list.rs +++ b/crates/ui/src/components/stories/list.rs @@ -1,8 +1,8 @@ use gpui::Render; use story::Story; -use crate::{prelude::*, ListHeader, ListSeparator, ListSubHeader}; use crate::{List, ListItem}; +use crate::{ListHeader, ListSeparator, ListSubHeader, prelude::*}; pub struct ListStory; diff --git a/crates/ui/src/components/stories/list_header.rs b/crates/ui/src/components/stories/list_header.rs index c9756ec258..67e9ecd0be 100644 --- a/crates/ui/src/components/stories/list_header.rs +++ b/crates/ui/src/components/stories/list_header.rs @@ -1,7 +1,7 @@ use gpui::Render; use story::Story; -use crate::{prelude::*, IconButton}; +use crate::{IconButton, prelude::*}; use crate::{IconName, ListHeader}; pub struct ListHeaderStory; diff --git a/crates/ui/src/components/stories/list_item.rs b/crates/ui/src/components/stories/list_item.rs index 6ab7b9ac1e..9edf4b75a7 100644 --- a/crates/ui/src/components/stories/list_item.rs +++ b/crates/ui/src/components/stories/list_item.rs @@ -1,7 +1,7 @@ use gpui::Render; use story::Story; -use crate::{prelude::*, Avatar}; +use crate::{Avatar, prelude::*}; use crate::{IconName, ListItem}; const OVERFLOWING_TEXT: &str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mauris ligula, luctus vel dignissim eu, vestibulum sed libero. Sed at convallis velit."; diff --git a/crates/ui/src/components/stories/tab.rs b/crates/ui/src/components/stories/tab.rs index b5899be5c1..f23052a63e 100644 --- a/crates/ui/src/components/stories/tab.rs +++ b/crates/ui/src/components/stories/tab.rs @@ -3,7 +3,7 @@ use std::cmp::Ordering; use gpui::Render; use story::Story; -use crate::{prelude::*, IconButtonShape, TabPosition}; +use crate::{IconButtonShape, TabPosition, prelude::*}; use crate::{Indicator, Tab}; pub struct TabStory; diff --git a/crates/ui/src/components/stories/tab_bar.rs b/crates/ui/src/components/stories/tab_bar.rs index 2137ee797b..30f0d4b2bd 100644 --- a/crates/ui/src/components/stories/tab_bar.rs +++ b/crates/ui/src/components/stories/tab_bar.rs @@ -1,7 +1,7 @@ use gpui::Render; use story::Story; -use crate::{prelude::*, Tab, TabBar, TabPosition}; +use crate::{Tab, TabBar, TabPosition, prelude::*}; pub struct TabBarStory; diff --git a/crates/ui/src/components/stories/toggle_button.rs b/crates/ui/src/components/stories/toggle_button.rs index 017ec8b255..772c920a25 100644 --- a/crates/ui/src/components/stories/toggle_button.rs +++ b/crates/ui/src/components/stories/toggle_button.rs @@ -1,7 +1,7 @@ use gpui::Render; use story::{Story, StoryItem, StorySection}; -use crate::{prelude::*, ToggleButton}; +use crate::{ToggleButton, prelude::*}; pub struct ToggleButtonStory; diff --git a/crates/ui/src/components/tab_bar.rs b/crates/ui/src/components/tab_bar.rs index cd6781be59..692e0433bc 100644 --- a/crates/ui/src/components/tab_bar.rs +++ b/crates/ui/src/components/tab_bar.rs @@ -1,8 +1,8 @@ use gpui::{AnyElement, ScrollHandle}; use smallvec::SmallVec; -use crate::prelude::*; use crate::Tab; +use crate::prelude::*; #[derive(IntoElement)] pub struct TabBar { diff --git a/crates/ui/src/components/table.rs b/crates/ui/src/components/table.rs index e097961358..59bd5c390e 100644 --- a/crates/ui/src/components/table.rs +++ b/crates/ui/src/components/table.rs @@ -1,5 +1,5 @@ -use crate::{prelude::*, Indicator}; -use gpui::{div, AnyElement, FontWeight, IntoElement, Length}; +use crate::{Indicator, prelude::*}; +use gpui::{AnyElement, FontWeight, IntoElement, Length, div}; /// A table component #[derive(IntoElement, IntoComponent)] diff --git a/crates/ui/src/components/toggle.rs b/crates/ui/src/components/toggle.rs index 666bff99fe..debd97f715 100644 --- a/crates/ui/src/components/toggle.rs +++ b/crates/ui/src/components/toggle.rs @@ -1,11 +1,11 @@ use gpui::{ - div, hsla, prelude::*, AnyElement, AnyView, ElementId, Hsla, IntoElement, Styled, Window, + AnyElement, AnyView, ElementId, Hsla, IntoElement, Styled, Window, div, hsla, prelude::*, }; use std::sync::Arc; use crate::utils::is_light; -use crate::{prelude::*, ElevationIndex, KeyBinding}; use crate::{Color, Icon, IconName, ToggleState}; +use crate::{ElevationIndex, KeyBinding, prelude::*}; // TODO: Checkbox, CheckboxWithLabel, and Switch could all be // restructured to use a ToggleLike, similar to Button/Buttonlike, Label/Labellike diff --git a/crates/ui/src/components/tooltip.rs b/crates/ui/src/components/tooltip.rs index f630c8d722..b962b9167d 100644 --- a/crates/ui/src/components/tooltip.rs +++ b/crates/ui/src/components/tooltip.rs @@ -3,7 +3,7 @@ use settings::Settings; use theme::ThemeSettings; use crate::prelude::*; -use crate::{h_flex, v_flex, Color, KeyBinding, Label, LabelSize, StyledExt}; +use crate::{Color, KeyBinding, Label, LabelSize, StyledExt, h_flex, v_flex}; #[derive(IntoComponent)] pub struct Tooltip { diff --git a/crates/ui/src/prelude.rs b/crates/ui/src/prelude.rs index 54551daffb..2592e464af 100644 --- a/crates/ui/src/prelude.rs +++ b/crates/ui/src/prelude.rs @@ -2,32 +2,32 @@ pub use gpui::prelude::*; pub use gpui::{ - div, px, relative, rems, AbsoluteLength, AnyElement, App, Context, DefiniteLength, Div, - Element, ElementId, InteractiveElement, ParentElement, Pixels, Rems, RenderOnce, SharedString, - Styled, Window, + AbsoluteLength, AnyElement, App, Context, DefiniteLength, Div, Element, ElementId, + InteractiveElement, ParentElement, Pixels, Rems, RenderOnce, SharedString, Styled, Window, div, + px, relative, rems, }; pub use component::{ - example_group, example_group_with_title, single_example, ComponentPreview, ComponentScope, + ComponentPreview, ComponentScope, example_group, example_group_with_title, single_example, }; pub use ui_macros::IntoComponent; +pub use crate::DynamicSpacing; pub use crate::animation::{AnimationDirection, AnimationDuration, DefaultAnimations}; -pub use crate::styles::{rems_from_px, vh, vw, PlatformStyle, StyledTypography, TextSize}; +pub use crate::styles::{PlatformStyle, StyledTypography, TextSize, rems_from_px, vh, vw}; pub use crate::traits::clickable::*; pub use crate::traits::disableable::*; pub use crate::traits::fixed::*; pub use crate::traits::styled_ext::*; pub use crate::traits::toggleable::*; pub use crate::traits::visible_on_hover::*; -pub use crate::DynamicSpacing; -pub use crate::{h_container, h_flex, v_container, v_flex}; -pub use crate::{ - h_group, h_group_lg, h_group_sm, h_group_xl, v_group, v_group_lg, v_group_sm, v_group_xl, -}; pub use crate::{Button, ButtonSize, ButtonStyle, IconButton, SelectableButton}; pub use crate::{ButtonCommon, Color}; pub use crate::{Headline, HeadlineSize}; pub use crate::{Icon, IconName, IconPosition, IconSize}; pub use crate::{Label, LabelCommon, LabelSize, LineHeightStyle}; +pub use crate::{h_container, h_flex, v_container, v_flex}; +pub use crate::{ + h_group, h_group_lg, h_group_sm, h_group_xl, v_group, v_group_lg, v_group_sm, v_group_xl, +}; pub use theme::ActiveTheme; diff --git a/crates/ui/src/styles/animation.rs b/crates/ui/src/styles/animation.rs index d15a6c9f4c..a4d5ba145d 100644 --- a/crates/ui/src/styles/animation.rs +++ b/crates/ui/src/styles/animation.rs @@ -1,4 +1,4 @@ -use crate::{prelude::*, ContentGroup}; +use crate::{ContentGroup, prelude::*}; use gpui::{AnimationElement, AnimationExt, Styled}; use std::time::Duration; diff --git a/crates/ui/src/styles/elevation.rs b/crates/ui/src/styles/elevation.rs index aea91c8d5f..5967a8f6b8 100644 --- a/crates/ui/src/styles/elevation.rs +++ b/crates/ui/src/styles/elevation.rs @@ -1,7 +1,7 @@ use std::fmt::{self, Display, Formatter}; -use gpui::{hsla, point, px, App, BoxShadow, Hsla}; -use smallvec::{smallvec, SmallVec}; +use gpui::{App, BoxShadow, Hsla, hsla, point, px}; +use smallvec::{SmallVec, smallvec}; use theme::{ActiveTheme, Appearance}; /// Today, elevation is primarily used to add shadows to elements, and set the correct background for elements like buttons. diff --git a/crates/ui/src/styles/spacing.rs b/crates/ui/src/styles/spacing.rs index 221d3bc774..c6629f5d88 100644 --- a/crates/ui/src/styles/spacing.rs +++ b/crates/ui/src/styles/spacing.rs @@ -1,4 +1,4 @@ -use gpui::{px, rems, App, Pixels, Rems}; +use gpui::{App, Pixels, Rems, px, rems}; use settings::Settings; use theme::{ThemeSettings, UiDensity}; use ui_macros::derive_dynamic_spacing; diff --git a/crates/ui/src/styles/typography.rs b/crates/ui/src/styles/typography.rs index 09146fe67b..c57d157c1a 100644 --- a/crates/ui/src/styles/typography.rs +++ b/crates/ui/src/styles/typography.rs @@ -1,12 +1,12 @@ use crate::prelude::*; use gpui::{ - div, rems, AnyElement, App, IntoElement, ParentElement, Rems, RenderOnce, SharedString, Styled, - Window, + AnyElement, App, IntoElement, ParentElement, Rems, RenderOnce, SharedString, Styled, Window, + div, rems, }; use settings::Settings; use theme::{ActiveTheme, ThemeSettings}; -use crate::{rems_from_px, Color}; +use crate::{Color, rems_from_px}; /// Extends [`gpui::Styled`] with typography-related styling methods. pub trait StyledTypography: Styled + Sized { diff --git a/crates/ui/src/styles/units.rs b/crates/ui/src/styles/units.rs index aae4137534..c859b459c6 100644 --- a/crates/ui/src/styles/units.rs +++ b/crates/ui/src/styles/units.rs @@ -1,4 +1,4 @@ -use gpui::{rems, Length, Rems, Window}; +use gpui::{Length, Rems, Window, rems}; /// The base size of a rem, in pixels. pub const BASE_REM_SIZE_IN_PX: f32 = 16.; diff --git a/crates/ui/src/tests/path_str.rs b/crates/ui/src/tests/path_str.rs index 6c1545ec71..90598d6eb4 100644 --- a/crates/ui/src/tests/path_str.rs +++ b/crates/ui/src/tests/path_str.rs @@ -3,7 +3,7 @@ #[cfg(test)] mod tests { use strum::EnumString; - use ui_macros::{path_str, DerivePathStr}; + use ui_macros::{DerivePathStr, path_str}; #[test] fn test_derive_path_str_with_prefix() { diff --git a/crates/ui/src/traits/styled_ext.rs b/crates/ui/src/traits/styled_ext.rs index 57729b64c1..1365abf6fd 100644 --- a/crates/ui/src/traits/styled_ext.rs +++ b/crates/ui/src/traits/styled_ext.rs @@ -1,7 +1,7 @@ -use gpui::{hsla, App, Styled}; +use gpui::{App, Styled, hsla}; -use crate::prelude::*; use crate::ElevationIndex; +use crate::prelude::*; fn elevated(this: E, cx: &App, index: ElevationIndex) -> E { this.bg(cx.theme().colors().elevated_surface_background) diff --git a/crates/ui/src/utils/with_rem_size.rs b/crates/ui/src/utils/with_rem_size.rs index 1c98747c08..59fcc45823 100644 --- a/crates/ui/src/utils/with_rem_size.rs +++ b/crates/ui/src/utils/with_rem_size.rs @@ -1,7 +1,7 @@ use gpui::{ - div, AnyElement, App, Bounds, Div, DivFrameState, Element, ElementId, GlobalElementId, Hitbox, + AnyElement, App, Bounds, Div, DivFrameState, Element, ElementId, GlobalElementId, Hitbox, InteractiveElement as _, IntoElement, LayoutId, ParentElement, Pixels, StyleRefinement, Styled, - Window, + Window, div, }; /// An element that sets a particular rem size for its children. diff --git a/crates/ui_macros/src/derive_component.rs b/crates/ui_macros/src/derive_component.rs index d49b45675f..128759e420 100644 --- a/crates/ui_macros/src/derive_component.rs +++ b/crates/ui_macros/src/derive_component.rs @@ -1,7 +1,7 @@ use convert_case::{Case, Casing}; use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, DeriveInput, Lit, Meta, MetaList, MetaNameValue, NestedMeta}; +use syn::{DeriveInput, Lit, Meta, MetaList, MetaNameValue, NestedMeta, parse_macro_input}; pub fn derive_into_component(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput); diff --git a/crates/ui_macros/src/derive_path_str.rs b/crates/ui_macros/src/derive_path_str.rs index 3988bc0c5c..e17471fb18 100644 --- a/crates/ui_macros/src/derive_path_str.rs +++ b/crates/ui_macros/src/derive_path_str.rs @@ -1,7 +1,7 @@ use convert_case::{Case, Casing}; use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, Attribute, Data, DeriveInput, Lit, Meta, NestedMeta}; +use syn::{Attribute, Data, DeriveInput, Lit, Meta, NestedMeta, parse_macro_input}; pub fn derive_path_str(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput); diff --git a/crates/ui_macros/src/dynamic_spacing.rs b/crates/ui_macros/src/dynamic_spacing.rs index a8890aca6b..6f9744e94c 100644 --- a/crates/ui_macros/src/dynamic_spacing.rs +++ b/crates/ui_macros/src/dynamic_spacing.rs @@ -1,7 +1,7 @@ use proc_macro::TokenStream; use quote::{format_ident, quote}; use syn::{ - parse::Parse, parse::ParseStream, parse_macro_input, punctuated::Punctuated, LitInt, Token, + LitInt, Token, parse::Parse, parse::ParseStream, parse_macro_input, punctuated::Punctuated, }; struct DynamicSpacingInput { diff --git a/crates/ui_prompt/src/ui_prompt.rs b/crates/ui_prompt/src/ui_prompt.rs index 780a94cff3..a4602c95f0 100644 --- a/crates/ui_prompt/src/ui_prompt.rs +++ b/crates/ui_prompt/src/ui_prompt.rs @@ -1,14 +1,15 @@ use gpui::{ - div, App, AppContext as _, Context, Entity, EventEmitter, FocusHandle, Focusable, FontWeight, + App, AppContext as _, Context, Entity, EventEmitter, FocusHandle, Focusable, FontWeight, InteractiveElement, IntoElement, ParentElement, PromptHandle, PromptLevel, PromptResponse, Refineable, Render, RenderablePromptHandle, SharedString, Styled, TextStyleRefinement, Window, + div, }; use markdown::{Markdown, MarkdownStyle}; use settings::{Settings, SettingsStore}; use theme::ThemeSettings; use ui::{ - h_flex, v_flex, ActiveTheme, ButtonCommon, ButtonStyle, Clickable, ElevationIndex, - FluentBuilder, LabelSize, StyledExt, TintColor, + ActiveTheme, ButtonCommon, ButtonStyle, Clickable, ElevationIndex, FluentBuilder, LabelSize, + StyledExt, TintColor, h_flex, v_flex, }; use workspace::WorkspaceSettings; diff --git a/crates/util/src/fs.rs b/crates/util/src/fs.rs index d6baf9364b..92292d56ca 100644 --- a/crates/util/src/fs.rs +++ b/crates/util/src/fs.rs @@ -1,5 +1,5 @@ use crate::ResultExt; -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use async_fs as fs; use futures_lite::StreamExt; use std::path::{Path, PathBuf}; diff --git a/crates/util/src/util.rs b/crates/util/src/util.rs index 9c8efb5bb2..e1917de303 100644 --- a/crates/util/src/util.rs +++ b/crates/util/src/util.rs @@ -25,7 +25,7 @@ use std::{ use unicase::UniCase; #[cfg(unix)] -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; pub use take_until::*; #[cfg(any(test, feature = "test-support"))] @@ -727,7 +727,7 @@ pub fn defer(f: F) -> Deferred { #[cfg(any(test, feature = "test-support"))] mod rng { - use rand::{seq::SliceRandom, Rng}; + use rand::{Rng, seq::SliceRandom}; pub struct RandomCharIter { rng: T, simple_text: bool, diff --git a/crates/util_macros/src/util_macros.rs b/crates/util_macros/src/util_macros.rs index df48be8c99..ebe3517d56 100644 --- a/crates/util_macros/src/util_macros.rs +++ b/crates/util_macros/src/util_macros.rs @@ -2,7 +2,7 @@ use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, LitStr}; +use syn::{LitStr, parse_macro_input}; /// This macro replaces the path separator `/` with `\` for Windows. /// But if the target OS is not Windows, the path is returned as is. diff --git a/crates/vim/src/change_list.rs b/crates/vim/src/change_list.rs index 25bcfc20be..baa72dbc1f 100644 --- a/crates/vim/src/change_list.rs +++ b/crates/vim/src/change_list.rs @@ -1,9 +1,9 @@ use editor::{ - display_map::ToDisplayPoint, movement, scroll::Autoscroll, Anchor, Bias, Direction, Editor, + Anchor, Bias, Direction, Editor, display_map::ToDisplayPoint, movement, scroll::Autoscroll, }; -use gpui::{actions, Context, Window}; +use gpui::{Context, Window, actions}; -use crate::{state::Mode, Vim}; +use crate::{Vim, state::Mode}; actions!(vim, [ChangeListOlder, ChangeListNewer]); diff --git a/crates/vim/src/command.rs b/crates/vim/src/command.rs index b31bbbd326..5989b1e8ed 100644 --- a/crates/vim/src/command.rs +++ b/crates/vim/src/command.rs @@ -1,13 +1,13 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::HashMap; use command_palette_hooks::CommandInterceptResult; use editor::{ + Bias, Editor, ToPoint, actions::{SortLinesCaseInsensitive, SortLinesCaseSensitive}, display_map::ToDisplayPoint, scroll::Autoscroll, - Bias, Editor, ToPoint, }; -use gpui::{actions, impl_internal_actions, Action, App, AppContext as _, Context, Global, Window}; +use gpui::{Action, App, AppContext as _, Context, Global, Window, actions, impl_internal_actions}; use itertools::Itertools; use language::Point; use multi_buffer::MultiBufferRow; @@ -27,19 +27,19 @@ use std::{ use task::{HideStrategy, RevealStrategy, SpawnInTerminal, TaskId}; use ui::ActiveTheme; use util::ResultExt; -use workspace::{notifications::NotifyResultExt, SaveIntent}; +use workspace::{SaveIntent, notifications::NotifyResultExt}; use zed_actions::RevealTarget; use crate::{ + ToggleMarksView, ToggleRegistersView, Vim, motion::{EndOfDocument, Motion, MotionKind, StartOfDocument}, normal::{ - search::{FindCommand, ReplaceCommand, Replacement}, JoinLines, + search::{FindCommand, ReplaceCommand, Replacement}, }, object::Object, state::{Mark, Mode}, visual::VisualDeleteLine, - ToggleMarksView, ToggleRegistersView, Vim, }; #[derive(Clone, Debug, PartialEq)] diff --git a/crates/vim/src/digraph.rs b/crates/vim/src/digraph.rs index f8e7ece1a0..9852b51ade 100644 --- a/crates/vim/src/digraph.rs +++ b/crates/vim/src/digraph.rs @@ -2,13 +2,13 @@ use std::sync::Arc; use collections::HashMap; use editor::Editor; -use gpui::{impl_actions, App, Context, Keystroke, KeystrokeEvent, Window}; +use gpui::{App, Context, Keystroke, KeystrokeEvent, Window, impl_actions}; use schemars::JsonSchema; use serde::Deserialize; use settings::Settings; use std::sync::LazyLock; -use crate::{state::Operator, Vim, VimSettings}; +use crate::{Vim, VimSettings, state::Operator}; mod default; @@ -229,9 +229,9 @@ mod test { use settings::SettingsStore; use crate::{ + VimSettings, state::Mode, test::{NeovimBackedTestContext, VimTestContext}, - VimSettings, }; #[gpui::test] diff --git a/crates/vim/src/helix.rs b/crates/vim/src/helix.rs index cc91c9bf53..33b73ae1a7 100644 --- a/crates/vim/src/helix.rs +++ b/crates/vim/src/helix.rs @@ -1,10 +1,10 @@ -use editor::{movement, scroll::Autoscroll, DisplayPoint, Editor}; -use gpui::{actions, Action}; +use editor::{DisplayPoint, Editor, movement, scroll::Autoscroll}; +use gpui::{Action, actions}; use gpui::{Context, Window}; use language::{CharClassifier, CharKind}; use crate::motion::MotionKind; -use crate::{motion::Motion, state::Mode, Vim}; +use crate::{Vim, motion::Motion, state::Mode}; actions!(vim, [HelixNormalAfter, HelixDelete]); diff --git a/crates/vim/src/indent.rs b/crates/vim/src/indent.rs index 83b4e3cdaa..3f0ed5251f 100644 --- a/crates/vim/src/indent.rs +++ b/crates/vim/src/indent.rs @@ -1,6 +1,6 @@ -use crate::{motion::Motion, object::Object, state::Mode, Vim}; +use crate::{Vim, motion::Motion, object::Object, state::Mode}; use collections::HashMap; -use editor::{display_map::ToDisplayPoint, Bias, Editor}; +use editor::{Bias, Editor, display_map::ToDisplayPoint}; use gpui::actions; use gpui::{Context, Window}; use language::SelectionGoal; diff --git a/crates/vim/src/insert.rs b/crates/vim/src/insert.rs index 22c2d52475..550d5b57fd 100644 --- a/crates/vim/src/insert.rs +++ b/crates/vim/src/insert.rs @@ -1,6 +1,6 @@ -use crate::{state::Mode, Vim}; -use editor::{scroll::Autoscroll, Bias, Editor}; -use gpui::{actions, Action, Context, Window}; +use crate::{Vim, state::Mode}; +use editor::{Bias, Editor, scroll::Autoscroll}; +use gpui::{Action, Context, Window, actions}; use language::SelectionGoal; actions!(vim, [NormalBefore, TemporaryNormal]); diff --git a/crates/vim/src/mode_indicator.rs b/crates/vim/src/mode_indicator.rs index 9bd37478bc..d54b270074 100644 --- a/crates/vim/src/mode_indicator.rs +++ b/crates/vim/src/mode_indicator.rs @@ -1,6 +1,6 @@ -use gpui::{div, Context, Element, Entity, Render, Subscription, WeakEntity, Window}; +use gpui::{Context, Element, Entity, Render, Subscription, WeakEntity, Window, div}; use ui::text_for_keystrokes; -use workspace::{item::ItemHandle, ui::prelude::*, StatusItemView}; +use workspace::{StatusItemView, item::ItemHandle, ui::prelude::*}; use crate::{Vim, VimEvent, VimGlobals}; diff --git a/crates/vim/src/motion.rs b/crates/vim/src/motion.rs index 5614865419..afec9fe0aa 100644 --- a/crates/vim/src/motion.rs +++ b/crates/vim/src/motion.rs @@ -1,12 +1,12 @@ use editor::{ + Anchor, Bias, DisplayPoint, Editor, RowExt, ToOffset, ToPoint, display_map::{DisplayRow, DisplaySnapshot, FoldPoint, ToDisplayPoint}, movement::{ - self, find_boundary, find_preceding_boundary_display_point, FindRange, TextLayoutDetails, + self, FindRange, TextLayoutDetails, find_boundary, find_preceding_boundary_display_point, }, scroll::Autoscroll, - Anchor, Bias, DisplayPoint, Editor, RowExt, ToOffset, ToPoint, }; -use gpui::{action_with_deprecated_aliases, actions, impl_actions, px, Context, Window}; +use gpui::{Context, Window, action_with_deprecated_aliases, actions, impl_actions, px}; use language::{CharKind, Point, Selection, SelectionGoal}; use multi_buffer::MultiBufferRow; use schemars::JsonSchema; @@ -15,10 +15,10 @@ use std::ops::Range; use workspace::searchable::Direction; use crate::{ + Vim, normal::mark, state::{Mode, Operator}, surrounds::SurroundsType, - Vim, }; #[derive(Clone, Copy, Debug, PartialEq, Eq)] diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rs index 693785005b..40fee8fe13 100644 --- a/crates/vim/src/normal.rs +++ b/crates/vim/src/normal.rs @@ -15,21 +15,21 @@ use std::collections::HashMap; use std::sync::Arc; use crate::{ + Vim, indent::IndentDirection, - motion::{self, first_non_whitespace, next_line_end, right, Motion}, + motion::{self, Motion, first_non_whitespace, next_line_end, right}, object::Object, state::{Mark, Mode, Operator}, surrounds::SurroundsType, - Vim, }; use case::CaseTarget; use collections::BTreeSet; -use editor::scroll::Autoscroll; use editor::Anchor; use editor::Bias; use editor::Editor; +use editor::scroll::Autoscroll; use editor::{display_map::ToDisplayPoint, movement}; -use gpui::{actions, Context, Window}; +use gpui::{Context, Window, actions}; use language::{Point, SelectionGoal, ToPoint}; use log::error; use multi_buffer::MultiBufferRow; @@ -630,10 +630,9 @@ mod test { use settings::SettingsStore; use crate::{ - motion, + VimSettings, motion, state::Mode::{self}, test::{NeovimBackedTestContext, VimTestContext}, - VimSettings, }; #[gpui::test] diff --git a/crates/vim/src/normal/case.rs b/crates/vim/src/normal/case.rs index 72501895bc..8e6aa5f44d 100644 --- a/crates/vim/src/normal/case.rs +++ b/crates/vim/src/normal/case.rs @@ -5,11 +5,11 @@ use language::{Bias, Point, SelectionGoal}; use multi_buffer::MultiBufferRow; use crate::{ + Vim, motion::Motion, normal::{ChangeCase, ConvertToLowerCase, ConvertToUpperCase}, object::Object, state::Mode, - Vim, }; pub enum CaseTarget { diff --git a/crates/vim/src/normal/change.rs b/crates/vim/src/normal/change.rs index 1a04cf6311..199ac8b0c7 100644 --- a/crates/vim/src/normal/change.rs +++ b/crates/vim/src/normal/change.rs @@ -1,14 +1,14 @@ use crate::{ + Vim, motion::{self, Motion, MotionKind}, object::Object, state::Mode, - Vim, }; use editor::{ + Bias, DisplayPoint, display_map::{DisplaySnapshot, ToDisplayPoint}, movement::TextLayoutDetails, scroll::Autoscroll, - Bias, DisplayPoint, }; use gpui::{Context, Window}; use language::Selection; diff --git a/crates/vim/src/normal/delete.rs b/crates/vim/src/normal/delete.rs index 76aa47da33..afd6bc402c 100644 --- a/crates/vim/src/normal/delete.rs +++ b/crates/vim/src/normal/delete.rs @@ -1,13 +1,13 @@ use crate::{ + Vim, motion::{Motion, MotionKind}, object::Object, - Vim, }; use collections::{HashMap, HashSet}; use editor::{ + Bias, DisplayPoint, display_map::{DisplaySnapshot, ToDisplayPoint}, scroll::Autoscroll, - Bias, DisplayPoint, }; use gpui::{Context, Window}; use language::{Point, Selection}; diff --git a/crates/vim/src/normal/increment.rs b/crates/vim/src/normal/increment.rs index f404004f95..194a5c8803 100644 --- a/crates/vim/src/normal/increment.rs +++ b/crates/vim/src/normal/increment.rs @@ -1,11 +1,11 @@ -use editor::{scroll::Autoscroll, Editor, MultiBufferSnapshot, ToOffset, ToPoint}; -use gpui::{impl_actions, Context, Window}; +use editor::{Editor, MultiBufferSnapshot, ToOffset, ToPoint, scroll::Autoscroll}; +use gpui::{Context, Window, impl_actions}; use language::{Bias, Point}; use schemars::JsonSchema; use serde::Deserialize; use std::ops::Range; -use crate::{state::Mode, Vim}; +use crate::{Vim, state::Mode}; const BOOLEAN_PAIRS: &[(&str, &str)] = &[("true", "false"), ("yes", "no"), ("on", "off")]; diff --git a/crates/vim/src/normal/mark.rs b/crates/vim/src/normal/mark.rs index f873e4a6d5..bc31d237f8 100644 --- a/crates/vim/src/normal/mark.rs +++ b/crates/vim/src/normal/mark.rs @@ -1,10 +1,10 @@ use std::{ops::Range, path::Path, sync::Arc}; use editor::{ + Anchor, Bias, DisplayPoint, Editor, MultiBuffer, display_map::{DisplaySnapshot, ToDisplayPoint}, movement, scroll::Autoscroll, - Anchor, Bias, DisplayPoint, Editor, MultiBuffer, }; use gpui::{Context, Entity, EntityId, UpdateGlobal, Window}; use language::SelectionGoal; @@ -13,9 +13,9 @@ use ui::App; use workspace::OpenOptions; use crate::{ + Vim, motion::{self, Motion}, state::{Mark, Mode, VimGlobals}, - Vim, }; impl Vim { diff --git a/crates/vim/src/normal/paste.rs b/crates/vim/src/normal/paste.rs index 13305062b6..3f3e27c457 100644 --- a/crates/vim/src/normal/paste.rs +++ b/crates/vim/src/normal/paste.rs @@ -1,15 +1,15 @@ -use editor::{display_map::ToDisplayPoint, movement, scroll::Autoscroll, DisplayPoint, RowExt}; -use gpui::{impl_actions, Context, Window}; +use editor::{DisplayPoint, RowExt, display_map::ToDisplayPoint, movement, scroll::Autoscroll}; +use gpui::{Context, Window, impl_actions}; use language::{Bias, SelectionGoal}; use schemars::JsonSchema; use serde::Deserialize; use std::cmp; use crate::{ + Vim, motion::{Motion, MotionKind}, object::Object, state::{Mode, Register}, - Vim, }; #[derive(Clone, Deserialize, JsonSchema, PartialEq)] @@ -283,15 +283,15 @@ impl Vim { #[cfg(test)] mod test { use crate::{ + UseSystemClipboard, VimSettings, state::{Mode, Register}, test::{NeovimBackedTestContext, VimTestContext}, - UseSystemClipboard, VimSettings, }; use gpui::ClipboardItem; use indoc::indoc; use language::{ - language_settings::{AllLanguageSettings, LanguageSettingsContent}, LanguageName, + language_settings::{AllLanguageSettings, LanguageSettingsContent}, }; use settings::SettingsStore; diff --git a/crates/vim/src/normal/repeat.rs b/crates/vim/src/normal/repeat.rs index 6206688267..1ffda0b9d9 100644 --- a/crates/vim/src/normal/repeat.rs +++ b/crates/vim/src/normal/repeat.rs @@ -1,14 +1,14 @@ use std::{cell::RefCell, rc::Rc}; use crate::{ + Vim, insert::NormalBefore, motion::Motion, normal::InsertBefore, state::{Mode, Operator, RecordedSelection, ReplayableAction, VimGlobals}, - Vim, }; use editor::Editor; -use gpui::{actions, Action, App, Context, Window}; +use gpui::{Action, App, Context, Window, actions}; use workspace::Workspace; actions!(vim, [Repeat, EndRepeat, ToggleRecord, ReplayLastRecording]); diff --git a/crates/vim/src/normal/scroll.rs b/crates/vim/src/normal/scroll.rs index a7ae62741c..0b87a3b345 100644 --- a/crates/vim/src/normal/scroll.rs +++ b/crates/vim/src/normal/scroll.rs @@ -1,10 +1,10 @@ use crate::Vim; use editor::{ + DisplayPoint, Editor, EditorSettings, display_map::{DisplayRow, ToDisplayPoint}, scroll::ScrollAmount, - DisplayPoint, Editor, EditorSettings, }; -use gpui::{actions, Context, Window}; +use gpui::{Context, Window, actions}; use language::Bias; use settings::Settings; @@ -163,7 +163,7 @@ mod test { test::{NeovimBackedTestContext, VimTestContext}, }; use editor::{EditorSettings, ScrollBeyondLastLine}; - use gpui::{point, px, size, AppContext as _}; + use gpui::{AppContext as _, point, px, size}; use indoc::indoc; use language::Point; use settings::SettingsStore; diff --git a/crates/vim/src/normal/search.rs b/crates/vim/src/normal/search.rs index fb79be3195..11818ce8a9 100644 --- a/crates/vim/src/normal/search.rs +++ b/crates/vim/src/normal/search.rs @@ -1,18 +1,18 @@ use editor::Editor; -use gpui::{actions, impl_actions, impl_internal_actions, Context, Window}; +use gpui::{Context, Window, actions, impl_actions, impl_internal_actions}; use language::Point; use schemars::JsonSchema; -use search::{buffer_search, BufferSearchBar, SearchOptions}; +use search::{BufferSearchBar, SearchOptions, buffer_search}; use serde_derive::Deserialize; use std::{iter::Peekable, str::Chars, time::Duration}; use util::serde::default_true; use workspace::{notifications::NotifyResultExt, searchable::Direction}; use crate::{ + Vim, command::CommandRange, motion::Motion, state::{Mode, SearchState}, - Vim, }; #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq)] @@ -590,7 +590,7 @@ mod test { test::{NeovimBackedTestContext, VimTestContext}, }; use editor::EditorSettings; - use editor::{display_map::DisplayRow, DisplayPoint}; + use editor::{DisplayPoint, display_map::DisplayRow}; use indoc::indoc; use search::BufferSearchBar; diff --git a/crates/vim/src/normal/substitute.rs b/crates/vim/src/normal/substitute.rs index 55214613c4..78c9ec5b3f 100644 --- a/crates/vim/src/normal/substitute.rs +++ b/crates/vim/src/normal/substitute.rs @@ -1,10 +1,10 @@ -use editor::{movement, Editor}; -use gpui::{actions, Context, Window}; +use editor::{Editor, movement}; +use gpui::{Context, Window, actions}; use language::Point; use crate::{ - motion::{Motion, MotionKind}, Mode, Vim, + motion::{Motion, MotionKind}, }; actions!(vim, [Substitute, SubstituteLine]); diff --git a/crates/vim/src/normal/toggle_comments.rs b/crates/vim/src/normal/toggle_comments.rs index f20efaa04b..363215ffe2 100644 --- a/crates/vim/src/normal/toggle_comments.rs +++ b/crates/vim/src/normal/toggle_comments.rs @@ -1,6 +1,6 @@ -use crate::{motion::Motion, object::Object, Vim}; +use crate::{Vim, motion::Motion, object::Object}; use collections::HashMap; -use editor::{display_map::ToDisplayPoint, Bias}; +use editor::{Bias, display_map::ToDisplayPoint}; use gpui::{Context, Window}; use language::SelectionGoal; diff --git a/crates/vim/src/normal/yank.rs b/crates/vim/src/normal/yank.rs index 5647367432..0ec19f654b 100644 --- a/crates/vim/src/normal/yank.rs +++ b/crates/vim/src/normal/yank.rs @@ -1,10 +1,10 @@ use std::{ops::Range, time::Duration}; use crate::{ + Vim, VimSettings, motion::{Motion, MotionKind}, object::Object, state::{Mode, Register}, - Vim, VimSettings, }; use collections::HashMap; use editor::{ClipboardSelection, Editor}; diff --git a/crates/vim/src/object.rs b/crates/vim/src/object.rs index 7a7fcae0cf..c54a3daa45 100644 --- a/crates/vim/src/object.rs +++ b/crates/vim/src/object.rs @@ -1,16 +1,16 @@ use std::ops::Range; use crate::{ + Vim, motion::right, state::{Mode, Operator}, - Vim, }; use editor::{ + Bias, DisplayPoint, Editor, ToOffset, display_map::{DisplaySnapshot, ToDisplayPoint}, movement::{self, FindRange}, - Bias, DisplayPoint, Editor, ToOffset, }; -use gpui::{actions, impl_actions, Window}; +use gpui::{Window, actions, impl_actions}; use itertools::Itertools; use language::{BufferSnapshot, CharKind, Point, Selection, TextObject, TreeSitterOptions}; use multi_buffer::MultiBufferRow; diff --git a/crates/vim/src/replace.rs b/crates/vim/src/replace.rs index 714ff9d80f..26437550a1 100644 --- a/crates/vim/src/replace.rs +++ b/crates/vim/src/replace.rs @@ -1,14 +1,14 @@ use crate::{ + Vim, motion::{self, Motion}, object::Object, state::Mode, - Vim, }; use editor::{ - display_map::ToDisplayPoint, scroll::Autoscroll, Anchor, Bias, Editor, EditorSnapshot, - ToOffset, ToPoint, + Anchor, Bias, Editor, EditorSnapshot, ToOffset, ToPoint, display_map::ToDisplayPoint, + scroll::Autoscroll, }; -use gpui::{actions, Context, Window}; +use gpui::{Context, Window, actions}; use language::{Point, SelectionGoal}; use std::ops::Range; use std::sync::Arc; diff --git a/crates/vim/src/rewrap.rs b/crates/vim/src/rewrap.rs index a62e0ab58e..f7f234c742 100644 --- a/crates/vim/src/rewrap.rs +++ b/crates/vim/src/rewrap.rs @@ -1,7 +1,7 @@ -use crate::{motion::Motion, object::Object, state::Mode, Vim}; +use crate::{Vim, motion::Motion, object::Object, state::Mode}; use collections::HashMap; -use editor::{display_map::ToDisplayPoint, scroll::Autoscroll, Bias, Editor, RewrapOptions}; -use gpui::{actions, Context, Window}; +use editor::{Bias, Editor, RewrapOptions, display_map::ToDisplayPoint, scroll::Autoscroll}; +use gpui::{Context, Window, actions}; use language::SelectionGoal; actions!(vim, [Rewrap]); diff --git a/crates/vim/src/state.rs b/crates/vim/src/state.rs index 1f6383167b..d982d42211 100644 --- a/crates/vim/src/state.rs +++ b/crates/vim/src/state.rs @@ -2,8 +2,8 @@ use crate::command::command_interceptor; use crate::motion::MotionKind; use crate::normal::repeat::Replayer; use crate::surrounds::SurroundsType; -use crate::{motion::Motion, object::Object}; use crate::{ToggleMarksView, ToggleRegistersView, UseSystemClipboard, Vim, VimAddon, VimSettings}; +use crate::{motion::Motion, object::Object}; use anyhow::Result; use collections::HashMap; use command_palette_hooks::{CommandPaletteFilter, CommandPaletteInterceptor}; @@ -28,8 +28,8 @@ use std::{fmt::Display, ops::Range, sync::Arc}; use text::{Bias, ToPoint}; use theme::ThemeSettings; use ui::{ - h_flex, rems, ActiveTheme, Context, Div, FluentBuilder, KeyBinding, ParentElement, - SharedString, Styled, StyledTypography, Window, + ActiveTheme, Context, Div, FluentBuilder, KeyBinding, ParentElement, SharedString, Styled, + StyledTypography, Window, h_flex, rems, }; use util::ResultExt; use workspace::searchable::Direction; diff --git a/crates/vim/src/surrounds.rs b/crates/vim/src/surrounds.rs index 8a902ddea6..3c450292e1 100644 --- a/crates/vim/src/surrounds.rs +++ b/crates/vim/src/surrounds.rs @@ -1,10 +1,10 @@ use crate::{ + Vim, motion::{self, Motion}, object::Object, state::Mode, - Vim, }; -use editor::{movement, scroll::Autoscroll, Bias}; +use editor::{Bias, movement, scroll::Autoscroll}; use gpui::{Context, Window}; use language::BracketPair; @@ -544,7 +544,7 @@ mod test { use gpui::KeyBinding; use indoc::indoc; - use crate::{state::Mode, test::VimTestContext, PushAddSurrounds}; + use crate::{PushAddSurrounds, state::Mode, test::VimTestContext}; #[gpui::test] async fn test_add_surrounds(cx: &mut gpui::TestAppContext) { diff --git a/crates/vim/src/test.rs b/crates/vim/src/test.rs index 4dd301b0e3..5e84b32d60 100644 --- a/crates/vim/src/test.rs +++ b/crates/vim/src/test.rs @@ -7,8 +7,8 @@ use std::time::Duration; use collections::HashMap; use command_palette::CommandPalette; use editor::{ - actions::DeleteLine, display_map::DisplayRow, test::editor_test_context::EditorTestContext, - DisplayPoint, Editor, EditorMode, MultiBuffer, + DisplayPoint, Editor, EditorMode, MultiBuffer, actions::DeleteLine, display_map::DisplayRow, + test::editor_test_context::EditorTestContext, }; use futures::StreamExt; use gpui::{KeyBinding, Modifiers, MouseButton, TestAppContext}; @@ -21,7 +21,7 @@ use indoc::indoc; use search::BufferSearchBar; use workspace::WorkspaceSettings; -use crate::{insert::NormalBefore, motion, state::Mode, PushSneak, PushSneakBackward}; +use crate::{PushSneak, PushSneakBackward, insert::NormalBefore, motion, state::Mode}; #[gpui::test] async fn test_initially_disabled(cx: &mut gpui::TestAppContext) { @@ -228,7 +228,9 @@ async fn test_escape_command_palette(cx: &mut gpui::TestAppContext) { cx.set_state("aˇbc\n", Mode::Normal); cx.simulate_keystrokes("i cmd-shift-p"); - assert!(cx.workspace(|workspace, _, cx| workspace.active_modal::(cx).is_some())); + assert!( + cx.workspace(|workspace, _, cx| workspace.active_modal::(cx).is_some()) + ); cx.simulate_keystrokes("escape"); cx.run_until_parked(); assert!( diff --git a/crates/vim/src/test/neovim_backed_test_context.rs b/crates/vim/src/test/neovim_backed_test_context.rs index 963335f88d..271da1b291 100644 --- a/crates/vim/src/test/neovim_backed_test_context.rs +++ b/crates/vim/src/test/neovim_backed_test_context.rs @@ -1,4 +1,4 @@ -use gpui::{px, size, AppContext as _, UpdateGlobal}; +use gpui::{AppContext as _, UpdateGlobal, px, size}; use indoc::indoc; use settings::SettingsStore; use std::{ @@ -9,7 +9,7 @@ use std::{ use language::language_settings::{AllLanguageSettings, SoftWrap}; use util::test::marked_text_offsets; -use super::{neovim_connection::NeovimConnection, VimTestContext}; +use super::{VimTestContext, neovim_connection::NeovimConnection}; use crate::state::{Mode, VimGlobals}; pub struct NeovimBackedTestContext { diff --git a/crates/vim/src/test/neovim_connection.rs b/crates/vim/src/test/neovim_connection.rs index a0a2343bdf..46ea261cd6 100644 --- a/crates/vim/src/test/neovim_connection.rs +++ b/crates/vim/src/test/neovim_connection.rs @@ -17,7 +17,7 @@ use language::Point; #[cfg(feature = "neovim")] use nvim_rs::{ - create::tokio::new_child_cmd, error::LoopError, Handler, Neovim, UiAttachOptions, Value, + Handler, Neovim, UiAttachOptions, Value, create::tokio::new_child_cmd, error::LoopError, }; #[cfg(feature = "neovim")] use parking_lot::ReentrantMutex; diff --git a/crates/vim/src/test/vim_test_context.rs b/crates/vim/src/test/vim_test_context.rs index e163ba499a..32e8de3af5 100644 --- a/crates/vim/src/test/vim_test_context.rs +++ b/crates/vim/src/test/vim_test_context.rs @@ -2,7 +2,7 @@ use std::ops::{Deref, DerefMut}; use editor::test::editor_lsp_test_context::EditorLspTestContext; use gpui::{Context, Entity, SemanticVersion, UpdateGlobal}; -use search::{project_search::ProjectSearchBar, BufferSearchBar}; +use search::{BufferSearchBar, project_search::ProjectSearchBar}; use crate::{state::Operator, *}; diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rs index c4f9f11005..99ec321d57 100644 --- a/crates/vim/src/vim.rs +++ b/crates/vim/src/vim.rs @@ -22,12 +22,12 @@ mod visual; use anyhow::Result; use collections::HashMap; use editor::{ - movement::{self, FindRange}, Anchor, Bias, Editor, EditorEvent, EditorMode, EditorSettings, ToPoint, + movement::{self, FindRange}, }; use gpui::{ - actions, impl_actions, Action, App, AppContext, Axis, Context, Entity, EventEmitter, - KeyContext, KeystrokeEvent, Render, Subscription, Task, WeakEntity, Window, + Action, App, AppContext, Axis, Context, Entity, EventEmitter, KeyContext, KeystrokeEvent, + Render, Subscription, Task, WeakEntity, Window, actions, impl_actions, }; use insert::{NormalBefore, TemporaryNormal}; use language::{CharKind, CursorShape, Point, Selection, SelectionGoal, TransactionId}; @@ -38,12 +38,12 @@ use object::Object; use schemars::JsonSchema; use serde::Deserialize; use serde_derive::Serialize; -use settings::{update_settings_file, Settings, SettingsSources, SettingsStore}; +use settings::{Settings, SettingsSources, SettingsStore, update_settings_file}; use state::{Mode, Operator, RecordedSelection, SearchState, VimGlobals}; use std::{mem, ops::Range, sync::Arc}; use surrounds::SurroundsType; use theme::ThemeSettings; -use ui::{px, IntoElement, SharedString}; +use ui::{IntoElement, SharedString, px}; use vim_mode_setting::VimModeSetting; use workspace::{self, Pane, Workspace}; diff --git a/crates/vim/src/visual.rs b/crates/vim/src/visual.rs index 1c1e7a4017..6fcbf74970 100644 --- a/crates/vim/src/visual.rs +++ b/crates/vim/src/visual.rs @@ -2,12 +2,12 @@ use std::sync::Arc; use collections::HashMap; use editor::{ + Bias, DisplayPoint, Editor, ToOffset, display_map::{DisplaySnapshot, ToDisplayPoint}, movement, scroll::Autoscroll, - Bias, DisplayPoint, Editor, ToOffset, }; -use gpui::{actions, Context, Window}; +use gpui::{Context, Window, actions}; use language::{Point, Selection, SelectionGoal}; use multi_buffer::MultiBufferRow; use search::BufferSearchBar; @@ -15,10 +15,10 @@ use util::ResultExt; use workspace::searchable::Direction; use crate::{ - motion::{first_non_whitespace, next_line_end, start_of_line, Motion, MotionKind}, + Vim, + motion::{Motion, MotionKind, first_non_whitespace, next_line_end, start_of_line}, object::Object, state::{Mark, Mode, Operator}, - Vim, }; actions!( diff --git a/crates/welcome/src/base_keymap_picker.rs b/crates/welcome/src/base_keymap_picker.rs index 031b6a97af..c0c7c1999e 100644 --- a/crates/welcome/src/base_keymap_picker.rs +++ b/crates/welcome/src/base_keymap_picker.rs @@ -1,16 +1,16 @@ use super::base_keymap_setting::BaseKeymap; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{ - actions, App, Context, DismissEvent, Entity, EventEmitter, Focusable, Render, Task, WeakEntity, - Window, + App, Context, DismissEvent, Entity, EventEmitter, Focusable, Render, Task, WeakEntity, Window, + actions, }; use picker::{Picker, PickerDelegate}; use project::Fs; -use settings::{update_settings_file, Settings}; +use settings::{Settings, update_settings_file}; use std::sync::Arc; -use ui::{prelude::*, ListItem, ListItemSpacing}; +use ui::{ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; -use workspace::{ui::HighlightedLabel, ModalView, Workspace}; +use workspace::{ModalView, Workspace, ui::HighlightedLabel}; actions!(welcome, [ToggleBaseKeymapSelector]); diff --git a/crates/welcome/src/multibuffer_hint.rs b/crates/welcome/src/multibuffer_hint.rs index 5ba6b8fe47..ed20200619 100644 --- a/crates/welcome/src/multibuffer_hint.rs +++ b/crates/welcome/src/multibuffer_hint.rs @@ -1,10 +1,10 @@ use std::collections::HashSet; -use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::OnceLock; +use std::sync::atomic::{AtomicUsize, Ordering}; use db::kvp::KEY_VALUE_STORE; use gpui::{App, EntityId, EventEmitter, Subscription}; -use ui::{prelude::*, IconButtonShape, Tooltip}; +use ui::{IconButtonShape, Tooltip, prelude::*}; use workspace::item::{ItemEvent, ItemHandle}; use workspace::{ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView}; diff --git a/crates/welcome/src/welcome.rs b/crates/welcome/src/welcome.rs index fa2b37e8f7..aa69517c9f 100644 --- a/crates/welcome/src/welcome.rs +++ b/crates/welcome/src/welcome.rs @@ -2,21 +2,22 @@ mod base_keymap_picker; mod base_keymap_setting; mod multibuffer_hint; -use client::{telemetry::Telemetry, TelemetrySettings}; +use client::{TelemetrySettings, telemetry::Telemetry}; use db::kvp::KEY_VALUE_STORE; use gpui::{ - actions, svg, Action, App, Context, Entity, EventEmitter, FocusHandle, Focusable, - InteractiveElement, ParentElement, Render, Styled, Subscription, Task, WeakEntity, Window, + Action, App, Context, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, + ParentElement, Render, Styled, Subscription, Task, WeakEntity, Window, actions, svg, }; -use language::language_settings::{all_language_settings, EditPredictionProvider}; +use language::language_settings::{EditPredictionProvider, all_language_settings}; use settings::{Settings, SettingsStore}; use std::sync::Arc; -use ui::{prelude::*, CheckboxWithLabel, ElevationIndex, Tooltip}; +use ui::{CheckboxWithLabel, ElevationIndex, Tooltip, prelude::*}; use vim_mode_setting::VimModeSetting; use workspace::{ + AppState, Welcome, Workspace, WorkspaceId, dock::DockPosition, item::{Item, ItemEvent}, - open_new, AppState, Welcome, Workspace, WorkspaceId, + open_new, }; pub use base_keymap_setting::BaseKeymap; diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rs index a7696777eb..ddd509466f 100644 --- a/crates/workspace/src/dock.rs +++ b/crates/workspace/src/dock.rs @@ -1,18 +1,19 @@ use crate::persistence::model::DockData; -use crate::{status_bar::StatusItemView, Workspace}; use crate::{DraggedDock, Event, ModalLayer, Pane}; +use crate::{Workspace, status_bar::StatusItemView}; use anyhow::Context as _; use client::proto; use gpui::{ - deferred, div, px, Action, AnyView, App, Axis, Context, Corner, Entity, EntityId, EventEmitter, - FocusHandle, Focusable, IntoElement, KeyContext, MouseButton, MouseDownEvent, MouseUpEvent, - ParentElement, Render, SharedString, StyleRefinement, Styled, Subscription, WeakEntity, Window, + Action, AnyView, App, Axis, Context, Corner, Entity, EntityId, EventEmitter, FocusHandle, + Focusable, IntoElement, KeyContext, MouseButton, MouseDownEvent, MouseUpEvent, ParentElement, + Render, SharedString, StyleRefinement, Styled, Subscription, WeakEntity, Window, deferred, div, + px, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use settings::SettingsStore; use std::sync::Arc; -use ui::{h_flex, ContextMenu, Divider, DividerColor, IconButton, Tooltip}; +use ui::{ContextMenu, Divider, DividerColor, IconButton, Tooltip, h_flex}; use ui::{prelude::*, right_click_menu}; pub(crate) const RESIZE_HANDLE_SIZE: Pixels = Pixels(6.); @@ -930,7 +931,7 @@ impl StatusItemView for PanelButtons { #[cfg(any(test, feature = "test-support"))] pub mod test { use super::*; - use gpui::{actions, div, App, Context, Window}; + use gpui::{App, Context, Window, actions, div}; pub struct TestPanel { pub position: DockPosition, diff --git a/crates/workspace/src/item.rs b/crates/workspace/src/item.rs index 47e7e917dd..0cf241ca8c 100644 --- a/crates/workspace/src/item.rs +++ b/crates/workspace/src/item.rs @@ -1,17 +1,17 @@ use crate::{ + DelayedDebouncedEditAction, FollowableViewRegistry, ItemNavHistory, SerializableItemRegistry, + ToolbarItemLocation, ViewId, Workspace, WorkspaceId, pane::{self, Pane}, persistence::model::ItemId, searchable::SearchableItemHandle, workspace_settings::{AutosaveSetting, WorkspaceSettings}, - DelayedDebouncedEditAction, FollowableViewRegistry, ItemNavHistory, SerializableItemRegistry, - ToolbarItemLocation, ViewId, Workspace, WorkspaceId, }; use anyhow::Result; use client::{ - proto::{self, PeerId}, Client, + proto::{self, PeerId}, }; -use futures::{channel::mpsc, StreamExt}; +use futures::{StreamExt, channel::mpsc}; use gpui::{ Action, AnyElement, AnyView, App, Context, Entity, EntityId, EventEmitter, FocusHandle, Focusable, Font, HighlightStyle, Pixels, Point, Render, SharedString, Task, WeakEntity, Window, diff --git a/crates/workspace/src/notifications.rs b/crates/workspace/src/notifications.rs index 42c35c3077..3f17b50c39 100644 --- a/crates/workspace/src/notifications.rs +++ b/crates/workspace/src/notifications.rs @@ -1,13 +1,13 @@ use crate::{Toast, Workspace}; use gpui::{ - svg, AnyView, App, AppContext as _, AsyncWindowContext, ClipboardItem, Context, DismissEvent, - Entity, EventEmitter, FocusHandle, Focusable, PromptLevel, Render, ScrollHandle, Task, + AnyView, App, AppContext as _, AsyncWindowContext, ClipboardItem, Context, DismissEvent, + Entity, EventEmitter, FocusHandle, Focusable, PromptLevel, Render, ScrollHandle, Task, svg, }; use parking_lot::Mutex; use std::ops::Deref; use std::sync::{Arc, LazyLock}; use std::{any::TypeId, time::Duration}; -use ui::{prelude::*, Tooltip}; +use ui::{Tooltip, prelude::*}; use util::ResultExt; #[derive(Default)] @@ -408,8 +408,8 @@ pub mod simple_message_notification { use std::sync::Arc; use gpui::{ - div, AnyElement, DismissEvent, EventEmitter, FocusHandle, Focusable, ParentElement, Render, - SharedString, Styled, + AnyElement, DismissEvent, EventEmitter, FocusHandle, Focusable, ParentElement, Render, + SharedString, Styled, div, }; use ui::prelude::*; @@ -770,7 +770,7 @@ pub trait NotifyResultExt { type Ok; fn notify_err(self, workspace: &mut Workspace, cx: &mut Context) - -> Option; + -> Option; fn notify_async_err(self, cx: &mut AsyncWindowContext) -> Option; diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 29f0f0a4ad..71c03d8998 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1,4 +1,7 @@ use crate::{ + CloseWindow, NewFile, NewTerminal, OpenInTerminal, OpenOptions, OpenTerminal, OpenVisible, + SplitDirection, ToggleFileFinder, ToggleProjectSymbols, ToggleZoom, Workspace, + WorkspaceItemBuilder, item::{ ActivateOnClose, ClosePosition, Item, ItemHandle, ItemSettings, PreviewTabsSettings, ProjectItemKind, ShowCloseButton, ShowDiagnostics, TabContentParams, TabTooltipContent, @@ -8,19 +11,16 @@ use crate::{ notifications::NotifyResultExt, toolbar::Toolbar, workspace_settings::{AutosaveSetting, TabBarSettings, WorkspaceSettings}, - CloseWindow, NewFile, NewTerminal, OpenInTerminal, OpenOptions, OpenTerminal, OpenVisible, - SplitDirection, ToggleFileFinder, ToggleProjectSymbols, ToggleZoom, Workspace, - WorkspaceItemBuilder, }; use anyhow::Result; use collections::{BTreeSet, HashMap, HashSet, VecDeque}; -use futures::{stream::FuturesUnordered, StreamExt}; +use futures::{StreamExt, stream::FuturesUnordered}; use gpui::{ - actions, anchored, deferred, impl_actions, prelude::*, Action, AnyElement, App, - AsyncWindowContext, ClickEvent, ClipboardItem, Context, Corner, Div, DragMoveEvent, Entity, - EntityId, EventEmitter, ExternalPaths, FocusHandle, FocusOutEvent, Focusable, KeyContext, - MouseButton, MouseDownEvent, NavigationDirection, Pixels, Point, PromptLevel, Render, - ScrollHandle, Subscription, Task, WeakEntity, WeakFocusHandle, Window, + Action, AnyElement, App, AsyncWindowContext, ClickEvent, ClipboardItem, Context, Corner, Div, + DragMoveEvent, Entity, EntityId, EventEmitter, ExternalPaths, FocusHandle, FocusOutEvent, + Focusable, KeyContext, MouseButton, MouseDownEvent, NavigationDirection, Pixels, Point, + PromptLevel, Render, ScrollHandle, Subscription, Task, WeakEntity, WeakFocusHandle, Window, + actions, anchored, deferred, impl_actions, prelude::*, }; use itertools::Itertools; use language::DiagnosticSeverity; @@ -36,18 +36,18 @@ use std::{ path::PathBuf, rc::Rc, sync::{ - atomic::{AtomicUsize, Ordering}, Arc, + atomic::{AtomicUsize, Ordering}, }, }; use theme::ThemeSettings; use ui::{ - prelude::*, right_click_menu, ButtonSize, Color, ContextMenu, ContextMenuEntry, - ContextMenuItem, DecoratedIcon, IconButton, IconButtonShape, IconDecoration, - IconDecorationKind, IconName, IconSize, Indicator, Label, PopoverMenu, PopoverMenuHandle, Tab, - TabBar, TabPosition, Tooltip, + ButtonSize, Color, ContextMenu, ContextMenuEntry, ContextMenuItem, DecoratedIcon, IconButton, + IconButtonShape, IconDecoration, IconDecorationKind, IconName, IconSize, Indicator, Label, + PopoverMenu, PopoverMenuHandle, Tab, TabBar, TabPosition, Tooltip, prelude::*, + right_click_menu, }; -use util::{debug_panic, maybe, truncate_and_remove_front, ResultExt}; +use util::{ResultExt, debug_panic, maybe, truncate_and_remove_front}; /// A selected entry in e.g. project panel. #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -3701,8 +3701,8 @@ mod tests { let pane = workspace.update(cx, |workspace, _| workspace.active_pane().clone()); pane.update_in(cx, |pane, window, cx| { - assert!(pane - .close_active_item( + assert!( + pane.close_active_item( &CloseActiveItem { save_intent: None, close_pinned: false @@ -3710,7 +3710,8 @@ mod tests { window, cx ) - .is_none()) + .is_none() + ) }); } diff --git a/crates/workspace/src/pane_group.rs b/crates/workspace/src/pane_group.rs index ca8d12ebcc..e094d93641 100644 --- a/crates/workspace/src/pane_group.rs +++ b/crates/workspace/src/pane_group.rs @@ -1,15 +1,15 @@ use crate::{ + AppState, FollowerState, Pane, Workspace, WorkspaceSettings, pane_group::element::pane_axis, workspace_settings::{PaneSplitDirectionHorizontal, PaneSplitDirectionVertical}, - AppState, FollowerState, Pane, Workspace, WorkspaceSettings, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use call::{ActiveCall, ParticipantLocation}; use client::proto::PeerId; use collections::HashMap; use gpui::{ - point, size, Along, AnyView, AnyWeakView, Axis, Bounds, Context, Entity, IntoElement, - MouseButton, Pixels, Point, StyleRefinement, Window, + Along, AnyView, AnyWeakView, Axis, Bounds, Context, Entity, IntoElement, MouseButton, Pixels, + Point, StyleRefinement, Window, point, size, }; use parking_lot::Mutex; use project::Project; @@ -803,9 +803,9 @@ mod element { use std::{cell::RefCell, iter, rc::Rc, sync::Arc}; use gpui::{ - px, relative, size, Along, AnyElement, App, Axis, BorderStyle, Bounds, Element, - GlobalElementId, IntoElement, MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement, - Pixels, Point, Size, Style, WeakEntity, Window, + Along, AnyElement, App, Axis, BorderStyle, Bounds, Element, GlobalElementId, IntoElement, + MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement, Pixels, Point, Size, Style, + WeakEntity, Window, px, relative, size, }; use gpui::{CursorStyle, Hitbox}; use parking_lot::Mutex; diff --git a/crates/workspace/src/persistence.rs b/crates/workspace/src/persistence.rs index fb9ba829d7..75ec3b528e 100644 --- a/crates/workspace/src/persistence.rs +++ b/crates/workspace/src/persistence.rs @@ -8,10 +8,10 @@ use std::{ sync::Arc, }; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use client::DevServerProjectId; use db::{define_connection, query, sqlez::connection::Connection, sqlez_macros::sql}; -use gpui::{point, size, Axis, Bounds, WindowBounds, WindowId}; +use gpui::{Axis, Bounds, WindowBounds, WindowId, point, size}; use itertools::Itertools; use project::debugger::breakpoint_store::{BreakpointState, SourceBreakpoint}; @@ -24,7 +24,7 @@ use sqlez::{ }; use ui::px; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; use uuid::Uuid; use crate::WorkspaceId; @@ -259,7 +259,7 @@ impl sqlez::bindable::Bind for SerializedPixels { statement: &sqlez::statement::Statement, start_index: i32, ) -> anyhow::Result { - let this: i32 = self.0 .0 as i32; + let this: i32 = self.0.0 as i32; this.bind(statement, start_index) } } diff --git a/crates/workspace/src/persistence/model.rs b/crates/workspace/src/persistence/model.rs index 0de5d6b3a0..da00642675 100644 --- a/crates/workspace/src/persistence/model.rs +++ b/crates/workspace/src/persistence/model.rs @@ -1,6 +1,6 @@ use super::{SerializedAxis, SerializedWindowBounds}; use crate::{ - item::ItemHandle, Member, Pane, PaneAxis, SerializableItemRegistry, Workspace, WorkspaceId, + Member, Pane, PaneAxis, SerializableItemRegistry, Workspace, WorkspaceId, item::ItemHandle, }; use anyhow::{Context as _, Result}; use async_recursion::async_recursion; @@ -10,7 +10,7 @@ use db::sqlez::{ }; use gpui::{AsyncWindowContext, Entity, WeakEntity}; use itertools::Itertools as _; -use project::{debugger::breakpoint_store::SourceBreakpoint, Project}; +use project::{Project, debugger::breakpoint_store::SourceBreakpoint}; use remote::ssh_session::SshProjectId; use serde::{Deserialize, Serialize}; use std::{ @@ -18,7 +18,7 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use util::{paths::SanitizedPath, ResultExt}; +use util::{ResultExt, paths::SanitizedPath}; use uuid::Uuid; #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] diff --git a/crates/workspace/src/searchable.rs b/crates/workspace/src/searchable.rs index c8777df032..e89e949f16 100644 --- a/crates/workspace/src/searchable.rs +++ b/crates/workspace/src/searchable.rs @@ -8,8 +8,8 @@ use gpui::{ use project::search::SearchQuery; use crate::{ - item::{Item, WeakItemHandle}, ItemHandle, + item::{Item, WeakItemHandle}, }; #[derive(Clone, Debug)] diff --git a/crates/workspace/src/shared_screen.rs b/crates/workspace/src/shared_screen.rs index 7d109074b7..156424dde6 100644 --- a/crates/workspace/src/shared_screen.rs +++ b/crates/workspace/src/shared_screen.rs @@ -1,15 +1,15 @@ use crate::{ - item::{Item, ItemEvent}, ItemNavHistory, WorkspaceId, + item::{Item, ItemEvent}, }; use call::{RemoteVideoTrack, RemoteVideoTrackView, Room}; -use client::{proto::PeerId, User}; +use client::{User, proto::PeerId}; use gpui::{ - div, AppContext as _, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, - ParentElement, Render, SharedString, Styled, + AppContext as _, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, + ParentElement, Render, SharedString, Styled, div, }; use std::sync::Arc; -use ui::{prelude::*, Icon, IconName}; +use ui::{Icon, IconName, prelude::*}; pub enum Event { Close, diff --git a/crates/workspace/src/theme_preview.rs b/crates/workspace/src/theme_preview.rs index d3a6e7f90d..60ec195c40 100644 --- a/crates/workspace/src/theme_preview.rs +++ b/crates/workspace/src/theme_preview.rs @@ -1,12 +1,12 @@ #![allow(unused, dead_code)] -use gpui::{actions, hsla, AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, Hsla}; +use gpui::{AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, Hsla, actions, hsla}; use strum::IntoEnumIterator; use theme::all_theme_colors; use ui::{ - element_cell, prelude::*, string_cell, utils::calculate_contrast_ratio, AudioStatus, Avatar, - AvatarAudioStatusIndicator, AvatarAvailabilityIndicator, ButtonLike, Checkbox, - CheckboxWithLabel, CollaboratorAvailability, ContentGroup, DecoratedIcon, ElevationIndex, - Facepile, IconDecoration, Indicator, KeybindingHint, Switch, Table, TintColor, Tooltip, + AudioStatus, Avatar, AvatarAudioStatusIndicator, AvatarAvailabilityIndicator, ButtonLike, + Checkbox, CheckboxWithLabel, CollaboratorAvailability, ContentGroup, DecoratedIcon, + ElevationIndex, Facepile, IconDecoration, Indicator, KeybindingHint, Switch, Table, TintColor, + Tooltip, element_cell, prelude::*, string_cell, utils::calculate_contrast_ratio, }; use crate::{Item, Workspace}; diff --git a/crates/workspace/src/toast_layer.rs b/crates/workspace/src/toast_layer.rs index d06ad53786..cbefad63fe 100644 --- a/crates/workspace/src/toast_layer.rs +++ b/crates/workspace/src/toast_layer.rs @@ -3,7 +3,7 @@ use std::{ time::{Duration, Instant}, }; -use gpui::{actions, AnyView, DismissEvent, Entity, FocusHandle, ManagedView, Subscription, Task}; +use gpui::{AnyView, DismissEvent, Entity, FocusHandle, ManagedView, Subscription, Task, actions}; use ui::{animation::DefaultAnimations, prelude::*}; use crate::Workspace; diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 8ddb79ca48..2978e365f2 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -17,31 +17,31 @@ mod workspace_settings; use dap::DapRegistry; pub use toast_layer::{RunAction, ToastAction, ToastLayer, ToastView}; -use anyhow::{anyhow, Context as _, Result}; -use call::{call_settings::CallSettings, ActiveCall}; +use anyhow::{Context as _, Result, anyhow}; +use call::{ActiveCall, call_settings::CallSettings}; use client::{ - proto::{self, ErrorCode, PanelId, PeerId}, ChannelId, Client, ErrorExt, Status, TypedEnvelope, UserStore, + proto::{self, ErrorCode, PanelId, PeerId}, }; -use collections::{hash_map, HashMap, HashSet}; +use collections::{HashMap, HashSet, hash_map}; use derive_more::{Deref, DerefMut}; pub use dock::Panel; use dock::{Dock, DockPosition, PanelButtons, PanelHandle, RESIZE_HANDLE_SIZE}; use futures::{ + Future, FutureExt, StreamExt, channel::{ mpsc::{self, UnboundedReceiver, UnboundedSender}, oneshot, }, future::try_join_all, - Future, FutureExt, StreamExt, }; use gpui::{ - action_as, actions, canvas, impl_action_as, impl_actions, point, relative, size, - transparent_black, Action, AnyView, AnyWeakView, App, AsyncApp, AsyncWindowContext, Bounds, - Context, CursorStyle, Decorations, DragMoveEvent, Entity, EntityId, EventEmitter, FocusHandle, - Focusable, Global, Hsla, KeyContext, Keystroke, ManagedView, MouseButton, PathPromptOptions, - Point, PromptLevel, Render, ResizeEdge, Size, Stateful, Subscription, Task, Tiling, WeakEntity, - WindowBounds, WindowHandle, WindowId, WindowOptions, + Action, AnyView, AnyWeakView, App, AsyncApp, AsyncWindowContext, Bounds, Context, CursorStyle, + Decorations, DragMoveEvent, Entity, EntityId, EventEmitter, FocusHandle, Focusable, Global, + Hsla, KeyContext, Keystroke, ManagedView, MouseButton, PathPromptOptions, Point, PromptLevel, + Render, ResizeEdge, Size, Stateful, Subscription, Task, Tiling, WeakEntity, WindowBounds, + WindowHandle, WindowId, WindowOptions, action_as, actions, canvas, impl_action_as, + impl_actions, point, relative, size, transparent_black, }; pub use item::{ FollowableItem, FollowableItemHandle, Item, ItemHandle, ItemSettings, PreviewTabsSettings, @@ -52,24 +52,24 @@ use language::{LanguageRegistry, Rope}; pub use modal_layer::*; use node_runtime::NodeRuntime; use notifications::{ - simple_message_notification::MessageNotification, DetachAndPromptErr, Notifications, + DetachAndPromptErr, Notifications, simple_message_notification::MessageNotification, }; pub use pane::*; pub use pane_group::*; -pub use persistence::{ - model::{ItemId, LocalPaths, SerializedWorkspaceLocation}, - WorkspaceDb, DB as WORKSPACE_DB, -}; use persistence::{ + DB, SerializedWindowBounds, model::{SerializedSshProject, SerializedWorkspace}, - SerializedWindowBounds, DB, +}; +pub use persistence::{ + DB as WORKSPACE_DB, WorkspaceDb, + model::{ItemId, LocalPaths, SerializedWorkspaceLocation}, }; use postage::stream::Stream; use project::{ - debugger::breakpoint_store::BreakpointStoreEvent, DirectoryLister, Project, ProjectEntryId, - ProjectPath, ResolvedPath, Worktree, WorktreeId, + DirectoryLister, Project, ProjectEntryId, ProjectPath, ResolvedPath, Worktree, WorktreeId, + debugger::breakpoint_store::BreakpointStoreEvent, }; -use remote::{ssh_session::ConnectionIdentifier, SshClientDelegate, SshConnectionOptions}; +use remote::{SshClientDelegate, SshConnectionOptions, ssh_session::ConnectionIdentifier}; use schemars::JsonSchema; use serde::Deserialize; use session::AppSession; @@ -91,7 +91,7 @@ use std::{ hash::{Hash, Hasher}, path::{Path, PathBuf}, rc::Rc, - sync::{atomic::AtomicUsize, Arc, LazyLock, Weak}, + sync::{Arc, LazyLock, Weak, atomic::AtomicUsize}, time::Duration, }; use task::{DebugAdapterConfig, SpawnInTerminal, TaskId}; @@ -99,7 +99,7 @@ use theme::{ActiveTheme, SystemAppearance, ThemeSettings}; pub use toolbar::{Toolbar, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView}; pub use ui; use ui::prelude::*; -use util::{paths::SanitizedPath, serde::default_true, ResultExt, TryFutureExt}; +use util::{ResultExt, TryFutureExt, paths::SanitizedPath, serde::default_true}; use uuid::Uuid; pub use workspace_settings::{ AutosaveSetting, RestoreOnStartupBehavior, TabBarSettings, WorkspaceSettings, @@ -107,8 +107,8 @@ pub use workspace_settings::{ use crate::notifications::NotificationId; use crate::persistence::{ - model::{DockData, DockStructure, SerializedItem, SerializedPane, SerializedPaneGroup}, SerializedAxis, + model::{DockData, DockStructure, SerializedItem, SerializedPane, SerializedPaneGroup}, }; pub const SERIALIZATION_THROTTLE_TIME: Duration = Duration::from_millis(200); @@ -6918,16 +6918,16 @@ mod tests { use super::*; use crate::{ - dock::{test::TestPanel, PanelEvent}, + dock::{PanelEvent, test::TestPanel}, item::{ - test::{TestItem, TestProjectItem}, ItemEvent, + test::{TestItem, TestProjectItem}, }, }; use fs::FakeFs; use gpui::{ - px, DismissEvent, Empty, EventEmitter, FocusHandle, Focusable, Render, TestAppContext, - UpdateGlobal, VisualTestContext, + DismissEvent, Empty, EventEmitter, FocusHandle, Focusable, Render, TestAppContext, + UpdateGlobal, VisualTestContext, px, }; use project::{Project, ProjectEntryId}; use serde_json::json; diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rs index 89c0a076b3..e75bd59ede 100644 --- a/crates/worktree/src/worktree.rs +++ b/crates/worktree/src/worktree.rs @@ -4,11 +4,12 @@ mod worktree_settings; mod worktree_tests; use ::ignore::gitignore::{Gitignore, GitignoreBuilder}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use clock::ReplicaId; use collections::{HashMap, HashSet, VecDeque}; -use fs::{copy_recursive, Fs, MTime, PathEvent, RemoveOptions, Watcher}; +use fs::{Fs, MTime, PathEvent, RemoveOptions, Watcher, copy_recursive}; use futures::{ + FutureExt as _, Stream, StreamExt, channel::{ mpsc::{self, UnboundedSender}, oneshot, @@ -16,16 +17,15 @@ use futures::{ future::join_all, select_biased, task::Poll, - FutureExt as _, Stream, StreamExt, }; use fuzzy::CharBag; use git::{ + COMMIT_MESSAGE, DOT_GIT, FSMONITOR_DAEMON, GITIGNORE, GitHostingProviderRegistry, INDEX_LOCK, + LFS_DIR, repository::{Branch, GitRepository, RepoPath, UpstreamTrackingStatus}, status::{ FileStatus, GitSummary, StatusCode, TrackedStatus, UnmergedStatus, UnmergedStatusCode, }, - GitHostingProviderRegistry, COMMIT_MESSAGE, DOT_GIT, FSMONITOR_DAEMON, GITIGNORE, INDEX_LOCK, - LFS_DIR, }; use gpui::{ App, AppContext as _, AsyncApp, BackgroundExecutor, Context, Entity, EventEmitter, Task, @@ -41,12 +41,12 @@ use postage::{ watch, }; use rpc::{ - proto::{self, split_worktree_update, FromProto, ToProto}, AnyProtoClient, + proto::{self, FromProto, ToProto, split_worktree_update}, }; pub use settings::WorktreeId; use settings::{Settings, SettingsLocation, SettingsStore}; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use smol::channel::{self, Sender}; use std::{ any::Any, @@ -61,16 +61,16 @@ use std::{ path::{Component, Path, PathBuf}, pin::Pin, sync::{ - atomic::{self, AtomicI32, AtomicUsize, Ordering::SeqCst}, Arc, + atomic::{self, AtomicI32, AtomicUsize, Ordering::SeqCst}, }, time::{Duration, Instant}, }; use sum_tree::{Bias, Edit, KeyedItem, SeekTarget, SumTree, Summary, TreeMap, TreeSet, Unit}; use text::{LineEnding, Rope}; use util::{ - paths::{home_dir, PathMatcher, SanitizedPath}, ResultExt, + paths::{PathMatcher, SanitizedPath, home_dir}, }; pub use worktree_settings::WorktreeSettings; @@ -3117,9 +3117,10 @@ impl LocalSnapshot { .strip_prefix(self.abs_path.as_path()) .unwrap(); assert!(self.entry_for_path(ignore_parent_path).is_some()); - assert!(self - .entry_for_path(ignore_parent_path.join(*GITIGNORE)) - .is_some()); + assert!( + self.entry_for_path(ignore_parent_path.join(*GITIGNORE)) + .is_some() + ); } } } @@ -3587,11 +3588,7 @@ pub struct File { impl language::File for File { fn as_local(&self) -> Option<&dyn language::LocalFile> { - if self.is_local { - Some(self) - } else { - None - } + if self.is_local { Some(self) } else { None } } fn disk_state(&self) -> DiskState { diff --git a/crates/worktree/src/worktree_tests.rs b/crates/worktree/src/worktree_tests.rs index 50b693227c..a4bbdd8937 100644 --- a/crates/worktree/src/worktree_tests.rs +++ b/crates/worktree/src/worktree_tests.rs @@ -1,13 +1,13 @@ use crate::{ - worktree_settings::WorktreeSettings, Entry, EntryKind, Event, PathChange, StatusEntry, - WorkDirectory, Worktree, WorktreeModelHandle, + Entry, EntryKind, Event, PathChange, StatusEntry, WorkDirectory, Worktree, WorktreeModelHandle, + worktree_settings::WorktreeSettings, }; use anyhow::Result; use fs::{FakeFs, Fs, RealFs, RemoveOptions}; use git::{ + GITIGNORE, repository::RepoPath, status::{FileStatus, StatusCode, TrackedStatus}, - GITIGNORE, }; use git2::RepositoryInitOptions; use gpui::{AppContext as _, BorrowAppContext, Context, Task, TestAppContext}; @@ -25,7 +25,7 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use util::{path, test::TempTree, ResultExt}; +use util::{ResultExt, path, test::TempTree}; #[gpui::test] async fn test_traversal(cx: &mut TestAppContext) { @@ -1096,12 +1096,14 @@ async fn test_file_scan_inclusions_reindexes_on_setting_change(cx: &mut TestAppC tree.flush_fs_events(cx).await; tree.read_with(cx, |tree, _| { - assert!(tree - .entry_for_path("node_modules") - .is_some_and(|f| f.is_always_included)); - assert!(tree - .entry_for_path("node_modules/prettier/package.json") - .is_some_and(|f| f.is_always_included)); + assert!( + tree.entry_for_path("node_modules") + .is_some_and(|f| f.is_always_included) + ); + assert!( + tree.entry_for_path("node_modules/prettier/package.json") + .is_some_and(|f| f.is_always_included) + ); }); cx.update(|cx| { @@ -1117,12 +1119,14 @@ async fn test_file_scan_inclusions_reindexes_on_setting_change(cx: &mut TestAppC tree.flush_fs_events(cx).await; tree.read_with(cx, |tree, _| { - assert!(tree - .entry_for_path("node_modules") - .is_some_and(|f| !f.is_always_included)); - assert!(tree - .entry_for_path("node_modules/prettier/package.json") - .is_some_and(|f| !f.is_always_included)); + assert!( + tree.entry_for_path("node_modules") + .is_some_and(|f| !f.is_always_included) + ); + assert!( + tree.entry_for_path("node_modules/prettier/package.json") + .is_some_and(|f| !f.is_always_included) + ); }); } diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 0c4e870842..afb4d7952b 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -5,10 +5,10 @@ mod logger; mod reliability; mod zed; -use anyhow::{anyhow, Context as _, Result}; -use clap::{command, Parser}; +use anyhow::{Context as _, Result, anyhow}; +use clap::{Parser, command}; use cli::FORCE_CLI_MODE_ENV_VAR_NAME; -use client::{parse_zed_link, Client, ProxySettings, UserStore}; +use client::{Client, ProxySettings, UserStore, parse_zed_link}; use collab_ui::channel_view::ChannelView; use collections::HashMap; use dap::DapRegistry; @@ -17,12 +17,12 @@ use editor::Editor; use extension::ExtensionHostProxy; use extension_host::ExtensionStore; use fs::{Fs, RealFs}; -use futures::{future, StreamExt}; +use futures::{StreamExt, future}; use git::GitHostingProviderRegistry; use gpui::{App, AppContext as _, Application, AsyncApp, UpdateGlobal as _}; use gpui_tokio::Tokio; -use http_client::{read_proxy_from_env, Uri}; +use http_client::{Uri, read_proxy_from_env}; use language::LanguageRegistry; use prompt_store::PromptBuilder; use reqwest_client::ReqwestClient; @@ -32,10 +32,10 @@ use logger::{init_logger, init_stdout_logger}; use node_runtime::{NodeBinaryOptions, NodeRuntime}; use parking_lot::Mutex; use project::project_settings::ProjectSettings; -use recent_projects::{open_ssh_project, SshSettings}; +use recent_projects::{SshSettings, open_ssh_project}; use release_channel::{AppCommitSha, AppVersion, ReleaseChannel}; use session::{AppSession, Session}; -use settings::{watch_config_file, Settings, SettingsStore}; +use settings::{Settings, SettingsStore, watch_config_file}; use std::{ env, io::{self, IsTerminal}, @@ -47,15 +47,15 @@ use theme::{ ActiveTheme, IconThemeNotFoundError, SystemAppearance, ThemeNotFoundError, ThemeRegistry, ThemeSettings, }; -use util::{maybe, ResultExt, TryFutureExt}; +use util::{ResultExt, TryFutureExt, maybe}; use uuid::Uuid; -use welcome::{show_welcome_view, BaseKeymap, FIRST_OPEN}; +use welcome::{BaseKeymap, FIRST_OPEN, show_welcome_view}; use workspace::{AppState, SerializedWorkspaceLocation, WorkspaceSettings, WorkspaceStore}; use zed::{ - app_menus, build_window_options, derive_paths_with_position, handle_cli_connection, - handle_keymap_file_changes, handle_settings_changed, handle_settings_file_changes, - initialize_workspace, inline_completion_registry, open_paths_with_positions, OpenListener, - OpenRequest, + OpenListener, OpenRequest, app_menus, build_window_options, derive_paths_with_position, + handle_cli_connection, handle_keymap_file_changes, handle_settings_changed, + handle_settings_file_changes, initialize_workspace, inline_completion_registry, + open_paths_with_positions, }; #[cfg(unix)] @@ -174,7 +174,7 @@ fn main() { #[cfg(all(not(debug_assertions), target_os = "windows"))] unsafe { - use windows::Win32::System::Console::{AttachConsole, ATTACH_PARENT_PROCESS}; + use windows::Win32::System::Console::{ATTACH_PARENT_PROCESS, AttachConsole}; if args.foreground { let _ = AttachConsole(ATTACH_PARENT_PROCESS); diff --git a/crates/zed/src/reliability.rs b/crates/zed/src/reliability.rs index 614401b149..86d17c83c1 100644 --- a/crates/zed/src/reliability.rs +++ b/crates/zed/src/reliability.rs @@ -2,19 +2,19 @@ use crate::stdout_is_a_pty; use anyhow::{Context as _, Result}; use backtrace::{self, Backtrace}; use chrono::Utc; -use client::{telemetry, TelemetrySettings}; +use client::{TelemetrySettings, telemetry}; use db::kvp::KEY_VALUE_STORE; use gpui::{App, AppContext as _, SemanticVersion}; use http_client::{self, HttpClient, HttpClientWithUrl, HttpRequestExt, Method}; use paths::{crashes_dir, crashes_retired_dir}; use project::Project; -use release_channel::{AppCommitSha, ReleaseChannel, RELEASE_CHANNEL}; +use release_channel::{AppCommitSha, RELEASE_CHANNEL, ReleaseChannel}; use settings::Settings; use smol::stream::StreamExt; use std::{ env, - ffi::{c_void, OsStr}, - sync::{atomic::Ordering, Arc}, + ffi::{OsStr, c_void}, + sync::{Arc, atomic::Ordering}, }; use std::{io::Write, panic, sync::atomic::AtomicU32, thread}; use telemetry_events::{LocationData, Panic, PanicRequest}; @@ -255,8 +255,9 @@ pub fn monitor_main_thread_hangs( } use nix::sys::signal::{ - sigaction, SaFlags, SigAction, SigHandler, SigSet, + SaFlags, SigAction, SigHandler, SigSet, Signal::{self, SIGUSR2}, + sigaction, }; use parking_lot::Mutex; @@ -264,7 +265,7 @@ pub fn monitor_main_thread_hangs( use http_client::Method; use std::{ ffi::c_int, - sync::{mpsc, OnceLock}, + sync::{OnceLock, mpsc}, time::Duration, }; use telemetry_events::{BacktraceFrame, HangReport}; diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 33b60d0067..1ffd302e2f 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -11,24 +11,24 @@ pub(crate) mod windows_only_instance; use anyhow::Context as _; pub use app_menus::*; use assets::Assets; -use assistant2::AssistantDiffToolbar; use assistant_context_editor::AssistantPanelDelegate; +use assistant2::AssistantDiffToolbar; use breadcrumbs::Breadcrumbs; -use client::{zed_urls, ZED_URL_SCHEME}; +use client::{ZED_URL_SCHEME, zed_urls}; use collections::VecDeque; use command_palette_hooks::CommandPaletteFilter; use debugger_ui::debugger_panel::DebugPanel; use editor::ProposedChangesEditorToolbar; -use editor::{scroll::Autoscroll, Editor, MultiBuffer}; +use editor::{Editor, MultiBuffer, scroll::Autoscroll}; use feature_flags::{Debugger, FeatureFlagAppExt, FeatureFlagViewExt}; -use futures::{channel::mpsc, select_biased, StreamExt}; +use futures::{StreamExt, channel::mpsc, select_biased}; use git_ui::git_panel::GitPanel; use git_ui::project_diff::ProjectDiffToolbar; use gpui::{ - actions, point, px, Action, App, AppContext as _, AsyncApp, AsyncWindowContext, Context, - DismissEvent, Element, Entity, Focusable, KeyBinding, MenuItem, ParentElement, - PathPromptOptions, PromptLevel, ReadGlobal, SharedString, Styled, Task, TitlebarOptions, - UpdateGlobal, Window, WindowKind, WindowOptions, + Action, App, AppContext as _, AsyncApp, AsyncWindowContext, Context, DismissEvent, Element, + Entity, Focusable, KeyBinding, MenuItem, ParentElement, PathPromptOptions, PromptLevel, + ReadGlobal, SharedString, Styled, Task, TitlebarOptions, UpdateGlobal, Window, WindowKind, + WindowOptions, actions, point, px, }; use image_viewer::ImageInfo; use migrate::{MigrationBanner, MigrationEvent, MigrationNotification, MigrationType}; @@ -48,9 +48,9 @@ use release_channel::{AppCommitSha, ReleaseChannel}; use rope::Rope; use search::project_search::ProjectSearchBar; use settings::{ - initial_debug_tasks_content, initial_project_settings_content, initial_tasks_content, - update_settings_file, InvalidSettingsError, KeymapFile, KeymapFileLoadResult, Settings, - SettingsStore, DEFAULT_KEYMAP_PATH, VIM_KEYMAP_PATH, + DEFAULT_KEYMAP_PATH, InvalidSettingsError, KeymapFile, KeymapFileLoadResult, Settings, + SettingsStore, VIM_KEYMAP_PATH, initial_debug_tasks_content, initial_project_settings_content, + initial_tasks_content, update_settings_file, }; use std::any::TypeId; use std::path::PathBuf; @@ -59,19 +59,20 @@ use std::time::Duration; use std::{borrow::Cow, ops::Deref, path::Path, sync::Arc}; use terminal_view::terminal_panel::{self, TerminalPanel}; use theme::{ActiveTheme, ThemeSettings}; -use ui::{prelude::*, PopoverMenuHandle}; +use ui::{PopoverMenuHandle, prelude::*}; use util::markdown::MarkdownString; -use util::{asset_str, ResultExt}; +use util::{ResultExt, asset_str}; use uuid::Uuid; use vim_mode_setting::VimModeSetting; use welcome::{BaseKeymap, MultibufferHint}; -use workspace::notifications::{dismiss_app_notification, show_app_notification, NotificationId}; +use workspace::notifications::{NotificationId, dismiss_app_notification, show_app_notification}; use workspace::{ + AppState, NewFile, NewWindow, OpenLog, Toast, Workspace, WorkspaceSettings, create_and_open_local_file, notifications::simple_message_notification::MessageNotification, - open_new, AppState, NewFile, NewWindow, OpenLog, Toast, Workspace, WorkspaceSettings, + open_new, }; -use workspace::{notifications::DetachAndPromptErr, Pane}; use workspace::{CloseIntent, RestoreBanner}; +use workspace::{Pane, notifications::DetachAndPromptErr}; use zed_actions::{ OpenAccountSettings, OpenBrowser, OpenServerSettings, OpenSettings, OpenZedUrl, Quit, }; @@ -1751,15 +1752,15 @@ mod tests { use super::*; use assets::Assets; use collections::HashSet; - use editor::{display_map::DisplayRow, scroll::Autoscroll, DisplayPoint, Editor}; + use editor::{DisplayPoint, Editor, display_map::DisplayRow, scroll::Autoscroll}; use gpui::{ - actions, Action, AnyWindowHandle, App, AssetSource, BorrowAppContext, SemanticVersion, - TestAppContext, UpdateGlobal, VisualTestContext, WindowHandle, + Action, AnyWindowHandle, App, AssetSource, BorrowAppContext, SemanticVersion, + TestAppContext, UpdateGlobal, VisualTestContext, WindowHandle, actions, }; use language::{LanguageMatcher, LanguageRegistry}; - use project::{project_settings::ProjectSettings, Project, ProjectPath, WorktreeSettings}; + use project::{Project, ProjectPath, WorktreeSettings, project_settings::ProjectSettings}; use serde_json::json; - use settings::{watch_config_file, SettingsStore}; + use settings::{SettingsStore, watch_config_file}; use std::{ path::{Path, PathBuf}, time::Duration, @@ -1767,9 +1768,10 @@ mod tests { use theme::{ThemeRegistry, ThemeSettings}; use util::{path, separator}; use workspace::{ + NewFile, OpenOptions, OpenVisible, SERIALIZATION_THROTTLE_TIME, SaveIntent, SplitDirection, + WorkspaceHandle, item::{Item, ItemHandle}, - open_new, open_paths, pane, NewFile, OpenOptions, OpenVisible, SaveIntent, SplitDirection, - WorkspaceHandle, SERIALIZATION_THROTTLE_TIME, + open_new, open_paths, pane, }; #[gpui::test] @@ -1871,11 +1873,13 @@ mod tests { .update(cx, |workspace, window, cx| { assert_eq!(workspace.worktrees(cx).count(), 2); assert!(workspace.left_dock().read(cx).is_open()); - assert!(workspace - .active_pane() - .read(cx) - .focus_handle(cx) - .is_focused(window)); + assert!( + workspace + .active_pane() + .read(cx) + .focus_handle(cx) + .is_focused(window) + ); }) .unwrap(); diff --git a/crates/zed/src/zed/inline_completion_registry.rs b/crates/zed/src/zed/inline_completion_registry.rs index b099dc4cb3..5064a57a8a 100644 --- a/crates/zed/src/zed/inline_completion_registry.rs +++ b/crates/zed/src/zed/inline_completion_registry.rs @@ -3,7 +3,7 @@ use collections::HashMap; use copilot::{Copilot, CopilotCompletionProvider}; use editor::{Editor, EditorMode}; use gpui::{AnyWindowHandle, App, AppContext as _, Context, Entity, WeakEntity}; -use language::language_settings::{all_language_settings, EditPredictionProvider}; +use language::language_settings::{EditPredictionProvider, all_language_settings}; use settings::SettingsStore; use std::{cell::RefCell, rc::Rc, sync::Arc}; use supermaven::{Supermaven, SupermavenCompletionProvider}; diff --git a/crates/zed/src/zed/open_listener.rs b/crates/zed/src/zed/open_listener.rs index 2bda7bbdc3..9134b3e913 100644 --- a/crates/zed/src/zed/open_listener.rs +++ b/crates/zed/src/zed/open_listener.rs @@ -1,8 +1,8 @@ use crate::handle_open_request; use crate::restorable_workspace_locations; -use anyhow::{anyhow, Context as _, Result}; -use cli::{ipc, IpcHandshake}; -use cli::{ipc::IpcSender, CliRequest, CliResponse}; +use anyhow::{Context as _, Result, anyhow}; +use cli::{CliRequest, CliResponse, ipc::IpcSender}; +use cli::{IpcHandshake, ipc}; use client::parse_zed_link; use collections::HashMap; use db::kvp::KEY_VALUE_STORE; @@ -14,16 +14,16 @@ use futures::future::join_all; use futures::{FutureExt, SinkExt, StreamExt}; use gpui::{App, AsyncApp, Global, WindowHandle}; use language::Point; -use recent_projects::{open_ssh_project, SshSettings}; +use recent_projects::{SshSettings, open_ssh_project}; use remote::SshConnectionOptions; use settings::Settings; use std::path::{Path, PathBuf}; use std::sync::Arc; use std::thread; use std::time::Duration; -use util::paths::PathWithPosition; use util::ResultExt; -use welcome::{show_welcome_view, FIRST_OPEN}; +use util::paths::PathWithPosition; +use welcome::{FIRST_OPEN, show_welcome_view}; use workspace::item::ItemHandle; use workspace::{AppState, OpenOptions, SerializedWorkspaceLocation, Workspace}; @@ -532,8 +532,8 @@ mod tests { use std::sync::Arc; use cli::{ - ipc::{self}, CliResponse, + ipc::{self}, }; use editor::Editor; use gpui::TestAppContext; diff --git a/crates/zed/src/zed/quick_action_bar.rs b/crates/zed/src/zed/quick_action_bar.rs index 0b4ec87973..6f8b6efa70 100644 --- a/crates/zed/src/zed/quick_action_bar.rs +++ b/crates/zed/src/zed/quick_action_bar.rs @@ -12,15 +12,15 @@ use gpui::{ Action, ClickEvent, Context, Corner, ElementId, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, ParentElement, Render, Styled, Subscription, WeakEntity, Window, }; -use search::{buffer_search, BufferSearchBar}; +use search::{BufferSearchBar, buffer_search}; use settings::{Settings, SettingsStore}; use ui::{ - prelude::*, ButtonStyle, ContextMenu, ContextMenuEntry, IconButton, IconButtonShape, IconName, - IconSize, PopoverMenu, PopoverMenuHandle, Tooltip, + ButtonStyle, ContextMenu, ContextMenuEntry, IconButton, IconButtonShape, IconName, IconSize, + PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*, }; use vim_mode_setting::VimModeSetting; use workspace::{ - item::ItemHandle, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, + ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, item::ItemHandle, }; use zed_actions::{assistant::InlineAssist, outline::ToggleOutline}; diff --git a/crates/zed/src/zed/quick_action_bar/markdown_preview.rs b/crates/zed/src/zed/quick_action_bar/markdown_preview.rs index cf9f707341..44008f7110 100644 --- a/crates/zed/src/zed/quick_action_bar/markdown_preview.rs +++ b/crates/zed/src/zed/quick_action_bar/markdown_preview.rs @@ -1,8 +1,8 @@ use gpui::{AnyElement, Modifiers, WeakEntity}; use markdown_preview::{ - markdown_preview_view::MarkdownPreviewView, OpenPreview, OpenPreviewToTheSide, + OpenPreview, OpenPreviewToTheSide, markdown_preview_view::MarkdownPreviewView, }; -use ui::{prelude::*, text_for_keystroke, IconButtonShape, Tooltip}; +use ui::{IconButtonShape, Tooltip, prelude::*, text_for_keystroke}; use workspace::Workspace; use super::QuickActionBar; diff --git a/crates/zed/src/zed/quick_action_bar/repl_menu.rs b/crates/zed/src/zed/quick_action_bar/repl_menu.rs index 51ed0af6b8..a7e00adf0c 100644 --- a/crates/zed/src/zed/quick_action_bar/repl_menu.rs +++ b/crates/zed/src/zed/quick_action_bar/repl_menu.rs @@ -1,16 +1,17 @@ use std::time::Duration; use gpui::ElementId; -use gpui::{percentage, Animation, AnimationExt, AnyElement, Entity, Transformation}; +use gpui::{Animation, AnimationExt, AnyElement, Entity, Transformation, percentage}; use picker::Picker; use repl::{ + ExecutionState, JupyterSettings, Kernel, KernelSpecification, KernelStatus, Session, + SessionSupport, components::{KernelPickerDelegate, KernelSelector}, - worktree_id_for_editor, ExecutionState, JupyterSettings, Kernel, KernelSpecification, - KernelStatus, Session, SessionSupport, + worktree_id_for_editor, }; use ui::{ - prelude::*, ButtonLike, ContextMenu, IconWithIndicator, Indicator, IntoElement, PopoverMenu, - PopoverMenuHandle, Tooltip, + ButtonLike, ContextMenu, IconWithIndicator, Indicator, IntoElement, PopoverMenu, + PopoverMenuHandle, Tooltip, prelude::*, }; use util::ResultExt; diff --git a/crates/zed/src/zed/windows_only_instance.rs b/crates/zed/src/zed/windows_only_instance.rs index 05f24393b0..e3d20f6527 100644 --- a/crates/zed/src/zed/windows_only_instance.rs +++ b/crates/zed/src/zed/windows_only_instance.rs @@ -1,17 +1,16 @@ use std::{sync::Arc, thread::JoinHandle}; use anyhow::Context; -use cli::{ipc::IpcOneShotServer, CliRequest, CliResponse, IpcHandshake}; +use cli::{CliRequest, CliResponse, IpcHandshake, ipc::IpcOneShotServer}; use parking_lot::Mutex; use release_channel::app_identifier; use util::ResultExt; use windows::{ - core::HSTRING, Win32::{ - Foundation::{CloseHandle, GetLastError, ERROR_ALREADY_EXISTS, GENERIC_WRITE, HANDLE}, + Foundation::{CloseHandle, ERROR_ALREADY_EXISTS, GENERIC_WRITE, GetLastError, HANDLE}, Storage::FileSystem::{ - CreateFileW, ReadFile, WriteFile, FILE_FLAGS_AND_ATTRIBUTES, FILE_SHARE_MODE, - OPEN_EXISTING, PIPE_ACCESS_INBOUND, + CreateFileW, FILE_FLAGS_AND_ATTRIBUTES, FILE_SHARE_MODE, OPEN_EXISTING, + PIPE_ACCESS_INBOUND, ReadFile, WriteFile, }, System::{ Pipes::{ @@ -21,6 +20,7 @@ use windows::{ Threading::CreateMutexW, }, }, + core::HSTRING, }; use crate::{Args, OpenListener}; diff --git a/crates/zed_actions/src/lib.rs b/crates/zed_actions/src/lib.rs index 40a2292ba8..1e358c9bbd 100644 --- a/crates/zed_actions/src/lib.rs +++ b/crates/zed_actions/src/lib.rs @@ -275,7 +275,7 @@ impl_actions!(task, [Spawn, Rerun]); pub mod outline { use std::sync::OnceLock; - use gpui::{action_as, AnyView, App, Window}; + use gpui::{AnyView, App, Window, action_as}; action_as!(outline, ToggleOutline as Toggle); /// A pointer to outline::toggle function, exposed here to sewer the breadcrumbs <-> outline dependency. diff --git a/crates/zeta/src/completion_diff_element.rs b/crates/zeta/src/completion_diff_element.rs index 9344c43c5e..b395f18824 100644 --- a/crates/zeta/src/completion_diff_element.rs +++ b/crates/zeta/src/completion_diff_element.rs @@ -2,8 +2,8 @@ use std::cmp; use crate::InlineCompletion; use gpui::{ - point, prelude::*, quad, size, AnyElement, App, BorderStyle, Bounds, Corners, Edges, - HighlightStyle, Hsla, StyledText, TextLayout, TextStyle, + AnyElement, App, BorderStyle, Bounds, Corners, Edges, HighlightStyle, Hsla, StyledText, + TextLayout, TextStyle, point, prelude::*, quad, size, }; use language::OffsetRangeExt; use settings::Settings; diff --git a/crates/zeta/src/init.rs b/crates/zeta/src/init.rs index e0e3578af1..e63ac4ec3d 100644 --- a/crates/zeta/src/init.rs +++ b/crates/zeta/src/init.rs @@ -8,7 +8,7 @@ use settings::update_settings_file; use ui::App; use workspace::Workspace; -use crate::{onboarding_modal::ZedPredictModal, RateCompletionModal}; +use crate::{RateCompletionModal, onboarding_modal::ZedPredictModal}; actions!(edit_prediction, [ResetOnboarding, RateCompletions]); diff --git a/crates/zeta/src/input_excerpt.rs b/crates/zeta/src/input_excerpt.rs index 7171facaff..5949e713e9 100644 --- a/crates/zeta/src/input_excerpt.rs +++ b/crates/zeta/src/input_excerpt.rs @@ -1,6 +1,6 @@ use crate::{ - tokens_for_bytes, CURSOR_MARKER, EDITABLE_REGION_END_MARKER, EDITABLE_REGION_START_MARKER, - START_OF_FILE_MARKER, + CURSOR_MARKER, EDITABLE_REGION_END_MARKER, EDITABLE_REGION_START_MARKER, START_OF_FILE_MARKER, + tokens_for_bytes, }; use language::{BufferSnapshot, Point}; use std::{fmt::Write, ops::Range}; diff --git a/crates/zeta/src/onboarding_modal.rs b/crates/zeta/src/onboarding_modal.rs index b452593331..abd409dd78 100644 --- a/crates/zeta/src/onboarding_modal.rs +++ b/crates/zeta/src/onboarding_modal.rs @@ -1,19 +1,19 @@ use std::{sync::Arc, time::Duration}; -use crate::{onboarding_event, ZED_PREDICT_DATA_COLLECTION_CHOICE}; +use crate::{ZED_PREDICT_DATA_COLLECTION_CHOICE, onboarding_event}; use anyhow::Context as _; use client::{Client, UserStore}; use db::kvp::KEY_VALUE_STORE; use fs::Fs; use gpui::{ - ease_in_out, svg, Animation, AnimationExt as _, ClickEvent, DismissEvent, Entity, EventEmitter, - FocusHandle, Focusable, MouseDownEvent, Render, + Animation, AnimationExt as _, ClickEvent, DismissEvent, Entity, EventEmitter, FocusHandle, + Focusable, MouseDownEvent, Render, ease_in_out, svg, }; use language::language_settings::{AllLanguageSettings, EditPredictionProvider}; -use settings::{update_settings_file, Settings}; -use ui::{prelude::*, Checkbox, TintColor}; +use settings::{Settings, update_settings_file}; +use ui::{Checkbox, TintColor, prelude::*}; use util::ResultExt; -use workspace::{notifications::NotifyTaskExt, ModalView, Workspace}; +use workspace::{ModalView, Workspace, notifications::NotifyTaskExt}; /// Introduces user to Zed's Edit Prediction feature and terms of service pub struct ZedPredictModal { diff --git a/crates/zeta/src/rate_completion_modal.rs b/crates/zeta/src/rate_completion_modal.rs index 2d94481379..17c3b0bdef 100644 --- a/crates/zeta/src/rate_completion_modal.rs +++ b/crates/zeta/src/rate_completion_modal.rs @@ -1,9 +1,9 @@ use crate::{CompletionDiffElement, InlineCompletion, InlineCompletionRating, Zeta}; use editor::Editor; -use gpui::{actions, prelude::*, App, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable}; +use gpui::{App, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, actions, prelude::*}; use language::language_settings; use std::time::Duration; -use ui::{prelude::*, KeyBinding, List, ListItem, ListItemSpacing, Tooltip}; +use ui::{KeyBinding, List, ListItem, ListItemSpacing, Tooltip, prelude::*}; use workspace::{ModalView, Workspace}; actions!( diff --git a/crates/zeta/src/zeta.rs b/crates/zeta/src/zeta.rs index 78ad51247d..14aa2820cb 100644 --- a/crates/zeta/src/zeta.rs +++ b/crates/zeta/src/zeta.rs @@ -10,23 +10,23 @@ pub(crate) use completion_diff_element::*; use db::kvp::KEY_VALUE_STORE; pub use init::*; use inline_completion::DataCollectionState; -pub use license_detection::is_license_eligible_for_data_collection; use license_detection::LICENSE_FILES_TO_CHECK; +pub use license_detection::is_license_eligible_for_data_collection; pub use rate_completion_modal::*; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use arrayvec::ArrayVec; use client::{Client, UserStore}; use collections::{HashMap, HashSet, VecDeque}; use futures::AsyncReadExt; use gpui::{ - actions, App, AppContext as _, AsyncApp, Context, Entity, EntityId, Global, SemanticVersion, - Subscription, Task, WeakEntity, + App, AppContext as _, AsyncApp, Context, Entity, EntityId, Global, SemanticVersion, + Subscription, Task, WeakEntity, actions, }; use http_client::{HttpClient, Method}; use input_excerpt::excerpt_for_cursor_position; use language::{ - text_diff, Anchor, Buffer, BufferSnapshot, EditPreview, OffsetRangeExt, ToOffset, ToPoint, + Anchor, Buffer, BufferSnapshot, EditPreview, OffsetRangeExt, ToOffset, ToPoint, text_diff, }; use language_model::{LlmApiToken, RefreshLlmTokenListener}; use postage::watch; @@ -50,12 +50,12 @@ use telemetry_events::InlineCompletionRating; use thiserror::Error; use util::ResultExt; use uuid::Uuid; -use workspace::notifications::{ErrorMessagePrompt, NotificationId}; use workspace::Workspace; +use workspace::notifications::{ErrorMessagePrompt, NotificationId}; use worktree::Worktree; use zed_llm_client::{ - PredictEditsBody, PredictEditsResponse, EXPIRED_LLM_TOKEN_HEADER_NAME, - MINIMUM_REQUIRED_VERSION_HEADER_NAME, + EXPIRED_LLM_TOKEN_HEADER_NAME, MINIMUM_REQUIRED_VERSION_HEADER_NAME, PredictEditsBody, + PredictEditsResponse, }; const CURSOR_MARKER: &'static str = "<|user_cursor_is_here|>"; @@ -165,11 +165,7 @@ fn interpolate( edits.extend(model_edits.cloned()); - if edits.is_empty() { - None - } else { - Some(edits) - } + if edits.is_empty() { None } else { Some(edits) } } impl std::fmt::Debug for InlineCompletion { diff --git a/crates/zlog/src/zlog.rs b/crates/zlog/src/zlog.rs index 5dea8ebd65..56705d7f7b 100644 --- a/crates/zlog/src/zlog.rs +++ b/crates/zlog/src/zlog.rs @@ -275,8 +275,8 @@ pub mod scope_map { collections::{HashMap, VecDeque}, hash::{DefaultHasher, Hasher}, sync::{ - atomic::{AtomicU64, Ordering}, RwLock, + atomic::{AtomicU64, Ordering}, }, usize, }; diff --git a/extensions/glsl/src/glsl.rs b/extensions/glsl/src/glsl.rs index b3867d9c38..a42403ebef 100644 --- a/extensions/glsl/src/glsl.rs +++ b/extensions/glsl/src/glsl.rs @@ -1,6 +1,6 @@ use std::fs; use zed::settings::LspSettings; -use zed_extension_api::{self as zed, serde_json, LanguageServerId, Result}; +use zed_extension_api::{self as zed, LanguageServerId, Result, serde_json}; struct GlslExtension { cached_binary_path: Option, diff --git a/extensions/html/src/html.rs b/extensions/html/src/html.rs index 07abea9b77..2d3de12337 100644 --- a/extensions/html/src/html.rs +++ b/extensions/html/src/html.rs @@ -1,6 +1,6 @@ use std::{env, fs}; use zed::settings::LspSettings; -use zed_extension_api::{self as zed, serde_json::json, LanguageServerId, Result}; +use zed_extension_api::{self as zed, LanguageServerId, Result, serde_json::json}; const BINARY_NAME: &str = "vscode-html-language-server"; const SERVER_PATH: &str = diff --git a/extensions/perplexity/src/perplexity.rs b/extensions/perplexity/src/perplexity.rs index 1772793cde..95b829c112 100644 --- a/extensions/perplexity/src/perplexity.rs +++ b/extensions/perplexity/src/perplexity.rs @@ -3,7 +3,7 @@ use zed::{ http_client::HttpRequest, serde_json::{self, json}, }; -use zed_extension_api::{self as zed, http_client::RedirectPolicy, Result}; +use zed_extension_api::{self as zed, Result, http_client::RedirectPolicy}; struct Perplexity; diff --git a/extensions/proto/src/proto.rs b/extensions/proto/src/proto.rs index c692a09327..70c5b9c84a 100644 --- a/extensions/proto/src/proto.rs +++ b/extensions/proto/src/proto.rs @@ -1,4 +1,4 @@ -use zed_extension_api::{self as zed, settings::LspSettings, Result}; +use zed_extension_api::{self as zed, Result, settings::LspSettings}; const PROTOBUF_LANGUAGE_SERVER_NAME: &str = "protobuf-language-server"; diff --git a/extensions/ruff/src/ruff.rs b/extensions/ruff/src/ruff.rs index 048c5893ca..da9b6c0bf1 100644 --- a/extensions/ruff/src/ruff.rs +++ b/extensions/ruff/src/ruff.rs @@ -1,6 +1,6 @@ use std::fs; use zed::LanguageServerId; -use zed_extension_api::{self as zed, settings::LspSettings, Result}; +use zed_extension_api::{self as zed, Result, settings::LspSettings}; struct RuffBinary { path: String, diff --git a/extensions/snippets/src/snippets.rs b/extensions/snippets/src/snippets.rs index 913071eeb0..46ba746930 100644 --- a/extensions/snippets/src/snippets.rs +++ b/extensions/snippets/src/snippets.rs @@ -1,7 +1,7 @@ use serde_json::json; use std::fs; use zed::LanguageServerId; -use zed_extension_api::{self as zed, settings::LspSettings, Result}; +use zed_extension_api::{self as zed, Result, settings::LspSettings}; struct SnippetExtension { cached_binary_path: Option, diff --git a/tooling/xtask/src/tasks/clippy.rs b/tooling/xtask/src/tasks/clippy.rs index 85d0adf583..32574a907e 100644 --- a/tooling/xtask/src/tasks/clippy.rs +++ b/tooling/xtask/src/tasks/clippy.rs @@ -1,6 +1,6 @@ use std::process::Command; -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use clap::Parser; #[derive(Parser)] diff --git a/tooling/xtask/src/tasks/licenses.rs b/tooling/xtask/src/tasks/licenses.rs index 415bb30741..943b36cb28 100644 --- a/tooling/xtask/src/tasks/licenses.rs +++ b/tooling/xtask/src/tasks/licenses.rs @@ -1,6 +1,6 @@ use std::path::{Path, PathBuf}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use clap::Parser; use crate::workspace::load_workspace; diff --git a/tooling/xtask/src/tasks/package_conformity.rs b/tooling/xtask/src/tasks/package_conformity.rs index de2db3cdd1..fe7d6672fb 100644 --- a/tooling/xtask/src/tasks/package_conformity.rs +++ b/tooling/xtask/src/tasks/package_conformity.rs @@ -2,7 +2,7 @@ use std::collections::BTreeMap; use std::fs; use std::path::Path; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use cargo_toml::{Dependency, Manifest}; use clap::Parser;