Skip to content

Commit

Permalink
fix(graphical): render URLs even without a code
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Sep 22, 2021
1 parent ce0dea5 commit 77c5899
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/handlers/graphical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,18 @@ impl GraphicalReportHandler {
Some(Severity::Advice) => self.theme.styles.advice,
};
let mut header = String::new();
if self.linkify_code && diagnostic.url().is_some() && diagnostic.code().is_some() {
if self.linkify_code && diagnostic.url().is_some() {
let url = diagnostic.url().unwrap(); // safe
let code = format!(
"{}",
diagnostic
.code()
.expect("MIETTE BUG: already got checked for None")
);
let code = if let Some(code) = diagnostic.code() {
format!("{} ", code)
} else {
"".to_string()
};
let link = format!(
"\u{1b}]8;;{}\u{1b}\\{}\u{1b}]8;;\u{1b}\\",
url,
format!(
"{} {}",
"{}{}",
code.style(severity_style),
"(link)".style(self.theme.styles.link)
)
Expand Down

0 comments on commit 77c5899

Please sign in to comment.