From ff7fa987db9c145cd74b762b69e6b377d2674307 Mon Sep 17 00:00:00 2001 From: Boshen <1430279+Boshen@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:17:12 +0000 Subject: [PATCH] fix(diagnostics): improve "file is too long to fit on the screen" (#5120) closes #4322 Setting the threshold to 1200 because graphical output may contain ansi escape codes and other decorations. --- crates/oxc_diagnostics/src/service.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/oxc_diagnostics/src/service.rs b/crates/oxc_diagnostics/src/service.rs index 199caf5b4..d3349bb5a 100644 --- a/crates/oxc_diagnostics/src/service.rs +++ b/crates/oxc_diagnostics/src/service.rs @@ -150,8 +150,9 @@ impl DiagnosticService { } if let Some(mut err_str) = self.reporter.render_error(diagnostic) { - // Skip large output and print only once - if err_str.lines().any(|line| line.len() >= 400) { + // Skip large output and print only once. + // Setting to 1200 because graphical output may contain ansi escape codes and other decorations. + if err_str.lines().any(|line| line.len() >= 1200) { let minified_diagnostic = Error::new( OxcDiagnostic::warn("File is too long to fit on the screen") .with_help(format!("{path:?} seems like a minified file")),