From e6d5f4406fc742917aaedcc65df6111382e87788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B0=8F=E7=99=BD?= <364772080@qq.com> Date: Thu, 29 Aug 2024 10:52:18 +0800 Subject: [PATCH] windows: Fix path parsing issue when launching Zed from command line (#15856) Closes #15826 Closes #16068 When launching zed from the command line, the path parsing prefixes with `\\?\`. Some LSP servers do not support this type of path, so here I just simply remove the prefix. Release Notes: - N/A --- crates/zed/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index d9ffb29c39..0770918120 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -1071,7 +1071,10 @@ struct Args { fn parse_url_arg(arg: &str, cx: &AppContext) -> Result { match std::fs::canonicalize(Path::new(&arg)) { - Ok(path) => Ok(format!("file://{}", path.to_string_lossy())), + Ok(path) => Ok(format!( + "file://{}", + path.to_string_lossy().trim_start_matches(r#"\\?\"#) + )), Err(error) => { if arg.starts_with("file://") || arg.starts_with("zed-cli://")