You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In rust-analyzer we use rustfmt to format single files by passing the file content to it then writing the diff from that back to the file. This has the downside of us effectively ignoring the excluded paths from the rustfmt.toml.
Now we do not want to parse rustfmt.toml ourselves as this is basically duplicating work, hence the question arised whether it would be possible for rustfmt to either offer some way to ask for whether a path is excluded from it or even better to pass an optional path of a file as an argument when formatting via stdin input to have it basically do nothing if the path is ignored.
I can't really rationalize modifying the CLI surface to accept a list of ignore files for the stdin formatting mode; it just doesn't make sense. I'd probably be open to an enhancement/augmentation to our existing config-print functionality that just dumps the resolved ignore list for a provided directory, though as was shared on your linked thread there's some bug fixes to that behavior that are still pending a backport.
Ye I can understand that this kind of option seems weird, I mainly proposed it as an idea(albeit an odd one maybe). Just having a way to query for the (resolved) ignored paths would probably be good enough for us in that case, since we do have the file path, we just do not want to look for and parse the rustfmt config ourselves.
Hey @Veykril just wanted to let you know that I worked on an implementation for this in #5266, to allow providing rustfmt with a hint about what's being passed via stdin.
In rust-analyzer we use rustfmt to format single files by passing the file content to it then writing the diff from that back to the file. This has the downside of us effectively ignoring the excluded paths from the rustfmt.toml.
Now we do not want to parse rustfmt.toml ourselves as this is basically duplicating work, hence the question arised whether it would be possible for rustfmt to either offer some way to ask for whether a path is excluded from it or even better to pass an optional path of a file as an argument when formatting via stdin input to have it basically do nothing if the path is ignored.
See rust-lang/rust-analyzer#10826
The text was updated successfully, but these errors were encountered: