mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-26 07:02:19 +03:00
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
This commit is contained in:
parent
eb9ddef083
commit
d475f1373a
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -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",
|
||||
|
@ -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;
|
||||
|
@ -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"
|
||||
|
@ -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,
|
||||
|
@ -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::{
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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};
|
||||
|
@ -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;
|
||||
|
@ -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};
|
||||
|
@ -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": "",
|
||||
}),
|
||||
)
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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<dyn gpui::Action>> {
|
||||
fn build(_: gpui::private::serde_json::Value) -> gpui::Result<::std::boxed::Box<dyn gpui::Action>> {
|
||||
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<dyn gpui::Action>> {
|
||||
Ok(std::boxed::Box::new(gpui::serde_json::from_value::<Self>(value)?))
|
||||
fn build(value: gpui::private::serde_json::Value) -> gpui::Result<::std::boxed::Box<dyn gpui::Action>> {
|
||||
Ok(std::boxed::Box::new(gpui::private::serde_json::from_value::<Self>(value)?))
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -43,7 +43,7 @@ use util::{
|
||||
ResultExt,
|
||||
};
|
||||
|
||||
/// Temporary(?) wrapper around RefCell<AppContext> to help us debug any double borrows.
|
||||
/// Temporary(?) wrapper around [`RefCell<AppContext>`] to help us debug any double borrows.
|
||||
/// Strongly consider removing after stabilization.
|
||||
pub struct AppCell {
|
||||
app: RefCell<AppContext>,
|
||||
@ -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;
|
||||
|
@ -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};
|
||||
|
@ -1582,7 +1582,6 @@ impl From<f32> for Edges<Pixels> {
|
||||
/// 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<f64> 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 `<html>` element in browsers),
|
||||
@ -2271,6 +2270,8 @@ impl From<f64> 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);
|
||||
|
||||
|
@ -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::*;
|
||||
|
@ -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<V>].
|
||||
/// 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<V>`].
|
||||
/// 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<usize>, cx: &mut ViewContext<Self>)
|
||||
-> Option<String>;
|
||||
@ -43,8 +43,10 @@ pub struct ElementInputHandler<V> {
|
||||
}
|
||||
|
||||
impl<V: 'static> ElementInputHandler<V> {
|
||||
/// 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<Pixels>, view: View<V>, cx: &mut WindowContext) -> Self {
|
||||
ElementInputHandler {
|
||||
view,
|
||||
|
@ -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
|
||||
//! <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)]
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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<V>) + '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,
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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"] }
|
||||
|
@ -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]
|
||||
|
@ -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
|
||||
|
@ -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};
|
||||
|
||||
|
@ -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"] }
|
||||
|
@ -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};
|
||||
|
@ -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"] }
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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)]
|
||||
|
Loading…
Reference in New Issue
Block a user