diff --git a/Cargo.lock b/Cargo.lock index c7fa44619f..36c855e9e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5834,28 +5834,7 @@ dependencies = [ "tree-sitter-rust", "unindent", "url", - "zed-rpc", -] - -[[package]] -name = "zed-rpc" -version = "0.1.0" -dependencies = [ - "anyhow", - "async-lock", - "async-tungstenite", - "base64 0.13.0", - "futures", - "log", - "parking_lot", - "postage", - "prost 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "prost-build", - "rand 0.8.3", - "rsa", - "serde 1.0.125", - "smol", - "tempdir", + "zrpc", ] [[package]] @@ -5894,7 +5873,7 @@ dependencies = [ "tide-compress", "toml 0.5.8", "zed", - "zed-rpc", + "zrpc", ] [[package]] @@ -5917,3 +5896,24 @@ dependencies = [ "syn", "synstructure", ] + +[[package]] +name = "zrpc" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-lock", + "async-tungstenite", + "base64 0.13.0", + "futures", + "log", + "parking_lot", + "postage", + "prost 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "prost-build", + "rand 0.8.3", + "rsa", + "serde 1.0.125", + "smol", + "tempdir", +] diff --git a/Cargo.toml b/Cargo.toml index d77b103bd7..45734a7dce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["fsevent", "gpui", "gpui_macros", "server", "zed", "zed-rpc"] +members = ["fsevent", "gpui", "gpui_macros", "server", "zed", "zrpc"] [patch.crates-io] async-task = { git = "https://github.com/zed-industries/async-task", rev = "341b57d6de98cdfd7b418567b8de2022ca993a6e" } diff --git a/server/Cargo.toml b/server/Cargo.toml index 9d43788405..6d26f66054 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -32,7 +32,7 @@ surf = "2.2.0" tide = "0.16.0" tide-compress = "0.9.0" toml = "0.5.8" -zed-rpc = { path = "../zed-rpc" } +zrpc = { path = "../zrpc" } [dependencies.async-sqlx-session] version = "0.3.0" diff --git a/server/src/auth.rs b/server/src/auth.rs index ad72e62b6e..4a7107e550 100644 --- a/server/src/auth.rs +++ b/server/src/auth.rs @@ -18,7 +18,7 @@ use sqlx::FromRow; use std::{borrow::Cow, convert::TryFrom, sync::Arc}; use surf::Url; use tide::Server; -use zed_rpc::{auth as zed_auth, proto, Peer}; +use zrpc::{auth as zed_auth, proto, Peer}; static CURRENT_GITHUB_USER: &'static str = "current_github_user"; static GITHUB_AUTH_URL: &'static str = "https://github.com/login/oauth/authorize"; @@ -124,7 +124,7 @@ impl RequestExt for Request { pub trait PeerExt { async fn sign_out( self: &Arc, - connection_id: zed_rpc::ConnectionId, + connection_id: zrpc::ConnectionId, state: &AppState, ) -> tide::Result<()>; } @@ -133,7 +133,7 @@ pub trait PeerExt { impl PeerExt for Peer { async fn sign_out( self: &Arc, - connection_id: zed_rpc::ConnectionId, + connection_id: zrpc::ConnectionId, state: &AppState, ) -> tide::Result<()> { self.disconnect(connection_id).await; diff --git a/server/src/main.rs b/server/src/main.rs index d422ede52e..ebd52b0a8b 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -26,7 +26,7 @@ use std::sync::Arc; use surf::http::cookies::SameSite; use tide::{log, sessions::SessionMiddleware}; use tide_compress::CompressMiddleware; -use zed_rpc::Peer; +use zrpc::Peer; type Request = tide::Request>; type DbPool = PgPool; diff --git a/server/src/rpc.rs b/server/src/rpc.rs index cf8df8af79..3c189833b2 100644 --- a/server/src/rpc.rs +++ b/server/src/rpc.rs @@ -21,7 +21,7 @@ use tide::{ http::headers::{HeaderName, CONNECTION, UPGRADE}, Request, Response, }; -use zed_rpc::{ +use zrpc::{ auth::random_token, proto::{self, EnvelopedMessage}, ConnectionId, Peer, Router, TypedEnvelope, diff --git a/server/src/tests.rs b/server/src/tests.rs index d3dc59bea6..19481a4608 100644 --- a/server/src/tests.rs +++ b/server/src/tests.rs @@ -21,7 +21,7 @@ use zed::{ test::{temp_tree, Channel}, worktree::{FakeFs, Fs, RealFs, Worktree}, }; -use zed_rpc::{ForegroundRouter, Peer, Router}; +use zrpc::{ForegroundRouter, Peer, Router}; #[gpui::test] async fn test_share_worktree(mut cx_a: TestAppContext, mut cx_b: TestAppContext) { diff --git a/zed/Cargo.toml b/zed/Cargo.toml index 1b59f25995..7e4d4949d6 100644 --- a/zed/Cargo.toml +++ b/zed/Cargo.toml @@ -14,7 +14,7 @@ name = "Zed" path = "src/main.rs" [features] -test-support = ["tempdir", "serde_json", "zed-rpc/test-support"] +test-support = ["tempdir", "serde_json", "zrpc/test-support"] [dependencies] anyhow = "1.0.38" @@ -42,7 +42,7 @@ rust-embed = "5.9.0" seahash = "4.1" serde = { version = "1", features = ["derive"] } serde_json = { version = "1.0.64", features = [ - "preserve_order" + "preserve_order", ], optional = true } similar = "1.3" simplelog = "0.9" @@ -55,7 +55,7 @@ toml = "0.5" tree-sitter = "0.19.5" tree-sitter-rust = "0.19.0" url = "2.2" -zed-rpc = { path = "../zed-rpc" } +zrpc = { path = "../zrpc" } [dev-dependencies] cargo-bundle = "0.5.0" diff --git a/zed/src/editor/buffer.rs b/zed/src/editor/buffer.rs index 9b4f898002..6c1a0af436 100644 --- a/zed/src/editor/buffer.rs +++ b/zed/src/editor/buffer.rs @@ -11,7 +11,7 @@ use seahash::SeaHasher; pub use selection::*; use similar::{ChangeTag, TextDiff}; use tree_sitter::{InputEdit, Parser, QueryCursor}; -use zed_rpc::proto; +use zrpc::proto; use crate::{ language::{Language, Tree}, diff --git a/zed/src/lib.rs b/zed/src/lib.rs index f666d42297..d550c0ee49 100644 --- a/zed/src/lib.rs +++ b/zed/src/lib.rs @@ -1,4 +1,4 @@ -use zed_rpc::ForegroundRouter; +use zrpc::ForegroundRouter; pub mod assets; pub mod editor; diff --git a/zed/src/main.rs b/zed/src/main.rs index a3bb0224e5..4630f215cb 100644 --- a/zed/src/main.rs +++ b/zed/src/main.rs @@ -11,7 +11,7 @@ use zed::{ worktree::{self, RealFs}, AppState, }; -use zed_rpc::ForegroundRouter; +use zrpc::ForegroundRouter; fn main() { init_logger(); diff --git a/zed/src/rpc.rs b/zed/src/rpc.rs index a64ac43084..f455376f20 100644 --- a/zed/src/rpc.rs +++ b/zed/src/rpc.rs @@ -9,8 +9,8 @@ use std::collections::HashMap; use std::time::Duration; use std::{convert::TryFrom, future::Future, sync::Arc}; use surf::Url; -pub use zed_rpc::{proto, ConnectionId, PeerId, TypedEnvelope}; -use zed_rpc::{ +pub use zrpc::{proto, ConnectionId, PeerId, TypedEnvelope}; +use zrpc::{ proto::{EnvelopedMessage, RequestMessage}, ForegroundRouter, Peer, Receipt, }; @@ -158,7 +158,7 @@ impl Client { // zed server to encrypt the user's access token, so that it can'be intercepted by // any other app running on the user's device. let (public_key, private_key) = - zed_rpc::auth::keypair().expect("failed to generate keypair for auth"); + zrpc::auth::keypair().expect("failed to generate keypair for auth"); let public_key_string = String::try_from(public_key).expect("failed to serialize public key for auth"); diff --git a/zed/src/test.rs b/zed/src/test.rs index 595c2d5bd6..c08f65937c 100644 --- a/zed/src/test.rs +++ b/zed/src/test.rs @@ -7,10 +7,10 @@ use std::{ sync::Arc, }; use tempdir::TempDir; -use zed_rpc::ForegroundRouter; +use zrpc::ForegroundRouter; #[cfg(feature = "test-support")] -pub use zed_rpc::test::Channel; +pub use zrpc::test::Channel; #[cfg(test)] #[ctor::ctor] diff --git a/zed/src/time.rs b/zed/src/time.rs index 8b665e8814..96418131f2 100644 --- a/zed/src/time.rs +++ b/zed/src/time.rs @@ -61,8 +61,8 @@ impl<'a> AddAssign<&'a Local> for Local { #[derive(Clone, Default, Hash, Eq, PartialEq)] pub struct Global(SmallVec<[Local; 3]>); -impl From> for Global { - fn from(message: Vec) -> Self { +impl From> for Global { + fn from(message: Vec) -> Self { let mut version = Self::new(); for entry in message { version.observe(Local { @@ -74,11 +74,11 @@ impl From> for Global { } } -impl<'a> From<&'a Global> for Vec { +impl<'a> From<&'a Global> for Vec { fn from(version: &'a Global) -> Self { version .iter() - .map(|entry| zed_rpc::proto::VectorClockEntry { + .map(|entry| zrpc::proto::VectorClockEntry { replica_id: entry.replica_id as u32, timestamp: entry.value, }) diff --git a/zed/src/worktree.rs b/zed/src/worktree.rs index 01b497a9da..fff16084cc 100644 --- a/zed/src/worktree.rs +++ b/zed/src/worktree.rs @@ -49,7 +49,7 @@ use std::{ }, time::{Duration, SystemTime}, }; -use zed_rpc::{ForegroundRouter, PeerId, TypedEnvelope}; +use zrpc::{ForegroundRouter, PeerId, TypedEnvelope}; lazy_static! { static ref GITIGNORE: &'static OsStr = OsStr::new(".gitignore"); diff --git a/zed-rpc/Cargo.toml b/zrpc/Cargo.toml similarity index 97% rename from zed-rpc/Cargo.toml rename to zrpc/Cargo.toml index 8d824f192d..5d78f46bb1 100644 --- a/zed-rpc/Cargo.toml +++ b/zrpc/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Shared logic for communication between the Zed app and the zed.dev server" edition = "2018" -name = "zed-rpc" +name = "zrpc" version = "0.1.0" [features] diff --git a/zed-rpc/build.rs b/zrpc/build.rs similarity index 100% rename from zed-rpc/build.rs rename to zrpc/build.rs diff --git a/zed-rpc/proto/zed.proto b/zrpc/proto/zed.proto similarity index 100% rename from zed-rpc/proto/zed.proto rename to zrpc/proto/zed.proto diff --git a/zed-rpc/src/auth.rs b/zrpc/src/auth.rs similarity index 100% rename from zed-rpc/src/auth.rs rename to zrpc/src/auth.rs diff --git a/zed-rpc/src/lib.rs b/zrpc/src/lib.rs similarity index 100% rename from zed-rpc/src/lib.rs rename to zrpc/src/lib.rs diff --git a/zed-rpc/src/peer.rs b/zrpc/src/peer.rs similarity index 100% rename from zed-rpc/src/peer.rs rename to zrpc/src/peer.rs diff --git a/zed-rpc/src/proto.rs b/zrpc/src/proto.rs similarity index 100% rename from zed-rpc/src/proto.rs rename to zrpc/src/proto.rs diff --git a/zed-rpc/src/test.rs b/zrpc/src/test.rs similarity index 100% rename from zed-rpc/src/test.rs rename to zrpc/src/test.rs