-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ruff format out of place? #9720
Comments
Thanks for the issue and offer to contribute :) We're thinking about rewriting our LSP in Rust so it can be in I'm not sure if different output formats make sense in the |
It's funny. I've just been talking with @charliermarsh about this because it would be nice if range formatting could return only the portion of the code that needs replacing together with the range that must be replaced rather than the entire file. We concluded that it would be nice to have but will no longer be necessary once we've rewritten our LSP in Rust because it can then call the internal API directly. I also think that promoting the LSP as a programmatic Ruff API (until we have a Python API) has benefits:
The main downside is that using it is more involved. For example, to format a file:
|
I'll close this in favor of #659, which asks for a Ruff API (not just formatting). |
The default behavior of
ruff format
is to do an in-place rewrite of the provided files. If you pass source code in via stdin, ruff will output the formatted source to stdout.It would be great to have an option where we can pass multiple files into
ruff format
, and get a structured response back with formatted sources for each of the files, somewhat analogous toruff --output-format=json <files>
.This would be helpful for a project like ours (PyTorch) which calls out to ruff programmatically from various tools.
Happy to contribute this if folks are okay with it.
The text was updated successfully, but these errors were encountered: