Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Remove unused --nc flag and nc crate (#55962)

Agus Zubiagaef5da3ccc25c
diff --git a/.github/CODEOWNERS.hold b/.github/CODEOWNERS.hold
index c0dec880c71..410d473c1f7 100644
--- a/.github/CODEOWNERS.hold
+++ b/.github/CODEOWNERS.hold
@@ -181,7 +181,6 @@
/crates/fs_benchmarks/ @zed-industries/infrastructure-team
/crates/http_client/ @zed-industries/infrastructure-team
/crates/http_client_tls/ @zed-industries/infrastructure-team
-/crates/nc/ @zed-industries/infrastructure-team
/crates/net/ @zed-industries/infrastructure-team
/crates/paths/ @zed-industries/infrastructure-team
/crates/release_channel/ @zed-industries/infrastructure-team
diff --git a/Cargo.lock b/Cargo.lock
index 97bafe5737e..34657ef738a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -11725,16 +11725,6 @@ dependencies = [
"uuid",
]
-[[package]]
-name = "nc"
-version = "0.1.0"
-dependencies = [
- "anyhow",
- "futures 0.3.32",
- "net",
- "smol",
-]
-
[[package]]
name = "ndk"
version = "0.9.0"
@@ -23598,7 +23588,6 @@ dependencies = [
"migrator",
"mimalloc",
"miniprofiler_ui",
- "nc",
"node_runtime",
"notifications",
"onboarding",
diff --git a/Cargo.toml b/Cargo.toml
index a3bd7b2e32f..57088d9e56d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -137,7 +137,6 @@ members = [
"crates/miniprofiler_ui",
"crates/mistral",
"crates/multi_buffer",
- "crates/nc",
"crates/net",
"crates/node_runtime",
"crates/notifications",
@@ -399,7 +398,6 @@ migrator = { path = "crates/migrator" }
mistral = { path = "crates/mistral" }
multi_buffer = { path = "crates/multi_buffer" }
miniprofiler_ui = { path = "crates/miniprofiler_ui" }
-nc = { path = "crates/nc" }
net = { path = "crates/net" }
node_runtime = { path = "crates/node_runtime" }
notifications = { path = "crates/notifications" }
diff --git a/crates/nc/Cargo.toml b/crates/nc/Cargo.toml
deleted file mode 100644
index 534ec2271ca..00000000000
--- a/crates/nc/Cargo.toml
+++ /dev/null
@@ -1,19 +0,0 @@
-[package]
-name = "nc"
-version = "0.1.0"
-edition.workspace = true
-publish.workspace = true
-license = "GPL-3.0-or-later"
-
-[lints]
-workspace = true
-
-[lib]
-path = "src/nc.rs"
-doctest = false
-
-[dependencies]
-anyhow.workspace = true
-futures.workspace = true
-net.workspace = true
-smol.workspace = true
diff --git a/crates/nc/LICENSE-GPL b/crates/nc/LICENSE-GPL
deleted file mode 120000
index 89e542f750c..00000000000
--- a/crates/nc/LICENSE-GPL
+++ /dev/null
@@ -1 +0,0 @@
-../../LICENSE-GPL
\ No newline at end of file
diff --git a/crates/nc/src/nc.rs b/crates/nc/src/nc.rs
deleted file mode 100644
index d1849e23610..00000000000
--- a/crates/nc/src/nc.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-use anyhow::Result;
-
-#[cfg(windows)]
-pub fn main(_socket: &str) -> Result<()> {
- // It looks like we can't get an async stdio stream on Windows from smol.
- panic!("--nc isn't yet supported on Windows");
-}
-
-/// The main function for when Zed is running in netcat mode
-#[cfg(not(windows))]
-pub fn main(socket: &str) -> Result<()> {
- use futures::{AsyncReadExt as _, AsyncWriteExt as _, FutureExt as _, io::BufReader, select};
- use net::async_net::UnixStream;
- use smol::{Unblock, io::AsyncBufReadExt};
-
- smol::block_on(async {
- let socket_stream = UnixStream::connect(socket).await?;
- let (socket_read, mut socket_write) = socket_stream.split();
- let mut socket_reader = BufReader::new(socket_read);
-
- let mut stdout = Unblock::new(std::io::stdout());
- let stdin = Unblock::new(std::io::stdin());
- let mut stdin_reader = BufReader::new(stdin);
-
- let mut socket_line = Vec::new();
- let mut stdin_line = Vec::new();
-
- loop {
- select! {
- bytes_read = socket_reader.read_until(b'\n', &mut socket_line).fuse() => {
- if bytes_read? == 0 {
- break
- }
- stdout.write_all(&socket_line).await?;
- stdout.flush().await?;
- socket_line.clear();
- }
- bytes_read = stdin_reader.read_until(b'\n', &mut stdin_line).fuse() => {
- if bytes_read? == 0 {
- break
- }
- socket_write.write_all(&stdin_line).await?;
- socket_write.flush().await?;
- stdin_line.clear();
- }
- }
- }
-
- anyhow::Ok(())
- })
-}
diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml
index 691f06719bb..6bd33833b53 100644
--- a/crates/zed/Cargo.toml
+++ b/crates/zed/Cargo.toml
@@ -156,7 +156,6 @@ menu.workspace = true
migrator.workspace = true
miniprofiler_ui.workspace = true
mimalloc = { version = "0.1", optional = true }
-nc.workspace = true
node_runtime.workspace = true
notifications.workspace = true
onboarding.workspace = true
diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs
index 6a832da767c..8476392b7af 100644
--- a/crates/zed/src/main.rs
+++ b/crates/zed/src/main.rs
@@ -244,17 +244,6 @@ fn main() {
return;
}
- // `zed --nc` Makes zed operate in nc/netcat mode for use with MCP
- if let Some(socket) = &args.nc {
- match nc::main(socket) {
- Ok(()) => return,
- Err(err) => {
- eprintln!("Error: {}", err);
- process::exit(1);
- }
- }
- }
-
#[cfg(all(not(debug_assertions), target_os = "windows"))]
unsafe {
use windows::Win32::System::Console::{ATTACH_PARENT_PROCESS, AttachConsole};
@@ -1831,11 +1820,6 @@ struct Args {
#[arg(long)]
system_specs: bool,
- /// Used for the MCP Server, to remove the need for netcat as a dependency,
- /// by having Zed act like netcat communicating over a Unix socket.
- #[arg(long, hide = true)]
- nc: Option<String>,
-
/// Used for recording minidumps on crashes by having Zed run a separate
/// process communicating over a socket.
#[arg(long, hide = true)]