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 path parsing for goto syntax provided by Haskell language server (#33697)

abhimanyu maurya69fd23e947ed
diff --git a/crates/util/src/paths.rs b/crates/util/src/paths.rs
index 47ea662d7de..2e02f051d15 100644
--- a/crates/util/src/paths.rs
+++ b/crates/util/src/paths.rs
@@ -170,6 +170,12 @@ impl<T: AsRef<Path>> From<T> for SanitizedPath {
pub const FILE_ROW_COLUMN_DELIMITER: char = ':';
const ROW_COL_CAPTURE_REGEX: &str = r"(?xs)
+ ([^\(]+)\:(?:
+ \((\d+)[,:](\d+)\) # filename:(row,column), filename:(row:column)
+ |
+ \((\d+)\)() # filename:(row)
+ )
+ |
([^\(]+)(?:
\((\d+)[,:](\d+)\) # filename(row,column), filename(row:column)
|
@@ -674,6 +680,15 @@ mod tests {
column: None
}
);
+
+ assert_eq!(
+ PathWithPosition::parse_str("Types.hs:(617,9)-(670,28):"),
+ PathWithPosition {
+ path: PathBuf::from("Types.hs"),
+ row: Some(617),
+ column: Some(9),
+ }
+ );
}
#[test]