From 1af9f98c1d58fa06dcdcad5c68ff1be1a79d032a Mon Sep 17 00:00:00 2001 From: David Barsky Date: Wed, 25 Jun 2025 15:24:51 -0700 Subject: [PATCH] lsp-log: Avoid trimming leading space in language server logs (#33418) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not sure what the full intention/right fix for this is, but https://github.com/zed-industries/zed/pull/32659 re-introduced trimming of leading spaces. rust-analyzer has [a custom tracing formatter](https://github.com/rust-lang/rust-analyzer/blob/317542c1e4a3ec3467d21d1c25f6a43b80d83e7d/crates/rust-analyzer/src/tracing/hprof.rs) that is _super_ useful for profiling what the heck rust-analyzer is doing. It makes prodigious use of whitespace to delineate to create a tree-shaped structure. This change reintroduces the leading whitespace. I made a previous change similar to this that removed a `stderr:` in https://github.com/zed-industries/zed/pull/27213/. If this is a direction y'all are happy to go with, I'd be happy to add a test for this!
A screenshot of the before Screenshot 2025-06-25 at 2 12 45 PM
A screenshot of the after Screenshot 2025-06-25 at 2 40 07 PM
cc: @mgsloan. Release Notes: - Fixed the removal of leading whitespace in a language server's stderr logs. --- crates/language_tools/src/lsp_log.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/language_tools/src/lsp_log.rs b/crates/language_tools/src/lsp_log.rs index de474c1d9f..a3827218c3 100644 --- a/crates/language_tools/src/lsp_log.rs +++ b/crates/language_tools/src/lsp_log.rs @@ -430,7 +430,7 @@ impl LogStore { log_lines, id, LogMessage { - message: message.trim().to_string(), + message: message.trim_end().to_string(), typ, }, language_server_state.log_level,