Do not propose prettier formatters for documents in node_modules/

This commit is contained in:
Kirill Bulatov 2023-11-09 14:40:53 +02:00
parent ce40d5e0c5
commit 2e957bc564
2 changed files with 19 additions and 17 deletions

View file

@ -64,6 +64,12 @@ impl Prettier {
.components()
.take_while(|component| component.as_os_str().to_string_lossy() != "node_modules")
.collect::<PathBuf>();
if path_to_check != locate_from {
log::debug!(
"Skipping prettier location for path {path_to_check:?} that is inside node_modules"
);
return Ok(ControlFlow::Break(()));
}
let path_to_check_metadata = fs
.metadata(&path_to_check)
.await