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.

Fix parsing of filenames like main (1).log (#50770)

hagz0rd1a323b4ac89
diff --git a/crates/util/src/paths.rs b/crates/util/src/paths.rs
index 39b4064a1bd..3ff07c67a8d 100644
--- a/crates/util/src/paths.rs
+++ b/crates/util/src/paths.rs
@@ -601,6 +601,7 @@ const ROW_COL_CAPTURE_REGEX: &str = r"(?xs)
|
\((\d+)\)() # filename(row)
)
+ \:*$
|
(.+?)(?:
\:+(\d+)\:(\d+)\:*$ # filename:row:column
@@ -2097,6 +2098,15 @@ mod tests {
column: Some(9),
}
);
+
+ assert_eq!(
+ PathWithPosition::parse_str("main (1).log"),
+ PathWithPosition {
+ path: PathBuf::from("main (1).log"),
+ row: None,
+ column: None
+ }
+ );
}
#[perf]
@@ -2175,6 +2185,15 @@ mod tests {
column: None
}
);
+
+ assert_eq!(
+ PathWithPosition::parse_str("C:\\Users\\someone\\main (1).log"),
+ PathWithPosition {
+ path: PathBuf::from("C:\\Users\\someone\\main (1).log"),
+ row: None,
+ column: None
+ }
+ );
}
#[perf]