ruff/crates/ruff_formatter/src
Zanie Blue 9cdac2d6fb
Add support for using uv as an alternative formatter backend (#19665)
This adds a new `backend: internal | uv` option to the LSP
`FormatOptions` allowing users to perform document and range formatting
operations though uv. The idea here is to prototype a solution for users
to transition to a `uv format` command without encountering version
mismatches (and consequently, formatting differences) between the LSP's
version of `ruff` and uv's version of `ruff`.

The primarily alternative to this would be to use uv to discover the
`ruff` version used to start the LSP in the first place. However, this
would increase the scope of a minimal `uv format` command beyond "run a
formatter", and raise larger questions about how uv should be used to
coordinate toolchain discovery. I think those are good things to
explore, but I'm hesitant to let them block a `uv format`
implementation. Another downside of using uv to discover `ruff`, is that
it needs to be implemented _outside_ the LSP; e.g., we'd need to change
the instructions on how to run the LSP and implement it in each editor
integration, like the VS Code plugin.

---------

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2025-09-09 20:39:53 +05:30
..
format_element Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
printer Add support for using uv as an alternative formatter backend (#19665) 2025-09-09 20:39:53 +05:30
arguments.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
buffer.rs Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
builders.rs Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
diagnostics.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
format_element.rs Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
format_extensions.rs Join implicit concatenated strings when they fit on a line (#13663) 2024-10-24 11:52:22 +02:00
formatter.rs Introduce Token element (#7048) 2023-09-02 10:05:47 +02:00
group_id.rs Fix Printer group modes (#6815) 2023-08-24 08:42:59 +02:00
lib.rs Add support for using uv as an alternative formatter backend (#19665) 2025-09-09 20:39:53 +05:30
macros.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
prelude.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
source_code.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00