ruff/crates/ruff_server/src
Brent Westbrook fd335eb8b7
Move fix suggestion to subdiagnostic (#19464)
Summary
--

This PR tweaks Ruff's internal usage of the new diagnostic model to more
closely
match the intended use, as I understand it. Specifically, it moves the
fix/help
suggestion from the primary annotation's message to a subdiagnostic. In
turn, it
adds the secondary/noqa code as the new primary annotation message. As
shown in
the new `ruff_db` tests, this more closely mirrors Ruff's current
diagnostic
output.

I also added `Severity::Help` to render the fix suggestion with a
`help:` prefix
instead of `info:`.

These changes don't have any external impact now but should help a bit
with #19415.

Test Plan
--

New full output format tests in `ruff_db`

Rendered Diagnostics
--

Full diagnostic output from `annotate-snippets` in this PR:

``` 
error[unused-import]: `os` imported but unused
  --> fib.py:1:8
   |
 1 | import os
   |        ^^
   |
 help: Remove unused import: `os`
```

Current Ruff output for the same code:

```
fib.py:1:8: F401 [*] `os` imported but unused
  |
1 | import os
  |        ^^ F401
  |
  = help: Remove unused import: `os`
```

Proposed final output after #19415:

``` 
F401 [*] `os` imported but unused
  --> fib.py:1:8
   |
 1 | import os
   |        ^^
   |
 help: Remove unused import: `os`
```

These are slightly updated from
https://github.com/astral-sh/ruff/pull/19464#issuecomment-3097377634
below to remove the extra noqa codes in the primary annotation messages
for the first and third cases.
2025-07-22 10:03:58 -04:00
..
edit Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
server [ty] Add documentation for server traits (#19137) 2025-07-07 14:26:09 +00:00
session Support cancellation requests (#18627) 2025-06-12 22:08:42 +02:00
edit.rs Split SourceLocation into LineColumn and SourceLocation (#17587) 2025-04-27 11:27:33 +01:00
fix.rs Consider virtual path for various server actions (#18910) 2025-06-24 12:24:28 +00:00
format.rs Consider virtual path for various server actions (#18910) 2025-06-24 12:24:28 +00:00
lib.rs Support cancellation requests (#18627) 2025-06-12 22:08:42 +02:00
lint.rs Move fix suggestion to subdiagnostic (#19464) 2025-07-22 10:03:58 -04:00
logging.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
resolve.rs Root exclusions in the server to project root (#16043) 2025-02-10 04:57:14 +00:00
server.rs Support cancellation requests (#18627) 2025-06-12 22:08:42 +02:00
session.rs Support cancellation requests (#18627) 2025-06-12 22:08:42 +02:00
workspace.rs Centralize client options validation (#18623) 2025-06-12 18:58:30 +02:00