Port changes to zed2

This commit is contained in:
Kirill Bulatov 2023-11-03 11:02:38 +02:00
parent 24dd1c5812
commit 09346fb9f1
8 changed files with 1059 additions and 501 deletions

View file

@ -61,7 +61,7 @@ impl Prettier {
) -> anyhow::Result<Option<PathBuf>> {
let mut path_to_check = locate_from
.components()
.take_while(|component| !is_node_modules(component))
.take_while(|component| component.as_os_str().to_string_lossy() != "node_modules")
.collect::<PathBuf>();
let path_to_check_metadata = fs
.metadata(&path_to_check)
@ -763,7 +763,3 @@ mod tests {
};
}
}
fn is_node_modules(path_component: &std::path::Component<'_>) -> bool {
path_component.as_os_str().to_string_lossy() == "node_modules"
}