From 777ce7cc97b161feef64f67481b76415a2d848b4 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 6 Sep 2025 10:37:59 +0300 Subject: [PATCH] Fixed LSP binary info not being shown in full (#37682) Follow-up of https://github.com/zed-industries/zed/pull/37083 Closes https://github.com/zed-industries/zed/issues/37677 Release Notes: - Fixed LSP binary info not being shown in full --- crates/language_tools/src/lsp_log_view.rs | 18 ++++++++++++------ crates/project/src/lsp_store/log_store.rs | 14 -------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/crates/language_tools/src/lsp_log_view.rs b/crates/language_tools/src/lsp_log_view.rs index b1f1e5c4f62b4c14b88cdd3de27a1624c7c7158f..fb63ab9a99147328c4987bd80b698ef4a477f013 100644 --- a/crates/language_tools/src/lsp_log_view.rs +++ b/crates/language_tools/src/lsp_log_view.rs @@ -325,7 +325,7 @@ impl LspLogView { let server_info = format!( "* Server: {NAME} (id {ID}) -* Binary: {BINARY:#?} +* Binary: {BINARY} * Registered workspace folders: {WORKSPACE_FOLDERS} @@ -335,10 +335,10 @@ impl LspLogView { * Configuration: {CONFIGURATION}", NAME = info.name, ID = info.id, - BINARY = info.binary.as_ref().map_or_else( - || "Unknown".to_string(), - |bin| bin.path.as_path().to_string_lossy().to_string() - ), + BINARY = info + .binary + .as_ref() + .map_or_else(|| "Unknown".to_string(), |binary| format!("{binary:#?}")), WORKSPACE_FOLDERS = info.workspace_folders.join(", "), CAPABILITIES = serde_json::to_string_pretty(&info.capabilities) .unwrap_or_else(|e| format!("Failed to serialize capabilities: {e}")), @@ -990,10 +990,16 @@ impl Render for LspLogToolbarItemView { let server_id = server.server_id; let rpc_trace_enabled = server.rpc_trace_enabled; let log_view = log_view.clone(); + let label = match server.selected_entry { + LogKind::Rpc => RPC_MESSAGES, + LogKind::Trace => SERVER_TRACE, + LogKind::Logs => SERVER_LOGS, + LogKind::ServerInfo => SERVER_INFO, + }; PopoverMenu::new("LspViewSelector") .anchor(Corner::TopLeft) .trigger( - Button::new("language_server_menu_header", server.selected_entry.label()) + Button::new("language_server_menu_header", label) .icon(IconName::ChevronDown) .icon_size(IconSize::Small) .icon_color(Color::Muted), diff --git a/crates/project/src/lsp_store/log_store.rs b/crates/project/src/lsp_store/log_store.rs index 67a20dd6cd8b2f5d6ca48d7790fc0b2e60aff370..00098712bf0092a6795de2ed48c7ccf15925c555 100644 --- a/crates/project/src/lsp_store/log_store.rs +++ b/crates/project/src/lsp_store/log_store.rs @@ -16,11 +16,6 @@ const SEND_LINE: &str = "\n// Send:"; const RECEIVE_LINE: &str = "\n// Receive:"; const MAX_STORED_LOG_ENTRIES: usize = 2000; -const RPC_MESSAGES: &str = "RPC Messages"; -const SERVER_LOGS: &str = "Server Logs"; -const SERVER_TRACE: &str = "Server Trace"; -const SERVER_INFO: &str = "Server Info"; - pub fn init(on_headless_host: bool, cx: &mut App) -> Entity { let log_store = cx.new(|cx| LogStore::new(on_headless_host, cx)); cx.set_global(GlobalLogStore(log_store.clone())); @@ -216,15 +211,6 @@ impl LogKind { LanguageServerLogType::Rpc { .. } => Self::Rpc, } } - - pub fn label(&self) -> &'static str { - match self { - LogKind::Rpc => RPC_MESSAGES, - LogKind::Trace => SERVER_TRACE, - LogKind::Logs => SERVER_LOGS, - LogKind::ServerInfo => SERVER_INFO, - } - } } impl LogStore {