mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-30 12:51:10 +00:00
Clean: display format
This commit is contained in:
parent
899e8ead03
commit
12ccd6ac27
1 changed files with 4 additions and 4 deletions
|
@ -572,12 +572,12 @@ impl ErrorCore {
|
||||||
Location::Line(lineno) => format!(", line {lineno}"),
|
Location::Line(lineno) => format!(", line {lineno}"),
|
||||||
Location::Unknown => "".to_string(),
|
Location::Unknown => "".to_string(),
|
||||||
};
|
};
|
||||||
format!("{kind}: File {input}{loc}{caused_by}\n",)
|
format!("{kind}: File {input}{loc}{caused_by}",)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fmt_main_message(&self, kind: StyledString, caused_by: &str, input: &str) -> String {
|
pub fn fmt_main_message(&self, kind: StyledString, caused_by: &str, input: &str) -> String {
|
||||||
format!(
|
format!(
|
||||||
"{}{}\n\n",
|
"{}\n{}\n\n",
|
||||||
self.fmt_header(kind, caused_by, input),
|
self.fmt_header(kind, caused_by, input),
|
||||||
self.main_message
|
self.main_message
|
||||||
)
|
)
|
||||||
|
@ -666,11 +666,11 @@ pub trait ErrorDisplay {
|
||||||
);
|
);
|
||||||
writeln!(
|
writeln!(
|
||||||
f,
|
f,
|
||||||
"{}\n",
|
"{}",
|
||||||
core.fmt_main_message(kind, self.caused_by(), self.input().enclosed_name())
|
core.fmt_main_message(kind, self.caused_by(), self.input().enclosed_name())
|
||||||
)?;
|
)?;
|
||||||
for sub_msg in &self.core().sub_messages {
|
for sub_msg in &self.core().sub_messages {
|
||||||
writeln!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"{}",
|
"{}",
|
||||||
&sub_msg.format_code_and_pointer(self, color, gutter_color, mark, chars)
|
&sub_msg.format_code_and_pointer(self, color, gutter_color, mark, chars)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue