From d475f1373a0850da1381834cada03b4b0855c920 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Sun, 7 Jan 2024 14:14:21 +0100 Subject: [PATCH] gpui: Further docs refinement & moved some reexports into 'private' module (#3935) This commit mostly fixes invalid URLs in docstrings. It also encapsulates crates we reexport (serde stuff + linkme) into a public module named "private" in order to reduce the API surfaced through docs. Moreover, I fixed up a bunch of crates that were pulling serde_json in through gpui explicitly instead of using Cargo manifest. Release Notes: - N/A --- Cargo.lock | 7 +++++++ crates/ai/src/providers/open_ai/embedding.rs | 3 ++- crates/client/Cargo.toml | 1 + crates/client/src/client.rs | 5 +++-- crates/client/src/telemetry.rs | 3 ++- crates/collab_ui/Cargo.toml | 1 + crates/collab_ui/src/chat_panel.rs | 6 +++--- crates/collab_ui/src/collab_panel.rs | 12 ++++++------ crates/collab_ui/src/notification_panel.rs | 10 +++++----- crates/editor/src/editor_tests.rs | 7 ++----- crates/editor/src/test/editor_test_context.rs | 2 +- crates/feedback/Cargo.toml | 1 + crates/feedback/src/feedback_modal.rs | 4 ++-- crates/gpui/src/action.rs | 12 ++++++------ crates/gpui/src/app.rs | 6 +++--- crates/gpui/src/app/entity_map.rs | 2 +- crates/gpui/src/geometry.rs | 5 +++-- crates/gpui/src/gpui.rs | 18 +++++++++++------- crates/gpui/src/input.rs | 8 +++++--- .../gpui/src/platform/mac/display_linker.rs | 2 +- crates/gpui/src/view.rs | 2 +- crates/gpui/src/window.rs | 19 ++++++++----------- crates/gpui/tests/action_macros.rs | 2 +- crates/gpui_macros/src/register_action.rs | 4 ++-- crates/language_tools/Cargo.toml | 1 + crates/language_tools/src/lsp_log_tests.rs | 3 ++- crates/project_symbols/Cargo.toml | 1 + crates/project_symbols/src/project_symbols.rs | 3 ++- crates/terminal_view/Cargo.toml | 1 + crates/terminal_view/src/terminal_panel.rs | 6 +++--- crates/theme_importer/Cargo.toml | 1 + crates/theme_importer/src/main.rs | 1 - crates/theme_importer/src/zed1/converter.rs | 2 +- crates/theme_importer/src/zed1/theme.rs | 2 +- 34 files changed, 91 insertions(+), 72 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c22fe57b47..54e2f483d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1380,6 +1380,7 @@ dependencies = [ "schemars", "serde", "serde_derive", + "serde_json", "settings", "smol", "sum_tree", @@ -1545,6 +1546,7 @@ dependencies = [ "schemars", "serde", "serde_derive", + "serde_json", "settings", "smallvec", "theme", @@ -2490,6 +2492,7 @@ dependencies = [ "regex", "serde", "serde_derive", + "serde_json", "settings", "smallvec", "smol", @@ -3784,6 +3787,7 @@ dependencies = [ "lsp", "project", "serde", + "serde_json", "settings", "theme", "tree-sitter", @@ -5511,6 +5515,7 @@ dependencies = [ "picker", "postage", "project", + "serde_json", "settings", "smol", "text", @@ -7764,6 +7769,7 @@ dependencies = [ "search", "serde", "serde_derive", + "serde_json", "settings", "shellexpand", "smallvec", @@ -7844,6 +7850,7 @@ dependencies = [ "pathfinder_color", "rust-embed", "serde", + "serde_json", "simplelog", "strum", "theme", diff --git a/crates/ai/src/providers/open_ai/embedding.rs b/crates/ai/src/providers/open_ai/embedding.rs index d5fe4e8c58..0a9b6ba969 100644 --- a/crates/ai/src/providers/open_ai/embedding.rs +++ b/crates/ai/src/providers/open_ai/embedding.rs @@ -1,8 +1,8 @@ use anyhow::{anyhow, Result}; use async_trait::async_trait; use futures::AsyncReadExt; +use gpui::AppContext; use gpui::BackgroundExecutor; -use gpui::{serde_json, AppContext}; use isahc::http::StatusCode; use isahc::prelude::Configurable; use isahc::{AsyncBody, Response}; @@ -11,6 +11,7 @@ use parking_lot::{Mutex, RwLock}; use parse_duration::parse; use postage::watch; use serde::{Deserialize, Serialize}; +use serde_json; use std::env; use std::ops::Add; use std::sync::Arc; diff --git a/crates/client/Cargo.toml b/crates/client/Cargo.toml index c24cbca35b..03d6c06fe3 100644 --- a/crates/client/Cargo.toml +++ b/crates/client/Cargo.toml @@ -36,6 +36,7 @@ rand.workspace = true schemars.workspace = true serde.workspace = true serde_derive.workspace = true +serde_json.workspace = true smol.workspace = true sysinfo.workspace = true tempfile = "3" diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs index b07dddc006..3eae9d92bb 100644 --- a/crates/client/src/client.rs +++ b/crates/client/src/client.rs @@ -15,8 +15,8 @@ use futures::{ TryFutureExt as _, TryStreamExt, }; use gpui::{ - actions, serde_json, AnyModel, AnyWeakModel, AppContext, AsyncAppContext, Model, - SemanticVersion, Task, WeakModel, + actions, AnyModel, AnyWeakModel, AppContext, AsyncAppContext, Model, SemanticVersion, Task, + WeakModel, }; use lazy_static::lazy_static; use parking_lot::RwLock; @@ -25,6 +25,7 @@ use rand::prelude::*; use rpc::proto::{AnyTypedEnvelope, EntityMessage, EnvelopedMessage, PeerId, RequestMessage}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; +use serde_json; use settings::Settings; use std::{ any::TypeId, diff --git a/crates/client/src/telemetry.rs b/crates/client/src/telemetry.rs index 94d8369a69..26b5748187 100644 --- a/crates/client/src/telemetry.rs +++ b/crates/client/src/telemetry.rs @@ -1,10 +1,11 @@ use crate::{TelemetrySettings, ZED_SECRET_CLIENT_TOKEN, ZED_SERVER_URL}; use chrono::{DateTime, Utc}; use futures::Future; -use gpui::{serde_json, AppContext, AppMetadata, BackgroundExecutor, Task}; +use gpui::{AppContext, AppMetadata, BackgroundExecutor, Task}; use lazy_static::lazy_static; use parking_lot::Mutex; use serde::Serialize; +use serde_json; use settings::{Settings, SettingsStore}; use std::{env, io::Write, mem, path::PathBuf, sync::Arc, time::Duration}; use sysinfo::{ diff --git a/crates/collab_ui/Cargo.toml b/crates/collab_ui/Cargo.toml index 8206d89dce..f845de3a93 100644 --- a/crates/collab_ui/Cargo.toml +++ b/crates/collab_ui/Cargo.toml @@ -61,6 +61,7 @@ schemars.workspace = true postage.workspace = true serde.workspace = true serde_derive.workspace = true +serde_json.workspace = true time.workspace = true smallvec.workspace = true diff --git a/crates/collab_ui/src/chat_panel.rs b/crates/collab_ui/src/chat_panel.rs index b142fcbe7f..a13c0ed384 100644 --- a/crates/collab_ui/src/chat_panel.rs +++ b/crates/collab_ui/src/chat_panel.rs @@ -7,9 +7,9 @@ use collections::HashMap; use db::kvp::KEY_VALUE_STORE; use editor::Editor; use gpui::{ - actions, div, list, prelude::*, px, serde_json, AnyElement, AppContext, AsyncWindowContext, - ClickEvent, ElementId, EventEmitter, FocusableView, ListOffset, ListScrollEvent, ListState, - Model, Render, Subscription, Task, View, ViewContext, VisualContext, WeakView, + actions, div, list, prelude::*, px, AnyElement, AppContext, AsyncWindowContext, ClickEvent, + ElementId, EventEmitter, FocusableView, ListOffset, ListScrollEvent, ListState, Model, Render, + Subscription, Task, View, ViewContext, VisualContext, WeakView, }; use language::LanguageRegistry; use menu::Confirm; diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rs index 663883f9b4..ee43b32f10 100644 --- a/crates/collab_ui/src/collab_panel.rs +++ b/crates/collab_ui/src/collab_panel.rs @@ -15,12 +15,12 @@ use editor::{Editor, EditorElement, EditorStyle}; use feature_flags::{ChannelsAlpha, FeatureFlagAppExt, FeatureFlagViewExt}; use fuzzy::{match_strings, StringMatchCandidate}; use gpui::{ - actions, canvas, div, fill, list, overlay, point, prelude::*, px, serde_json, AnyElement, - AppContext, AsyncWindowContext, Bounds, ClipboardItem, DismissEvent, Div, EventEmitter, - FocusHandle, FocusableView, FontStyle, FontWeight, InteractiveElement, IntoElement, ListOffset, - ListState, Model, MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Render, - RenderOnce, SharedString, Styled, Subscription, Task, TextStyle, View, ViewContext, - VisualContext, WeakView, WhiteSpace, + actions, canvas, div, fill, list, overlay, point, prelude::*, px, AnyElement, AppContext, + AsyncWindowContext, Bounds, ClipboardItem, DismissEvent, Div, EventEmitter, FocusHandle, + FocusableView, FontStyle, FontWeight, InteractiveElement, IntoElement, ListOffset, ListState, + Model, MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Render, RenderOnce, + SharedString, Styled, Subscription, Task, TextStyle, View, ViewContext, VisualContext, + WeakView, WhiteSpace, }; use menu::{Cancel, Confirm, SelectNext, SelectPrev}; use project::{Fs, Project}; diff --git a/crates/collab_ui/src/notification_panel.rs b/crates/collab_ui/src/notification_panel.rs index b7a18365be..e7c94984b2 100644 --- a/crates/collab_ui/src/notification_panel.rs +++ b/crates/collab_ui/src/notification_panel.rs @@ -6,11 +6,11 @@ use collections::HashMap; use db::kvp::KEY_VALUE_STORE; use futures::StreamExt; use gpui::{ - actions, div, img, list, px, serde_json, AnyElement, AppContext, AsyncWindowContext, - CursorStyle, DismissEvent, Element, EventEmitter, FocusHandle, FocusableView, - InteractiveElement, IntoElement, ListAlignment, ListScrollEvent, ListState, Model, - ParentElement, Render, StatefulInteractiveElement, Styled, Task, View, ViewContext, - VisualContext, WeakView, WindowContext, + actions, div, img, list, px, AnyElement, AppContext, AsyncWindowContext, CursorStyle, + DismissEvent, Element, EventEmitter, FocusHandle, FocusableView, InteractiveElement, + IntoElement, ListAlignment, ListScrollEvent, ListState, Model, ParentElement, Render, + StatefulInteractiveElement, Styled, Task, View, ViewContext, VisualContext, WeakView, + WindowContext, }; use notifications::{NotificationEntry, NotificationEvent, NotificationStore}; use project::Fs; diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index b64e3cccc3..66f28db3e4 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -9,11 +9,7 @@ use crate::{ }; use futures::StreamExt; -use gpui::{ - div, - serde_json::{self, json}, - TestAppContext, VisualTestContext, WindowBounds, WindowOptions, -}; +use gpui::{div, TestAppContext, VisualTestContext, WindowBounds, WindowOptions}; use indoc::indoc; use language::{ language_settings::{AllLanguageSettings, AllLanguageSettingsContent, LanguageSettingsContent}, @@ -24,6 +20,7 @@ use language::{ use parking_lot::Mutex; use project::project_settings::{LspSettings, ProjectSettings}; use project::FakeFs; +use serde_json::{self, json}; use std::sync::atomic; use std::sync::atomic::AtomicUsize; use std::{cell::RefCell, future::Future, rc::Rc, time::Instant}; diff --git a/crates/editor/src/test/editor_test_context.rs b/crates/editor/src/test/editor_test_context.rs index 18916f844c..3289471e81 100644 --- a/crates/editor/src/test/editor_test_context.rs +++ b/crates/editor/src/test/editor_test_context.rs @@ -39,7 +39,7 @@ impl EditorTestContext { // fs.insert_file("/file", "".to_owned()).await; fs.insert_tree( "/root", - gpui::serde_json::json!({ + serde_json::json!({ "file": "", }), ) diff --git a/crates/feedback/Cargo.toml b/crates/feedback/Cargo.toml index e14df6a2d4..32ecee529c 100644 --- a/crates/feedback/Cargo.toml +++ b/crates/feedback/Cargo.toml @@ -36,6 +36,7 @@ postage.workspace = true regex.workspace = true serde.workspace = true serde_derive.workspace = true +serde_json.workspace = true smallvec.workspace = true smol.workspace = true sysinfo.workspace = true diff --git a/crates/feedback/src/feedback_modal.rs b/crates/feedback/src/feedback_modal.rs index 87d3918671..6c5308c1c6 100644 --- a/crates/feedback/src/feedback_modal.rs +++ b/crates/feedback/src/feedback_modal.rs @@ -7,8 +7,8 @@ use db::kvp::KEY_VALUE_STORE; use editor::{Editor, EditorEvent}; use futures::AsyncReadExt; use gpui::{ - div, red, rems, serde_json, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView, - Model, PromptLevel, Render, Task, View, ViewContext, + div, red, rems, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView, Model, + PromptLevel, Render, Task, View, ViewContext, }; use isahc::Request; use language::Buffer; diff --git a/crates/gpui/src/action.rs b/crates/gpui/src/action.rs index 54682a30ef..e335c4255e 100644 --- a/crates/gpui/src/action.rs +++ b/crates/gpui/src/action.rs @@ -29,7 +29,7 @@ use std::any::{Any, TypeId}; /// macro, which only generates the code needed to register your action before `main`. /// /// ``` -/// #[derive(gpui::serde::Deserialize, std::cmp::PartialEq, std::clone::Clone)] +/// #[derive(gpui::private::serde::Deserialize, std::cmp::PartialEq, std::clone::Clone)] /// pub struct Paste { /// pub content: SharedString, /// } @@ -158,12 +158,12 @@ impl ActionRegistry { macro_rules! actions { ($namespace:path, [ $($name:ident),* $(,)? ]) => { $( - #[derive(::std::cmp::PartialEq, ::std::clone::Clone, ::std::default::Default, gpui::serde_derive::Deserialize)] - #[serde(crate = "gpui::serde")] + #[derive(::std::cmp::PartialEq, ::std::clone::Clone, ::std::default::Default, gpui::private::serde_derive::Deserialize)] + #[serde(crate = "gpui::private::serde")] pub struct $name; gpui::__impl_action!($namespace, $name, - fn build(_: gpui::serde_json::Value) -> gpui::Result<::std::boxed::Box> { + fn build(_: gpui::private::serde_json::Value) -> gpui::Result<::std::boxed::Box> { Ok(Box::new(Self)) } ); @@ -179,8 +179,8 @@ macro_rules! impl_actions { ($namespace:path, [ $($name:ident),* $(,)? ]) => { $( gpui::__impl_action!($namespace, $name, - fn build(value: gpui::serde_json::Value) -> gpui::Result<::std::boxed::Box> { - Ok(std::boxed::Box::new(gpui::serde_json::from_value::(value)?)) + fn build(value: gpui::private::serde_json::Value) -> gpui::Result<::std::boxed::Box> { + Ok(std::boxed::Box::new(gpui::private::serde_json::from_value::(value)?)) } ); diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 2a0ff545e9..638396abc5 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -43,7 +43,7 @@ use util::{ ResultExt, }; -/// Temporary(?) wrapper around RefCell to help us debug any double borrows. +/// Temporary(?) wrapper around [`RefCell`] to help us debug any double borrows. /// Strongly consider removing after stabilization. pub struct AppCell { app: RefCell, @@ -964,7 +964,7 @@ impl AppContext { /// Event handlers propagate events by default. Call this method to stop dispatching to /// event handlers with a lower z-index (mouse) or higher in the tree (keyboard). This is - /// the opposite of [propagate]. It's also possible to cancel a call to [propagate] by + /// the opposite of [`Self::propagate`]. It's also possible to cancel a call to [`Self::propagate`] by /// calling this method before effects are flushed. pub fn stop_propagation(&mut self) { self.propagate_event = false; @@ -972,7 +972,7 @@ impl AppContext { /// Action handlers stop propagation by default during the bubble phase of action dispatch /// dispatching to action handlers higher in the element tree. This is the opposite of - /// [stop_propagation]. It's also possible to cancel a call to [stop_propagate] by calling + /// [`Self::stop_propagation`]. It's also possible to cancel a call to [`Self::stop_propagation`] by calling /// this method before effects are flushed. pub fn propagate(&mut self) { self.propagate_event = true; diff --git a/crates/gpui/src/app/entity_map.rs b/crates/gpui/src/app/entity_map.rs index 97f680560a..17f6e47ddf 100644 --- a/crates/gpui/src/app/entity_map.rs +++ b/crates/gpui/src/app/entity_map.rs @@ -1,4 +1,4 @@ -use crate::{private::Sealed, AppContext, Context, Entity, ModelContext}; +use crate::{seal::Sealed, AppContext, Context, Entity, ModelContext}; use anyhow::{anyhow, Result}; use derive_more::{Deref, DerefMut}; use parking_lot::{RwLock, RwLockUpgradableReadGuard}; diff --git a/crates/gpui/src/geometry.rs b/crates/gpui/src/geometry.rs index d68ab89f6c..a50de8c344 100644 --- a/crates/gpui/src/geometry.rs +++ b/crates/gpui/src/geometry.rs @@ -1582,7 +1582,6 @@ impl From for Edges { /// Represents the corners of a box in a 2D space, such as border radius. /// /// Each field represents the size of the corner on one side of the box: `top_left`, `top_right`, `bottom_right`, and `bottom_left`. -/// ``` #[derive(Refineable, Clone, Default, Debug, Eq, PartialEq)] #[refineable(Debug)] #[repr(C)] @@ -2263,7 +2262,7 @@ impl From for GlobalPixels { } } -/// Represents a length in rems, a unit based on the font-size of the window, which can be assigned with [WindowContext::set_rem_size]. +/// Represents a length in rems, a unit based on the font-size of the window, which can be assigned with [`WindowContext::set_rem_size`][set_rem_size]. /// /// Rems are used for defining lengths that are scalable and consistent across different UI elements. /// The value of `1rem` is typically equal to the font-size of the root element (often the `` element in browsers), @@ -2271,6 +2270,8 @@ impl From for GlobalPixels { /// purpose, allowing for scalable and accessible design that can adjust to different display settings or user preferences. /// /// For example, if the root element's font-size is `16px`, then `1rem` equals `16px`. A length of `2rems` would then be `32px`. +/// +/// [set_rem_size]: crate::WindowContext::set_rem_size #[derive(Clone, Copy, Default, Add, Sub, Mul, Div, Neg)] pub struct Rems(pub f32); diff --git a/crates/gpui/src/gpui.rs b/crates/gpui/src/gpui.rs index 868822d59b..d5236d8f08 100644 --- a/crates/gpui/src/gpui.rs +++ b/crates/gpui/src/gpui.rs @@ -30,7 +30,16 @@ mod util; mod view; mod window; -mod private { +/// Do not touch, here be dragons for use by gpui_macros and such. +#[doc(hidden)] +pub mod private { + pub use linkme; + pub use serde; + pub use serde_derive; + pub use serde_json; +} + +mod seal { /// A mechanism for restricting implementations of a trait to only those in GPUI. /// See: https://predr.ag/blog/definitive-guide-to-sealed-traits-in-rust/ pub trait Sealed {} @@ -53,16 +62,11 @@ pub use input::*; pub use interactive::*; pub use key_dispatch::*; pub use keymap::*; -pub use linkme; pub use platform::*; -use private::Sealed; pub use refineable::*; pub use scene::*; -pub use serde; -pub use serde_derive; -pub use serde_json; +use seal::Sealed; pub use shared_string::*; -pub use smallvec; pub use smol::Timer; pub use style::*; pub use styled::*; diff --git a/crates/gpui/src/input.rs b/crates/gpui/src/input.rs index 8592eeffeb..da240a77a8 100644 --- a/crates/gpui/src/input.rs +++ b/crates/gpui/src/input.rs @@ -5,8 +5,8 @@ use std::ops::Range; /// Implement this trait to allow views to handle textual input when implementing an editor, field, etc. /// -/// Once your view `V` implements this trait, you can use it to construct an [ElementInputHandler]. -/// This input handler can then be assigned during paint by calling [WindowContext::handle_input]. +/// Once your view `V` implements this trait, you can use it to construct an [`ElementInputHandler`]. +/// This input handler can then be assigned during paint by calling [`WindowContext::handle_input`]. pub trait InputHandler: 'static + Sized { fn text_for_range(&mut self, range: Range, cx: &mut ViewContext) -> Option; @@ -43,8 +43,10 @@ pub struct ElementInputHandler { } impl ElementInputHandler { - /// Used in [Element::paint] with the element's bounds and a view context for its + /// Used in [`Element::paint`][element_paint] with the element's bounds and a view context for its /// containing view. + /// + /// [element_paint]: crate::Element::paint pub fn new(element_bounds: Bounds, view: View, cx: &mut WindowContext) -> Self { ElementInputHandler { view, diff --git a/crates/gpui/src/platform/mac/display_linker.rs b/crates/gpui/src/platform/mac/display_linker.rs index e367d22b3d..8f1b233046 100644 --- a/crates/gpui/src/platform/mac/display_linker.rs +++ b/crates/gpui/src/platform/mac/display_linker.rs @@ -94,7 +94,7 @@ unsafe extern "C" fn trampoline( mod sys { //! Derived from display-link crate under the fololwing license: - //! https://github.com/BrainiumLLC/display-link/blob/master/LICENSE-MIT + //! //! Apple docs: [CVDisplayLink](https://developer.apple.com/documentation/corevideo/cvdisplaylinkoutputcallback?language=objc) #![allow(dead_code, non_upper_case_globals)] diff --git a/crates/gpui/src/view.rs b/crates/gpui/src/view.rs index 88e564d27f..6e6223cbbe 100644 --- a/crates/gpui/src/view.rs +++ b/crates/gpui/src/view.rs @@ -1,5 +1,5 @@ use crate::{ - private::Sealed, AnyElement, AnyModel, AnyWeakModel, AppContext, AvailableSpace, BorrowWindow, + seal::Sealed, AnyElement, AnyModel, AnyWeakModel, AppContext, AvailableSpace, BorrowWindow, Bounds, Element, ElementId, Entity, EntityId, Flatten, FocusHandle, FocusableView, IntoElement, LayoutId, Model, Pixels, Point, Render, Size, ViewContext, VisualContext, WeakModel, WindowContext, diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rs index a0d3d0f886..7e4c5f93f9 100644 --- a/crates/gpui/src/window.rs +++ b/crates/gpui/src/window.rs @@ -1826,9 +1826,11 @@ impl<'a> WindowContext<'a> { result } - /// Set an input handler, such as [ElementInputHandler], which interfaces with the + /// Set an input handler, such as [`ElementInputHandler`][element_input_handler], which interfaces with the /// platform to receive textual input with proper integration with concerns such /// as IME interactions. + /// + /// [element_input_handler]: crate::ElementInputHandler pub fn handle_input( &mut self, focus_handle: &FocusHandle, @@ -2500,8 +2502,7 @@ impl<'a, V: 'static> ViewContext<'a, V> { } /// Register a listener to be called when the given focus handle receives focus. - /// Unlike [on_focus_changed], returns a subscription and persists until the subscription - /// is dropped. + /// Returns a subscription and persists until the subscription is dropped. pub fn on_focus( &mut self, handle: &FocusHandle, @@ -2527,8 +2528,7 @@ impl<'a, V: 'static> ViewContext<'a, V> { } /// Register a listener to be called when the given focus handle or one of its descendants receives focus. - /// Unlike [on_focus_changed], returns a subscription and persists until the subscription - /// is dropped. + /// Returns a subscription and persists until the subscription is dropped. pub fn on_focus_in( &mut self, handle: &FocusHandle, @@ -2554,8 +2554,7 @@ impl<'a, V: 'static> ViewContext<'a, V> { } /// Register a listener to be called when the given focus handle loses focus. - /// Unlike [on_focus_changed], returns a subscription and persists until the subscription - /// is dropped. + /// Returns a subscription and persists until the subscription is dropped. pub fn on_blur( &mut self, handle: &FocusHandle, @@ -2581,8 +2580,7 @@ impl<'a, V: 'static> ViewContext<'a, V> { } /// Register a listener to be called when the window loses focus. - /// Unlike [on_focus_changed], returns a subscription and persists until the subscription - /// is dropped. + /// Returns a subscription and persists until the subscription is dropped. pub fn on_blur_window( &mut self, mut listener: impl FnMut(&mut V, &mut ViewContext) + 'static, @@ -2597,8 +2595,7 @@ impl<'a, V: 'static> ViewContext<'a, V> { } /// Register a listener to be called when the given focus handle or one of its descendants loses focus. - /// Unlike [on_focus_changed], returns a subscription and persists until the subscription - /// is dropped. + /// Returns a subscription and persists until the subscription is dropped. pub fn on_focus_out( &mut self, handle: &FocusHandle, diff --git a/crates/gpui/tests/action_macros.rs b/crates/gpui/tests/action_macros.rs index f77d8a2d0d..9e5f6dea16 100644 --- a/crates/gpui/tests/action_macros.rs +++ b/crates/gpui/tests/action_macros.rs @@ -11,7 +11,7 @@ fn test_action_macros() { impl_actions!(test, [AnotherTestAction]); - #[derive(PartialEq, Clone, gpui::serde_derive::Deserialize)] + #[derive(PartialEq, Clone, gpui::private::serde_derive::Deserialize)] struct RegisterableAction {} register_action!(RegisterableAction); diff --git a/crates/gpui_macros/src/register_action.rs b/crates/gpui_macros/src/register_action.rs index 9e3a473843..c18e4f4b89 100644 --- a/crates/gpui_macros/src/register_action.rs +++ b/crates/gpui_macros/src/register_action.rs @@ -36,8 +36,8 @@ pub(crate) fn register_action(type_name: &Ident) -> proc_macro2::TokenStream { quote! { #[doc(hidden)] - #[gpui::linkme::distributed_slice(gpui::__GPUI_ACTIONS)] - #[linkme(crate = gpui::linkme)] + #[gpui::private::linkme::distributed_slice(gpui::__GPUI_ACTIONS)] + #[linkme(crate = gpui::private::linkme)] static #static_slice_name: gpui::MacroActionBuilder = #action_builder_fn_name; /// This is an auto generated function, do not use. diff --git a/crates/language_tools/Cargo.toml b/crates/language_tools/Cargo.toml index 0bf064092e..1681e78425 100644 --- a/crates/language_tools/Cargo.toml +++ b/crates/language_tools/Cargo.toml @@ -24,6 +24,7 @@ futures.workspace = true serde.workspace = true anyhow.workspace = true tree-sitter.workspace = true +serde_json.workspace = true [dev-dependencies] client = { path = "../client", features = ["test-support"] } diff --git a/crates/language_tools/src/lsp_log_tests.rs b/crates/language_tools/src/lsp_log_tests.rs index 194b6d1ae8..14683ae806 100644 --- a/crates/language_tools/src/lsp_log_tests.rs +++ b/crates/language_tools/src/lsp_log_tests.rs @@ -4,9 +4,10 @@ use crate::lsp_log::LogMenuItem; use super::*; use futures::StreamExt; -use gpui::{serde_json::json, Context, TestAppContext, VisualTestContext}; +use gpui::{Context, TestAppContext, VisualTestContext}; use language::{tree_sitter_rust, FakeLspAdapter, Language, LanguageConfig, LanguageServerName}; use project::{FakeFs, Project}; +use serde_json::json; use settings::SettingsStore; #[gpui::test] diff --git a/crates/project_symbols/Cargo.toml b/crates/project_symbols/Cargo.toml index 91cc882e41..da96fb2db5 100644 --- a/crates/project_symbols/Cargo.toml +++ b/crates/project_symbols/Cargo.toml @@ -24,6 +24,7 @@ anyhow.workspace = true ordered-float.workspace = true postage.workspace = true smol.workspace = true +serde_json.workspace = true [dev-dependencies] futures.workspace = true diff --git a/crates/project_symbols/src/project_symbols.rs b/crates/project_symbols/src/project_symbols.rs index 3c2760f720..ed31ebd949 100644 --- a/crates/project_symbols/src/project_symbols.rs +++ b/crates/project_symbols/src/project_symbols.rs @@ -260,9 +260,10 @@ impl PickerDelegate for ProjectSymbolsDelegate { mod tests { use super::*; use futures::StreamExt; - use gpui::{serde_json::json, TestAppContext, VisualContext}; + use gpui::{TestAppContext, VisualContext}; use language::{FakeLspAdapter, Language, LanguageConfig}; use project::FakeFs; + use serde_json::json; use settings::SettingsStore; use std::{path::Path, sync::Arc}; diff --git a/crates/terminal_view/Cargo.toml b/crates/terminal_view/Cargo.toml index d848460183..811d420045 100644 --- a/crates/terminal_view/Cargo.toml +++ b/crates/terminal_view/Cargo.toml @@ -36,6 +36,7 @@ thiserror.workspace = true lazy_static.workspace = true serde.workspace = true serde_derive.workspace = true +serde_json.workspace = true [dev-dependencies] editor = { path = "../editor", features = ["test-support"] } diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index c0f8e6209b..9992953570 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -3,9 +3,9 @@ use std::{ops::ControlFlow, path::PathBuf, sync::Arc}; use crate::TerminalView; use db::kvp::KEY_VALUE_STORE; use gpui::{ - actions, serde_json, AppContext, AsyncWindowContext, Entity, EventEmitter, ExternalPaths, - FocusHandle, FocusableView, IntoElement, ParentElement, Pixels, Render, Styled, Subscription, - Task, View, ViewContext, VisualContext, WeakView, WindowContext, + actions, AppContext, AsyncWindowContext, Entity, EventEmitter, ExternalPaths, FocusHandle, + FocusableView, IntoElement, ParentElement, Pixels, Render, Styled, Subscription, Task, View, + ViewContext, VisualContext, WeakView, WindowContext, }; use itertools::Itertools; use project::{Fs, ProjectEntryId}; diff --git a/crates/theme_importer/Cargo.toml b/crates/theme_importer/Cargo.toml index 1b0c39fee7..7bcb2daa63 100644 --- a/crates/theme_importer/Cargo.toml +++ b/crates/theme_importer/Cargo.toml @@ -18,6 +18,7 @@ palette = { version = "0.7.3", default-features = false, features = ["std"] } pathfinder_color = "0.5" rust-embed.workspace = true serde.workspace = true +serde_json.workspace = true simplelog = "0.9" strum = { version = "0.25.0", features = ["derive"] } theme = { path = "../theme", features = ["importing-themes"] } diff --git a/crates/theme_importer/src/main.rs b/crates/theme_importer/src/main.rs index 3a7e0b20d5..ff20d36a5d 100644 --- a/crates/theme_importer/src/main.rs +++ b/crates/theme_importer/src/main.rs @@ -16,7 +16,6 @@ use any_ascii::any_ascii; use anyhow::{anyhow, Context, Result}; use clap::Parser; use convert_case::{Case, Casing}; -use gpui::serde_json; use indexmap::IndexMap; use indoc::formatdoc; use json_comments::StripComments; diff --git a/crates/theme_importer/src/zed1/converter.rs b/crates/theme_importer/src/zed1/converter.rs index 86c40dfde5..9f40c3695f 100644 --- a/crates/theme_importer/src/zed1/converter.rs +++ b/crates/theme_importer/src/zed1/converter.rs @@ -1,5 +1,5 @@ use anyhow::{Context, Result}; -use gpui::{serde_json, Hsla, Rgba}; +use gpui::{Hsla, Rgba}; use theme::{ color_alpha, Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, UserHighlightStyle, UserSyntaxTheme, diff --git a/crates/theme_importer/src/zed1/theme.rs b/crates/theme_importer/src/zed1/theme.rs index 7743fba0b1..70efb6ab2b 100644 --- a/crates/theme_importer/src/zed1/theme.rs +++ b/crates/theme_importer/src/zed1/theme.rs @@ -6,10 +6,10 @@ use std::fmt; use std::ops::{Deref, DerefMut}; use std::sync::Arc; -use gpui::serde_json::{self, Value}; use pathfinder_color::ColorU; use serde::de::{self, DeserializeOwned, Unexpected}; use serde::{Deserialize, Deserializer}; +use serde_json::{self, Value}; #[derive(Clone, Copy, Default, PartialEq, Eq, Hash, PartialOrd, Ord)] #[repr(transparent)]