mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
Print secondary labels as notes in old skool mode
This commit is contained in:
parent
5743564f2d
commit
ae1e73affe
@ -524,6 +524,9 @@ impl Destination {
|
|||||||
}
|
}
|
||||||
Style::Quotation => {
|
Style::Quotation => {
|
||||||
}
|
}
|
||||||
|
Style::OldSkoolNote => {
|
||||||
|
self.start_attr(term::Attr::Bold)?;
|
||||||
|
}
|
||||||
Style::UnderlinePrimary | Style::LabelPrimary => {
|
Style::UnderlinePrimary | Style::LabelPrimary => {
|
||||||
self.start_attr(term::Attr::Bold)?;
|
self.start_attr(term::Attr::Bold)?;
|
||||||
self.start_attr(term::Attr::ForegroundColor(lvl.color()))?;
|
self.start_attr(term::Attr::ForegroundColor(lvl.color()))?;
|
||||||
|
@ -90,6 +90,7 @@ pub enum Style {
|
|||||||
UnderlineSecondary,
|
UnderlineSecondary,
|
||||||
LabelPrimary,
|
LabelPrimary,
|
||||||
LabelSecondary,
|
LabelSecondary,
|
||||||
|
OldSkoolNote,
|
||||||
NoStyle,
|
NoStyle,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,6 +498,28 @@ impl FileInfo {
|
|||||||
match self.primary_span {
|
match self.primary_span {
|
||||||
Some(span) => {
|
Some(span) => {
|
||||||
let lo = codemap.lookup_char_pos(span.lo);
|
let lo = codemap.lookup_char_pos(span.lo);
|
||||||
|
//Before each secondary line in old skool-mode, print the label
|
||||||
|
//as an old-style note
|
||||||
|
if !line.annotations[0].is_primary {
|
||||||
|
if let Some(ann) = line.annotations[0].label.clone() {
|
||||||
|
output.push(RenderedLine {
|
||||||
|
text: vec![StyledString {
|
||||||
|
text: lo.file.name.clone(),
|
||||||
|
style: Style::FileNameStyle,
|
||||||
|
}, StyledString {
|
||||||
|
text: format!(":{}:{}: ", lo.line, lo.col.0 + 1),
|
||||||
|
style: Style::LineAndColumn,
|
||||||
|
}, StyledString {
|
||||||
|
text: format!("note: "),
|
||||||
|
style: Style::LabelSecondary,
|
||||||
|
}, StyledString {
|
||||||
|
text: format!("{}", ann),
|
||||||
|
style: Style::OldSkoolNote,
|
||||||
|
}],
|
||||||
|
kind: RenderedLineKind::Annotations,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
rendered_lines[0].text.insert(0, StyledString {
|
rendered_lines[0].text.insert(0, StyledString {
|
||||||
text: format!(":{} ", lo.line),
|
text: format!(":{} ", lo.line),
|
||||||
style: Style::LineAndColumn,
|
style: Style::LineAndColumn,
|
||||||
|
Loading…
Reference in New Issue
Block a user