1
Fork 0

Detect long types in E0308 and write them to disk

On type error with long types, print an abridged type and write the full
type to disk.

Print the widest possible short type while still fitting in the
terminal.
This commit is contained in:
Esteban Küber 2022-11-25 17:14:25 -08:00
parent 8a09420ac4
commit 7674edeeba
16 changed files with 314 additions and 101 deletions

View file

@ -952,6 +952,17 @@ impl Session {
) -> Option<Symbol> {
attrs.iter().find(|at| at.has_name(name)).and_then(|at| at.value_str())
}
pub fn diagnostic_width(&self) -> usize {
let default_column_width = 140;
if let Some(width) = self.opts.diagnostic_width {
width
} else if self.opts.unstable_opts.ui_testing {
default_column_width
} else {
termize::dimensions().map_or(default_column_width, |(w, _)| w)
}
}
}
// JUSTIFICATION: defn of the suggested wrapper fns