From 2f6583aae2f85fcc2761b73c3298a29cb71d097f Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Sat, 9 Nov 2024 22:34:03 -0500 Subject: [PATCH] fix(loader): don't print warnings if the file is not found (cherry picked from commit 18e4a2405b52ecd3cb9aefdd05d6554e76823473) --- cli/loader/src/lib.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cli/loader/src/lib.rs b/cli/loader/src/lib.rs index 1ee006f0..13b4fabf 100644 --- a/cli/loader/src/lib.rs +++ b/cli/loader/src/lib.rs @@ -1210,10 +1210,16 @@ impl Loader { } } } else if let Err(e) = ts_json { - eprintln!( - "Warning: Failed to read {} -- {e}", - parser_path.join("tree-sitter.json").display() - ); + match e.downcast_ref::() { + // This is noisy, and not really an issue. + Some(e) if e.kind() == std::io::ErrorKind::NotFound => {} + _ => { + eprintln!( + "Warning: Failed to parse {} -- {e}", + parser_path.join("tree-sitter.json").display() + ); + } + } } // If we didn't find any language configurations in the tree-sitter.json file,