Skip to content

Commit

Permalink
fix(diagnostics): improve "file is too long to fit on the screen" (#5120
Browse files Browse the repository at this point in the history
)

closes #4322

Setting the threshold to 1200 because graphical output may contain ansi escape codes and other decorations.
  • Loading branch information
Boshen committed Aug 23, 2024
1 parent 76c66b4 commit ff7fa98
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/oxc_diagnostics/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down

0 comments on commit ff7fa98

Please sign in to comment.