Extract cli's communication with Zed to a separate crate
This commit is contained in:
parent
990dac51aa
commit
f34014b279
8 changed files with 68 additions and 31 deletions
69
Cargo.lock
generated
69
Cargo.lock
generated
|
@ -1230,6 +1230,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"anyhow",
|
||||
"clap 3.2.25",
|
||||
"cli_rpc",
|
||||
"core-foundation",
|
||||
"core-services",
|
||||
"dirs 3.0.2",
|
||||
|
@ -1240,6 +1241,15 @@ dependencies = [
|
|||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cli_rpc"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ipc-channel",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "client"
|
||||
version = "0.1.0"
|
||||
|
@ -1855,7 +1865,6 @@ checksum = "14d05c10f541ae6f3bc5b3d923c20001f47db7d5f0b2bc6ad16490133842db79"
|
|||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"libnghttp2-sys",
|
||||
"libz-sys",
|
||||
"openssl-sys",
|
||||
"pkg-config",
|
||||
|
@ -2885,20 +2894,12 @@ dependencies = [
|
|||
"anyhow",
|
||||
"async-task",
|
||||
"backtrace",
|
||||
"bindgen",
|
||||
"block",
|
||||
"cc",
|
||||
"cocoa",
|
||||
"collections",
|
||||
"core-foundation",
|
||||
"core-graphics",
|
||||
"core-text",
|
||||
"ctor",
|
||||
"dhat",
|
||||
"env_logger 0.9.3",
|
||||
"etagere",
|
||||
"font-kit",
|
||||
"foreign-types",
|
||||
"futures 0.3.28",
|
||||
"gpui_macros",
|
||||
"image",
|
||||
|
@ -2906,9 +2907,7 @@ dependencies = [
|
|||
"lazy_static",
|
||||
"log",
|
||||
"media",
|
||||
"metal",
|
||||
"num_cpus",
|
||||
"objc",
|
||||
"ordered-float",
|
||||
"parking",
|
||||
"parking_lot 0.11.2",
|
||||
|
@ -2936,6 +2935,41 @@ dependencies = [
|
|||
"waker-fn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gpui_mac"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-task",
|
||||
"bindgen",
|
||||
"block",
|
||||
"cc",
|
||||
"cocoa",
|
||||
"collections",
|
||||
"core-foundation",
|
||||
"core-graphics",
|
||||
"core-text",
|
||||
"ctor",
|
||||
"etagere",
|
||||
"font-kit",
|
||||
"foreign-types",
|
||||
"gpui",
|
||||
"log",
|
||||
"media",
|
||||
"metal",
|
||||
"objc",
|
||||
"ordered-float",
|
||||
"parking_lot 0.11.2",
|
||||
"pathfinder_geometry",
|
||||
"postage",
|
||||
"resvg",
|
||||
"smol",
|
||||
"time 0.3.21",
|
||||
"tiny-skia",
|
||||
"usvg",
|
||||
"uuid 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gpui_macros"
|
||||
version = "0.1.0"
|
||||
|
@ -3691,16 +3725,6 @@ version = "0.2.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb"
|
||||
|
||||
[[package]]
|
||||
name = "libnghttp2-sys"
|
||||
version = "0.1.7+1.45.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57ed28aba195b38d5ff02b9170cbff627e336a20925e43b4945390401c5dc93f"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
version = "0.24.2"
|
||||
|
@ -8919,7 +8943,7 @@ dependencies = [
|
|||
"breadcrumbs",
|
||||
"call",
|
||||
"chrono",
|
||||
"cli",
|
||||
"cli_rpc",
|
||||
"client",
|
||||
"clock",
|
||||
"collab_ui",
|
||||
|
@ -8941,6 +8965,7 @@ dependencies = [
|
|||
"fuzzy",
|
||||
"go_to_line",
|
||||
"gpui",
|
||||
"gpui_mac",
|
||||
"ignore",
|
||||
"image",
|
||||
"indexmap",
|
||||
|
|
|
@ -6,6 +6,7 @@ members = [
|
|||
"crates/breadcrumbs",
|
||||
"crates/call",
|
||||
"crates/cli",
|
||||
"crates/cli_rpc",
|
||||
"crates/client",
|
||||
"crates/clock",
|
||||
"crates/collab",
|
||||
|
@ -27,6 +28,7 @@ members = [
|
|||
"crates/git",
|
||||
"crates/go_to_line",
|
||||
"crates/gpui",
|
||||
"crates/gpui_mac",
|
||||
"crates/gpui_macros",
|
||||
"crates/install_cli",
|
||||
"crates/journal",
|
||||
|
@ -79,7 +81,7 @@ env_logger = { version = "0.9" }
|
|||
futures = { version = "0.3" }
|
||||
globset = { version = "0.4" }
|
||||
indoc = "1"
|
||||
isahc = "1.7.2"
|
||||
isahc = {version = "1.7.2", default-features = false, features = ["text-decoding"]}
|
||||
lazy_static = { version = "1.4.0" }
|
||||
log = { version = "0.4.16", features = ["kv_unstable_serde"] }
|
||||
ordered-float = { version = "2.1.1" }
|
||||
|
|
|
@ -4,9 +4,6 @@ version = "0.1.0"
|
|||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
path = "src/cli.rs"
|
||||
doctest = false
|
||||
|
||||
[[bin]]
|
||||
name = "cli"
|
||||
|
@ -20,6 +17,7 @@ ipc-channel = "0.16"
|
|||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
util = { path = "../util" }
|
||||
cli_rpc = {path = "../cli_rpc"}
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
core-foundation = "0.9"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::{anyhow, Context, Result};
|
||||
use clap::Parser;
|
||||
use cli::{CliRequest, CliResponse, IpcHandshake, FORCE_CLI_MODE_ENV_VAR_NAME};
|
||||
use cli_rpc::{CliRequest, CliResponse, IpcHandshake, FORCE_CLI_MODE_ENV_VAR_NAME};
|
||||
use core_foundation::{
|
||||
array::{CFArray, CFIndex},
|
||||
string::kCFStringEncodingUTF8,
|
||||
|
|
11
crates/cli_rpc/Cargo.toml
Normal file
11
crates/cli_rpc/Cargo.toml
Normal file
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "cli_rpc"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
ipc-channel = "0.16"
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
|
@ -20,7 +20,7 @@ activity_indicator = { path = "../activity_indicator" }
|
|||
auto_update = { path = "../auto_update" }
|
||||
breadcrumbs = { path = "../breadcrumbs" }
|
||||
call = { path = "../call" }
|
||||
cli = { path = "../cli" }
|
||||
cli_rpc = { path = "../cli_rpc" }
|
||||
collab_ui = { path = "../collab_ui" }
|
||||
collections = { path = "../collections" }
|
||||
command_palette = { path = "../command_palette" }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use backtrace::Backtrace;
|
||||
use cli::{
|
||||
use cli_rpc::{
|
||||
ipc::{self, IpcSender},
|
||||
CliRequest, CliResponse, IpcHandshake, FORCE_CLI_MODE_ENV_VAR_NAME,
|
||||
};
|
||||
|
@ -67,7 +67,8 @@ fn main() {
|
|||
|
||||
log::info!("========== starting zed ==========");
|
||||
let platform = platform();
|
||||
let foreground = std::rc::Rc::new(gpui::executor::Foreground::platform(platform.dispatcher()).unwrap());
|
||||
let foreground =
|
||||
std::rc::Rc::new(gpui::executor::Foreground::platform(platform.dispatcher()).unwrap());
|
||||
let fplatform = foreground_platform(foreground);
|
||||
let mut app = gpui::App::new(Assets, platform, fplatform).unwrap();
|
||||
|
||||
|
@ -666,7 +667,7 @@ async fn watch_languages(_: Arc<dyn Fs>, _: Arc<LanguageRegistry>) -> Option<()>
|
|||
fn connect_to_cli(
|
||||
server_name: &str,
|
||||
) -> Result<(mpsc::Receiver<CliRequest>, IpcSender<CliResponse>)> {
|
||||
let handshake_tx = cli::ipc::IpcSender::<IpcHandshake>::connect(server_name.to_string())
|
||||
let handshake_tx = cli_rpc::ipc::IpcSender::<IpcHandshake>::connect(server_name.to_string())
|
||||
.context("error connecting to cli")?;
|
||||
let (request_tx, request_rx) = ipc::channel::<CliRequest>()?;
|
||||
let (response_tx, response_rx) = ipc::channel::<CliResponse>()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue