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 some unnecessary dependencies (#64862)

Xin Zhao98f75a23bc40
diff --git a/Cargo.lock b/Cargo.lock
index 633872e6929..3eb7bbd0f00 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -106,12 +106,12 @@ dependencies = [
"itertools 0.14.0",
"language",
"language_model",
+ "libc",
"log",
"markdown",
"mime",
"multi_buffer",
"parking_lot",
- "portable-pty",
"project",
"rand 0.9.4",
"sandbox",
@@ -1359,7 +1359,7 @@ dependencies = [
"anyhow",
"collections",
"cpal",
- "crossbeam",
+ "crossbeam-queue",
"gpui",
"libwebrtc",
"log",
@@ -2392,7 +2392,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce"
dependencies = [
"borsh-derive",
- "cfg_aliases 0.2.1",
+ "cfg_aliases",
]
[[package]]
@@ -2910,12 +2910,6 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
-[[package]]
-name = "cfg_aliases"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
-
[[package]]
name = "cfg_aliases"
version = "0.2.1"
@@ -3532,7 +3526,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f849b92c694fe237ecd8fafd1ba0df7ae0d45c1df6daeb7f68ed4220d51640bd"
dependencies = [
- "nix 0.30.1",
+ "nix",
"thiserror 2.0.17",
]
@@ -4399,19 +4393,6 @@ dependencies = [
"itertools 0.13.0",
]
-[[package]]
-name = "crossbeam"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8"
-dependencies = [
- "crossbeam-channel",
- "crossbeam-deque",
- "crossbeam-epoch",
- "crossbeam-queue",
- "crossbeam-utils",
-]
-
[[package]]
name = "crossbeam-channel"
version = "0.5.15"
@@ -4544,7 +4525,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "881c5d0a13b2f1498e2306e82cbada78390e152d4b1378fb28a84f4dcd0dc4f3"
dependencies = [
"dispatch",
- "nix 0.30.1",
+ "nix",
"windows-sys 0.61.2",
]
@@ -4673,7 +4654,6 @@ dependencies = [
"futures 0.3.34",
"gpui",
"http_client",
- "json_dotpath",
"language",
"log",
"node_runtime",
@@ -7664,7 +7644,6 @@ dependencies = [
"wayland-protocols",
"wayland-protocols-plasma",
"wayland-protocols-wlr",
- "x11-clipboard",
"x11rb",
"xkbcommon",
"zed-scap",
@@ -9345,18 +9324,6 @@ dependencies = [
"ucd-trie",
]
-[[package]]
-name = "json_dotpath"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dbdcfef3cf5591f0cef62da413ae795e3d1f5a00936ccec0b2071499a32efd1a"
-dependencies = [
- "serde",
- "serde_derive",
- "serde_json",
- "thiserror 1.0.69",
-]
-
[[package]]
name = "json_schema_store"
version = "0.1.0"
@@ -11332,7 +11299,7 @@ dependencies = [
"bit-set 0.9.1",
"bitflags 2.13.1",
"cfg-if",
- "cfg_aliases 0.2.1",
+ "cfg_aliases",
"codespan-reporting",
"half",
"hashbrown 0.16.1",
@@ -11440,18 +11407,6 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
-[[package]]
-name = "nix"
-version = "0.28.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
-dependencies = [
- "bitflags 2.13.1",
- "cfg-if",
- "cfg_aliases 0.1.1",
- "libc",
-]
-
[[package]]
name = "nix"
version = "0.30.1"
@@ -11460,7 +11415,7 @@ checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
dependencies = [
"bitflags 2.13.1",
"cfg-if",
- "cfg_aliases 0.2.1",
+ "cfg_aliases",
"libc",
"memoffset",
]
@@ -13884,27 +13839,6 @@ dependencies = [
"portable-atomic",
]
-[[package]]
-name = "portable-pty"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4a596a2b3d2752d94f51fac2d4a96737b8705dddd311a32b9af47211f08671e"
-dependencies = [
- "anyhow",
- "bitflags 1.3.2",
- "downcast-rs",
- "filedescriptor",
- "lazy_static",
- "libc",
- "log",
- "nix 0.28.0",
- "serial2",
- "shared_library",
- "shell-words",
- "winapi",
- "winreg 0.10.1",
-]
-
[[package]]
name = "postage"
version = "0.5.0"
@@ -14699,7 +14633,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20"
dependencies = [
"bytes 1.11.1",
- "cfg_aliases 0.2.1",
+ "cfg_aliases",
"pin-project-lite",
"quinn-proto",
"quinn-udp",
@@ -14740,7 +14674,7 @@ version = "0.5.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd"
dependencies = [
- "cfg_aliases 0.2.1",
+ "cfg_aliases",
"libc",
"once_cell",
"socket2 0.6.5",
@@ -16085,7 +16019,7 @@ dependencies = [
"http_proxy",
"libc",
"log",
- "nix 0.30.1",
+ "nix",
"seccompiler",
"serde",
"serde_json",
@@ -16674,17 +16608,6 @@ dependencies = [
"unsafe-libyaml",
]
-[[package]]
-name = "serial2"
-version = "0.2.33"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8cc76fa68e25e771492ca1e3c53d447ef0be3093e05cd3b47f4b712ba10c6f3c"
-dependencies = [
- "cfg-if",
- "libc",
- "winapi",
-]
-
[[package]]
name = "servo_arc"
version = "0.4.3"
@@ -16913,16 +16836,6 @@ dependencies = [
"lazy_static",
]
-[[package]]
-name = "shared_library"
-version = "0.1.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11"
-dependencies = [
- "lazy_static",
- "libc",
-]
-
[[package]]
name = "shell-words"
version = "1.1.0"
@@ -18206,12 +18119,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
-[[package]]
-name = "take-until"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8bdb6fa0dfa67b38c1e66b7041ba9dcf23b99d8121907cd31c807a332f7a0bbb"
-
[[package]]
name = "tao-core-video-sys"
version = "0.2.0"
@@ -19894,7 +19801,7 @@ dependencies = [
"libc",
"log",
"mach2 0.5.0",
- "nix 0.30.1",
+ "nix",
"path",
"percent-encoding",
"rand 0.9.4",
@@ -19906,7 +19813,6 @@ dependencies = [
"serde_json_lenient",
"shlex 1.3.0",
"smol",
- "take-until",
"tempfile",
"tendril",
"unicase",
@@ -20978,7 +20884,7 @@ dependencies = [
"bitflags 2.13.1",
"bytemuck",
"cfg-if",
- "cfg_aliases 0.2.1",
+ "cfg_aliases",
"document-features",
"hashbrown 0.16.1",
"js-sys",
@@ -21009,7 +20915,7 @@ dependencies = [
"bit-vec 0.9.1",
"bitflags 2.13.1",
"bytemuck",
- "cfg_aliases 0.2.1",
+ "cfg_aliases",
"document-features",
"hashbrown 0.16.1",
"indexmap 2.14.0",
@@ -21082,7 +20988,7 @@ dependencies = [
"block2 0.6.2",
"bytemuck",
"cfg-if",
- "cfg_aliases 0.2.1",
+ "cfg_aliases",
"glow",
"glutin_wgl_sys",
"gpu-allocator",
@@ -21960,15 +21866,6 @@ dependencies = [
"memchr",
]
-[[package]]
-name = "winreg"
-version = "0.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
-dependencies = [
- "winapi",
-]
-
[[package]]
name = "winreg"
version = "0.50.0"
@@ -22488,16 +22385,6 @@ dependencies = [
"pkg-config",
]
-[[package]]
-name = "x11-clipboard"
-version = "0.9.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "662d74b3d77e396b8e5beb00b9cad6a9eccf40b2ef68cc858784b14c41d535a3"
-dependencies = [
- "libc",
- "x11rb",
-]
-
[[package]]
name = "x11rb"
version = "0.13.2"
diff --git a/Cargo.toml b/Cargo.toml
index 41db7bfee5a..a2c9a4e4c44 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -601,7 +601,7 @@ cpal = "0.17"
crash-handler = "0.8"
criterion = { version = "0.8.2", features = ["html_reports"] }
perf-event = { package = "perf-event2", version = "0.7.4" }
-crossbeam = "0.8.4"
+crossbeam-queue = "0.3.12"
ctor = "1.0.12"
dap-types = { git = "https://github.com/zed-industries/dap-types", rev = "1b461b310481d01e02b2603c16d7144b926339f8" }
dashmap = "6.0"
@@ -675,7 +675,6 @@ indoc = "2"
inventory = "0.3.19"
itertools = "0.14.0"
js-sys = "0.3"
-json_dotpath = "1.1"
jsonschema = { version = "0.51", default-features = false }
jsonwebtoken = "10.0"
jupyter-protocol = "1.4.0"
@@ -780,7 +779,6 @@ pet-poetry = { git = "https://github.com/zed-industries/python-environment-tools
pet-reporter = { git = "https://github.com/zed-industries/python-environment-tools.git", rev = "5aad7164bfc2a58977b103c8ef8fdd7302ed2e9f" }
pet-virtualenv = { git = "https://github.com/zed-industries/python-environment-tools.git", rev = "5aad7164bfc2a58977b103c8ef8fdd7302ed2e9f" }
piper = "0.2"
-portable-pty = "0.9.0"
postage = { version = "0.5", features = ["futures-traits"] }
pretty_assertions = { version = "1.3.0", features = ["unstable"] }
proc-macro2 = "1.0.93"
@@ -857,7 +855,6 @@ swash = "0.2.6"
syn = { version = "2.0.101", features = ["full", "extra-traits", "visit-mut"] }
sys-locale = "0.3.1"
sysinfo = "0.39"
-take-until = "0.2.0"
tempfile = "3.20.0"
thiserror = "2.0.12"
time = { version = "0.3", features = [
diff --git a/crates/acp_thread/Cargo.toml b/crates/acp_thread/Cargo.toml
index a6d873d8eaa..0cd63169ada 100644
--- a/crates/acp_thread/Cargo.toml
+++ b/crates/acp_thread/Cargo.toml
@@ -34,12 +34,12 @@ http_proxy.workspace = true
itertools.workspace = true
language.workspace = true
language_model.workspace = true
+libc.workspace = true
log.workspace = true
markdown.workspace = true
mime.workspace = true
parking_lot = { workspace = true, optional = true }
image.workspace = true
-portable-pty.workspace = true
project.workspace = true
sandbox.workspace = true
serde.workspace = true
diff --git a/crates/acp_thread/src/terminal.rs b/crates/acp_thread/src/terminal.rs
index a785de67a42..b8ef564ae2c 100644
--- a/crates/acp_thread/src/terminal.rs
+++ b/crates/acp_thread/src/terminal.rs
@@ -11,6 +11,7 @@ use serde::{Deserialize, Serialize};
use std::{
collections::HashMap as StdHashMap,
path::PathBuf,
+ process::ExitStatus,
sync::{
Arc,
atomic::{AtomicBool, Ordering},
@@ -475,12 +476,10 @@ impl Terminal {
user_stopped: Arc::new(AtomicBool::new(false)),
execution: TerminalExecution::Process(
cx.spawn(async move |this, cx| {
- let exit_status = command_task.await.map(portable_pty::ExitStatus::from);
+ let exit_status = command_task.await.map(Self::transform_exit_status);
let exit_status = acp::TerminalExitStatus::new()
- .exit_code(exit_status.as_ref().map(|status| status.exit_code()))
- .signal(
- exit_status.and_then(|status| status.signal().map(ToOwned::to_owned)),
- );
+ .exit_code(exit_status.as_ref().map(|status| status.0))
+ .signal(exit_status.and_then(|status| status.1));
this.update(cx, |this, cx| {
this.cache_output(exit_status.clone(), Instant::now(), cx);
@@ -690,6 +689,36 @@ impl Terminal {
self.terminal.read(cx).get_content()
)
}
+
+ // This method is adapted from `portable_pty::ExitStatus::from`, version 0.9.0
+ fn transform_exit_status(exit_status: ExitStatus) -> (u32, Option<String>) {
+ #[cfg(unix)]
+ {
+ use std::os::unix::process::ExitStatusExt;
+
+ if let Some(signal) = exit_status.signal() {
+ let signame = unsafe { libc::strsignal(signal) };
+ let signal = if signame.is_null() {
+ format!("Signal {}", signal)
+ } else {
+ let signame = unsafe { std::ffi::CStr::from_ptr(signame) };
+ signame.to_string_lossy().to_string()
+ };
+
+ return (
+ exit_status.code().map(|c| c as u32).unwrap_or(1),
+ Some(signal),
+ );
+ }
+ }
+
+ let code = exit_status
+ .code()
+ .map(|c| c as u32)
+ .unwrap_or_else(|| if exit_status.success() { 0 } else { 1 });
+
+ (code, None)
+ }
}
pub async fn create_terminal_entity(
diff --git a/crates/audio/Cargo.toml b/crates/audio/Cargo.toml
index 86b042c5fc4..d3f59e293c1 100644
--- a/crates/audio/Cargo.toml
+++ b/crates/audio/Cargo.toml
@@ -16,7 +16,7 @@ doctest = false
anyhow.workspace = true
collections.workspace = true
cpal.workspace = true
-crossbeam.workspace = true
+crossbeam-queue.workspace = true
gpui.workspace = true
log.workspace = true
parking_lot.workspace = true
diff --git a/crates/audio/src/audio_pipeline/rodio_ext.rs b/crates/audio/src/audio_pipeline/rodio_ext.rs
index 8fc716e0339..1b5e097486e 100644
--- a/crates/audio/src/audio_pipeline/rodio_ext.rs
+++ b/crates/audio/src/audio_pipeline/rodio_ext.rs
@@ -7,7 +7,7 @@ use std::{
time::Duration,
};
-use crossbeam::queue::ArrayQueue;
+use crossbeam_queue::ArrayQueue;
use log::warn;
use rodio::{
ChannelCount, Sample, SampleRate, Source, conversions::SampleRateConverter, nz,
diff --git a/crates/dap_adapters/Cargo.toml b/crates/dap_adapters/Cargo.toml
index 302bd2255c3..152c68991d1 100644
--- a/crates/dap_adapters/Cargo.toml
+++ b/crates/dap_adapters/Cargo.toml
@@ -29,7 +29,6 @@ dotenvy.workspace = true
futures.workspace = true
fs.workspace = true
gpui.workspace = true
-json_dotpath.workspace = true
language.workspace = true
log.workspace = true
paths.workspace = true
diff --git a/crates/dap_adapters/src/python.rs b/crates/dap_adapters/src/python.rs
index 07eed167e69..db80aef678d 100644
--- a/crates/dap_adapters/src/python.rs
+++ b/crates/dap_adapters/src/python.rs
@@ -6,7 +6,6 @@ use fs::RemoveOptions;
use futures::{StreamExt, TryStreamExt};
use gpui::http_client::AsyncBody;
use gpui::{AsyncApp, SharedString};
-use json_dotpath::DotPaths;
use language::{LanguageName, Toolchain};
use paths::debug_adapters_dir;
use serde_json::Value;
@@ -94,8 +93,9 @@ impl PythonDebugAdapter {
let request = self.request_kind(&task_definition.config).await?;
let mut configuration = task_definition.config.clone();
- if let Ok(console) = configuration.dot_get_mut("console") {
+ if let Some(object) = configuration.as_object_mut() {
// Use built-in Zed terminal if user did not explicitly provide a setting for console.
+ let console = object.entry("console").or_insert(Value::Null);
if console.is_null() {
*console = Value::String("integratedTerminal".into());
}
diff --git a/crates/gpui_linux/Cargo.toml b/crates/gpui_linux/Cargo.toml
index c4040af022a..812d8d3b995 100644
--- a/crates/gpui_linux/Cargo.toml
+++ b/crates/gpui_linux/Cargo.toml
@@ -40,7 +40,6 @@ x11 = [
"x11rb",
"xkbcommon/x11",
"xim",
- "x11-clipboard",
"filedescriptor",
"open",
"scap?/x11",
@@ -128,10 +127,9 @@ xim = { git = "https://github.com/zed-industries/xim-rs.git", rev = "16f35a2c881
"x11rb-xcb",
"x11rb-client",
], package = "zed-xim", version = "0.4.0-zed", optional = true }
-x11-clipboard = { version = "0.9.3", optional = true }
[target.'cfg(any(target_os = "linux", target_os = "freebsd"))'.dev-dependencies]
gpui = { workspace = true, features = ["test-support"] }
[package.metadata.cargo-shear]
-ignored = ["bitflags", "scap", "x11-clipboard"]
+ignored = ["bitflags", "scap"]
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs
index 3769fec8bea..7fb5e6d7efa 100644
--- a/crates/project_panel/src/project_panel.rs
+++ b/crates/project_panel/src/project_panel.rs
@@ -28,6 +28,7 @@ use gpui::{
UniformListScrollHandle, WeakEntity, Window, actions, anchored, deferred, div, hsla,
linear_color_stop, linear_gradient, point, px, size, transparent_white, uniform_list,
};
+use itertools::Itertools;
use language::DiagnosticSeverity;
use markdown_preview::markdown_preview_view::MarkdownPreviewView;
use menu::{Confirm, SelectFirst, SelectLast, SelectNext, SelectPrevious};
@@ -64,7 +65,7 @@ use ui::{
ScrollAxes, ScrollableHandle, Scrollbars, StickyCandidate, Tooltip, WithScrollbar, prelude::*,
};
use util::{
- ResultExt, TakeUntilExt, TryFutureExt,
+ ResultExt, TryFutureExt,
markdown::MarkdownInlineCode,
maybe,
paths::{PathExt, PathStyle, compare_paths},
@@ -5628,7 +5629,9 @@ impl ProjectPanel {
let first = first_iter
.enumerate()
- .take_until(|(count, entry)| entry.entry == root_entry && *count != 0usize)
+ .take_while_inclusive(|(count, entry)| {
+ entry.entry != root_entry || *count == 0usize
+ })
.map(|(_, entry)| entry)
.find(|ele| predicate(*ele, tree_id))
.map(|ele| ele.to_owned());
@@ -5638,7 +5641,7 @@ impl ProjectPanel {
let second = if reverse_search {
second_iter
- .take_until(|ele| ele.id == start.entry_id)
+ .take_while_inclusive(|ele| ele.id != start.entry_id)
.filter(|ele| predicate(*ele, tree_id))
.last()
.map(|ele| ele.to_owned())
diff --git a/crates/util/Cargo.toml b/crates/util/Cargo.toml
index 7ed25dd73f6..8af679dc964 100644
--- a/crates/util/Cargo.toml
+++ b/crates/util/Cargo.toml
@@ -37,7 +37,6 @@ serde.workspace = true
serde_json.workspace = true
serde_json_lenient.workspace = true
shlex.workspace = true
-take-until.workspace = true
tempfile.workspace = true
unicase.workspace = true
url.workspace = true
diff --git a/crates/util/src/util.rs b/crates/util/src/util.rs
index f79a8b6c652..a3b6d7a8085 100644
--- a/crates/util/src/util.rs
+++ b/crates/util/src/util.rs
@@ -45,7 +45,6 @@ pub use path::PathExt;
pub use path::normalize_path;
pub use path::rel_path;
-pub use take_until::*;
#[cfg(any(test, feature = "test-support"))]
pub use util_macros::{line_endings, path, uri};