From 86cfae8c108fa5fb9399fa611f6a6dad35c1d507 Mon Sep 17 00:00:00 2001 From: TheArchitectit Date: Sun, 26 Apr 2026 22:46:25 -0500 Subject: [PATCH] fix: LSP discovery finds rust-analyzer via rustup proxy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rust-analyzer installed through rustup exits non-zero on --version ("Unknown binary in official toolchain"), which caused discovery to skip it. Changed command_exists_on_path to treat any successful spawn as "found", regardless of exit code — only a failure to spawn (command not found) means the server isn't available. Co-Authored-By: Claude Opus 4.7 --- rust/crates/runtime/src/lsp_discovery.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rust/crates/runtime/src/lsp_discovery.rs b/rust/crates/runtime/src/lsp_discovery.rs index 50299a86..24b28a0c 100644 --- a/rust/crates/runtime/src/lsp_discovery.rs +++ b/rust/crates/runtime/src/lsp_discovery.rs @@ -100,13 +100,16 @@ pub fn known_lsp_servers() -> Vec { /// Check whether a command exists on the user's PATH by attempting to run it /// with `--version`. Returns `true` if the command could be spawned /// successfully, `false` otherwise. +/// +/// Some LSP servers (like rust-analyzer via rustup) exit non-zero on --version +/// but are still functional. We treat "spawned successfully" as found, regardless +/// of the exit code. Only a failure to spawn (command not found) returns false. #[must_use] pub fn command_exists_on_path(command: &str) -> bool { Command::new(command) .arg("--version") .output() - .map(|output| output.status.success()) - .unwrap_or(false) + .map_or(false, |_| true) } /// Discover LSP servers that are actually installed on the current system.