Repository: biomejs/biome (language: rust)

Issue:
🐛 make file in biome output clickable for webstorm/jetbrains/intellij
### Environment information

latest webstorm ide version. Eslint works fine.

```block
biome rage
CLI:
  Version:                      1.9.4
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.10.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 true

Workspace:
  Open Documents:               0
```


### What happened?

This issue where you can click a file path in the console output of `biome check` should have resolved IntelliJ (in my case webstorm) files being clickable in terminal output. Unfortunately, they aren't.

https://github.com/biomejs/biome/pull/1815

It could be an IDE issue though. I cannot get it to work even using echo or an absolute file path using echo. I am using NextJS and they have hyper links that are clickable in webstorm just fine.

### Expected result

Be able to click the file path and the file opens.

### Code of Conduct

- [X] I agree to follow Biome's Code of Conduct


Discussion / hints:
I have managed to make it work on jetbrains via echo:

```
echo " at ./.gitignore:1:1"
 at ./.gitignore:1:1
```

This also works on Cursor IDE which is basically VSCode, and on Pycharm. ~~Let me know how I can contribute this~~ Making a PR now

Unf

```
echo " at ./.gitignore
  at ./.gitignore
```
does nothing on all jetbrains ides!

Interestingly:
```
echo "file:///.gitignore"
file:///.gitignore
```
is the only way to make it work when there are no column/row markers, but clicking on it requires an absolute path on all jetbrains IDEs

a little more discovery:

```
echo "/Users/andrew/Work/Code/projects/hi.ts\n   34:25  error"
/Users/andrew/Work/Code/projects/hi.js
   34:25  error
```
the `34:25 error` is clickable, but this only applies to webstorm and VSCode. On PyCharm this doesn't work. This line was taken from eslint

however this is something that works on pycharm

```
(venv) andrew@Mac django-rest-framework-simplejwt % echo rest_framework_simplejwt/serializers.py:1:1
rest_framework_simplejwt/serializers.py:1:1
# Note the :1:1 -> Only up to the first `1` is actually clickable
(venv) andrew@Mac django-rest-framework-simplejwt % echo ./rest_framework_simplejwt/serializers.py:1
./rest_framework_simplejwt/serializers.py:1
```

unbelievable

ref: https://youtrack.jetbrains.com/issue/IJPL-101350/Producing-clickable-file-paths-in-the-embedded-terminal#focus=Comments-27-9026636.0-0

Fix patch:
diff --git a/.changeset/_fix_4875httpsgithubcombiomejsbiomeissues4875_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.md b/.changeset/_fix_4875httpsgithubcombiomejsbiomeissues4875_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.md
new file mode 100644
index 000000000000..ab2d21acc740
--- /dev/null
+++ b/.changeset/_fix_4875httpsgithubcombiomejsbiomeissues4875_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.md
@@ -0,0 +1,5 @@
+---
+cli: patch
+---
+
+# - Fix [#4875](https://github.com/biomejs/biome/issues/4875), where the Jetbrains IDE terminal would output not clickable, relative file path link to the diagnostic file. This does not fix paths without line and column numbers.
diff --git a/crates/biome_diagnostics/src/display.rs b/crates/biome_diagnostics/src/display.rs
index d54857346ce8..2b2969274061 100644
--- a/crates/biome_diagnostics/src/display.rs
+++ b/crates/biome_diagnostics/src/display.rs
@@ -110,6 +110,11 @@ impl<D: Diagnostic + ?Sized> fmt::Display for PrintHeader<'_, D> {
         };
 
         let is_vscode = env::var("TERM_PROGRAM").unwrap_or_default() == "vscode";
+        // https://github.com/JetBrains/jediterm/issues/253#issuecomment-1280492436
+        // https://github.com/JetBrains/intellij-community/blob/5ca79d879617e9cc82f61590b8d157d6a4ad8746/plugins/terminal/src/org/jetbrains/plugins/terminal/runner/LocalOptionsConfigurer.java#L94
+        let is_jetbrains = env::var("TERMINAL_EMULATOR")
+            .unwrap_or_default()
+            .contains("JetBrains");
 
         if let Some(name) = file_name {
             if is_vscode {
@@ -121,6 +126,8 @@ impl<D: Diagnostic + ?Sized> fmt::Display for PrintHeader<'_, D> {
                     fmt.write_markup(markup! {
                         <Hyperlink href={link}>{name}</Hyperlink>
                     })?;
+                } else if is_jetbrains {
+                    fmt.write_str(&format!(" at {name}"))?;
                 } else {
                     fmt.write_str(name)?;
                 }


Test patch: