Skip to content

Commit

Permalink
fix(biome_diagnostics): fix JetBrains relative file URLs should be cl…
Browse files Browse the repository at this point in the history
…ickable when given line and column numbers
  • Loading branch information
Andrew-Chen-Wang committed Jan 11, 2025
1 parent 94bf15e commit c15a0ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b
## Unreleased

- Fix [#4323](https://github.com/biomejs/biome/issues/4258), where `lint/a11y/useSemanticElement` accidentally showed recommendations for `role="searchbox"` instead of `role="search"`
- Fix [#4875](https://github.com/biomejs/biome/issues/4875), where the Jetbrains IDE terminal would output unclickable, relative file path links to files. This does not fix paths without line and column numbers. Contributed by @Andrew-Chen-Wang

### Analyzer

Expand Down
7 changes: 6 additions & 1 deletion crates/biome_diagnostics/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ impl<D: Diagnostic + ?Sized> fmt::Display for PrintHeader<'_, D> {
};

let is_vscode = env::var("TERM_PROGRAM").unwrap_or_default() == "vscode";
let is_jetbrains = env::var("TERMINAL_EMULATOR").unwrap_or_default().contains("JetBrains");

if let Some(name) = file_name {
if is_vscode {
Expand All @@ -122,7 +123,11 @@ impl<D: Diagnostic + ?Sized> fmt::Display for PrintHeader<'_, D> {
<Hyperlink href={link}>{name}</Hyperlink>
})?;
} else {
fmt.write_str(name)?;
if is_jetbrains {
fmt.write_str(&format!(" at {name}"))?;
} else {
fmt.write_str(name)?;
}
}
}

Expand Down

0 comments on commit c15a0ba

Please sign in to comment.