mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
Rename zed-rpc
to zrpc
Co-Authored-By: Nathan Sobo <nathan@zed.dev> Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
c4e37dc47c
commit
391ad489ff
46
Cargo.lock
generated
46
Cargo.lock
generated
@ -5834,28 +5834,7 @@ dependencies = [
|
|||||||
"tree-sitter-rust",
|
"tree-sitter-rust",
|
||||||
"unindent",
|
"unindent",
|
||||||
"url",
|
"url",
|
||||||
"zed-rpc",
|
"zrpc",
|
||||||
]
|
|
||||||
|
|
||||||
[[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",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -5894,7 +5873,7 @@ dependencies = [
|
|||||||
"tide-compress",
|
"tide-compress",
|
||||||
"toml 0.5.8",
|
"toml 0.5.8",
|
||||||
"zed",
|
"zed",
|
||||||
"zed-rpc",
|
"zrpc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -5917,3 +5896,24 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
"synstructure",
|
"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",
|
||||||
|
]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = ["fsevent", "gpui", "gpui_macros", "server", "zed", "zed-rpc"]
|
members = ["fsevent", "gpui", "gpui_macros", "server", "zed", "zrpc"]
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
async-task = { git = "https://github.com/zed-industries/async-task", rev = "341b57d6de98cdfd7b418567b8de2022ca993a6e" }
|
async-task = { git = "https://github.com/zed-industries/async-task", rev = "341b57d6de98cdfd7b418567b8de2022ca993a6e" }
|
||||||
|
@ -32,7 +32,7 @@ surf = "2.2.0"
|
|||||||
tide = "0.16.0"
|
tide = "0.16.0"
|
||||||
tide-compress = "0.9.0"
|
tide-compress = "0.9.0"
|
||||||
toml = "0.5.8"
|
toml = "0.5.8"
|
||||||
zed-rpc = { path = "../zed-rpc" }
|
zrpc = { path = "../zrpc" }
|
||||||
|
|
||||||
[dependencies.async-sqlx-session]
|
[dependencies.async-sqlx-session]
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
@ -18,7 +18,7 @@ use sqlx::FromRow;
|
|||||||
use std::{borrow::Cow, convert::TryFrom, sync::Arc};
|
use std::{borrow::Cow, convert::TryFrom, sync::Arc};
|
||||||
use surf::Url;
|
use surf::Url;
|
||||||
use tide::Server;
|
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 CURRENT_GITHUB_USER: &'static str = "current_github_user";
|
||||||
static GITHUB_AUTH_URL: &'static str = "https://github.com/login/oauth/authorize";
|
static GITHUB_AUTH_URL: &'static str = "https://github.com/login/oauth/authorize";
|
||||||
@ -124,7 +124,7 @@ impl RequestExt for Request {
|
|||||||
pub trait PeerExt {
|
pub trait PeerExt {
|
||||||
async fn sign_out(
|
async fn sign_out(
|
||||||
self: &Arc<Self>,
|
self: &Arc<Self>,
|
||||||
connection_id: zed_rpc::ConnectionId,
|
connection_id: zrpc::ConnectionId,
|
||||||
state: &AppState,
|
state: &AppState,
|
||||||
) -> tide::Result<()>;
|
) -> tide::Result<()>;
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ pub trait PeerExt {
|
|||||||
impl PeerExt for Peer {
|
impl PeerExt for Peer {
|
||||||
async fn sign_out(
|
async fn sign_out(
|
||||||
self: &Arc<Self>,
|
self: &Arc<Self>,
|
||||||
connection_id: zed_rpc::ConnectionId,
|
connection_id: zrpc::ConnectionId,
|
||||||
state: &AppState,
|
state: &AppState,
|
||||||
) -> tide::Result<()> {
|
) -> tide::Result<()> {
|
||||||
self.disconnect(connection_id).await;
|
self.disconnect(connection_id).await;
|
||||||
|
@ -26,7 +26,7 @@ use std::sync::Arc;
|
|||||||
use surf::http::cookies::SameSite;
|
use surf::http::cookies::SameSite;
|
||||||
use tide::{log, sessions::SessionMiddleware};
|
use tide::{log, sessions::SessionMiddleware};
|
||||||
use tide_compress::CompressMiddleware;
|
use tide_compress::CompressMiddleware;
|
||||||
use zed_rpc::Peer;
|
use zrpc::Peer;
|
||||||
|
|
||||||
type Request = tide::Request<Arc<AppState>>;
|
type Request = tide::Request<Arc<AppState>>;
|
||||||
type DbPool = PgPool;
|
type DbPool = PgPool;
|
||||||
|
@ -21,7 +21,7 @@ use tide::{
|
|||||||
http::headers::{HeaderName, CONNECTION, UPGRADE},
|
http::headers::{HeaderName, CONNECTION, UPGRADE},
|
||||||
Request, Response,
|
Request, Response,
|
||||||
};
|
};
|
||||||
use zed_rpc::{
|
use zrpc::{
|
||||||
auth::random_token,
|
auth::random_token,
|
||||||
proto::{self, EnvelopedMessage},
|
proto::{self, EnvelopedMessage},
|
||||||
ConnectionId, Peer, Router, TypedEnvelope,
|
ConnectionId, Peer, Router, TypedEnvelope,
|
||||||
|
@ -21,7 +21,7 @@ use zed::{
|
|||||||
test::{temp_tree, Channel},
|
test::{temp_tree, Channel},
|
||||||
worktree::{FakeFs, Fs, RealFs, Worktree},
|
worktree::{FakeFs, Fs, RealFs, Worktree},
|
||||||
};
|
};
|
||||||
use zed_rpc::{ForegroundRouter, Peer, Router};
|
use zrpc::{ForegroundRouter, Peer, Router};
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_share_worktree(mut cx_a: TestAppContext, mut cx_b: TestAppContext) {
|
async fn test_share_worktree(mut cx_a: TestAppContext, mut cx_b: TestAppContext) {
|
||||||
|
@ -14,7 +14,7 @@ name = "Zed"
|
|||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
test-support = ["tempdir", "serde_json", "zed-rpc/test-support"]
|
test-support = ["tempdir", "serde_json", "zrpc/test-support"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.38"
|
anyhow = "1.0.38"
|
||||||
@ -42,7 +42,7 @@ rust-embed = "5.9.0"
|
|||||||
seahash = "4.1"
|
seahash = "4.1"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = { version = "1.0.64", features = [
|
serde_json = { version = "1.0.64", features = [
|
||||||
"preserve_order"
|
"preserve_order",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
similar = "1.3"
|
similar = "1.3"
|
||||||
simplelog = "0.9"
|
simplelog = "0.9"
|
||||||
@ -55,7 +55,7 @@ toml = "0.5"
|
|||||||
tree-sitter = "0.19.5"
|
tree-sitter = "0.19.5"
|
||||||
tree-sitter-rust = "0.19.0"
|
tree-sitter-rust = "0.19.0"
|
||||||
url = "2.2"
|
url = "2.2"
|
||||||
zed-rpc = { path = "../zed-rpc" }
|
zrpc = { path = "../zrpc" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
cargo-bundle = "0.5.0"
|
cargo-bundle = "0.5.0"
|
||||||
|
@ -11,7 +11,7 @@ use seahash::SeaHasher;
|
|||||||
pub use selection::*;
|
pub use selection::*;
|
||||||
use similar::{ChangeTag, TextDiff};
|
use similar::{ChangeTag, TextDiff};
|
||||||
use tree_sitter::{InputEdit, Parser, QueryCursor};
|
use tree_sitter::{InputEdit, Parser, QueryCursor};
|
||||||
use zed_rpc::proto;
|
use zrpc::proto;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
language::{Language, Tree},
|
language::{Language, Tree},
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use zed_rpc::ForegroundRouter;
|
use zrpc::ForegroundRouter;
|
||||||
|
|
||||||
pub mod assets;
|
pub mod assets;
|
||||||
pub mod editor;
|
pub mod editor;
|
||||||
|
@ -11,7 +11,7 @@ use zed::{
|
|||||||
worktree::{self, RealFs},
|
worktree::{self, RealFs},
|
||||||
AppState,
|
AppState,
|
||||||
};
|
};
|
||||||
use zed_rpc::ForegroundRouter;
|
use zrpc::ForegroundRouter;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
init_logger();
|
init_logger();
|
||||||
|
@ -9,8 +9,8 @@ use std::collections::HashMap;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::{convert::TryFrom, future::Future, sync::Arc};
|
use std::{convert::TryFrom, future::Future, sync::Arc};
|
||||||
use surf::Url;
|
use surf::Url;
|
||||||
pub use zed_rpc::{proto, ConnectionId, PeerId, TypedEnvelope};
|
pub use zrpc::{proto, ConnectionId, PeerId, TypedEnvelope};
|
||||||
use zed_rpc::{
|
use zrpc::{
|
||||||
proto::{EnvelopedMessage, RequestMessage},
|
proto::{EnvelopedMessage, RequestMessage},
|
||||||
ForegroundRouter, Peer, Receipt,
|
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
|
// 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.
|
// any other app running on the user's device.
|
||||||
let (public_key, private_key) =
|
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 =
|
let public_key_string =
|
||||||
String::try_from(public_key).expect("failed to serialize public key for auth");
|
String::try_from(public_key).expect("failed to serialize public key for auth");
|
||||||
|
|
||||||
|
@ -7,10 +7,10 @@ use std::{
|
|||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
use tempdir::TempDir;
|
use tempdir::TempDir;
|
||||||
use zed_rpc::ForegroundRouter;
|
use zrpc::ForegroundRouter;
|
||||||
|
|
||||||
#[cfg(feature = "test-support")]
|
#[cfg(feature = "test-support")]
|
||||||
pub use zed_rpc::test::Channel;
|
pub use zrpc::test::Channel;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[ctor::ctor]
|
#[ctor::ctor]
|
||||||
|
@ -61,8 +61,8 @@ impl<'a> AddAssign<&'a Local> for Local {
|
|||||||
#[derive(Clone, Default, Hash, Eq, PartialEq)]
|
#[derive(Clone, Default, Hash, Eq, PartialEq)]
|
||||||
pub struct Global(SmallVec<[Local; 3]>);
|
pub struct Global(SmallVec<[Local; 3]>);
|
||||||
|
|
||||||
impl From<Vec<zed_rpc::proto::VectorClockEntry>> for Global {
|
impl From<Vec<zrpc::proto::VectorClockEntry>> for Global {
|
||||||
fn from(message: Vec<zed_rpc::proto::VectorClockEntry>) -> Self {
|
fn from(message: Vec<zrpc::proto::VectorClockEntry>) -> Self {
|
||||||
let mut version = Self::new();
|
let mut version = Self::new();
|
||||||
for entry in message {
|
for entry in message {
|
||||||
version.observe(Local {
|
version.observe(Local {
|
||||||
@ -74,11 +74,11 @@ impl From<Vec<zed_rpc::proto::VectorClockEntry>> for Global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a Global> for Vec<zed_rpc::proto::VectorClockEntry> {
|
impl<'a> From<&'a Global> for Vec<zrpc::proto::VectorClockEntry> {
|
||||||
fn from(version: &'a Global) -> Self {
|
fn from(version: &'a Global) -> Self {
|
||||||
version
|
version
|
||||||
.iter()
|
.iter()
|
||||||
.map(|entry| zed_rpc::proto::VectorClockEntry {
|
.map(|entry| zrpc::proto::VectorClockEntry {
|
||||||
replica_id: entry.replica_id as u32,
|
replica_id: entry.replica_id as u32,
|
||||||
timestamp: entry.value,
|
timestamp: entry.value,
|
||||||
})
|
})
|
||||||
|
@ -49,7 +49,7 @@ use std::{
|
|||||||
},
|
},
|
||||||
time::{Duration, SystemTime},
|
time::{Duration, SystemTime},
|
||||||
};
|
};
|
||||||
use zed_rpc::{ForegroundRouter, PeerId, TypedEnvelope};
|
use zrpc::{ForegroundRouter, PeerId, TypedEnvelope};
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref GITIGNORE: &'static OsStr = OsStr::new(".gitignore");
|
static ref GITIGNORE: &'static OsStr = OsStr::new(".gitignore");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
description = "Shared logic for communication between the Zed app and the zed.dev server"
|
description = "Shared logic for communication between the Zed app and the zed.dev server"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
name = "zed-rpc"
|
name = "zrpc"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
Loading…
Reference in New Issue
Block a user