Allow to query whether a path is ignored/When using rustfmt via stdin allow passing a path
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
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 https://github.com/rust-analyzer/rust-analyzer/issues/10826
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing rustfmt's stdin formatting path and how rustfmt.toml excluded paths are applied. Compare the requested path-query behavior with accepting an optional file path during stdin formatting. Done means one documented, tested behavior lets rust-analyzer determine whether the supplied path should be formatted without parsing rustfmt.toml itself.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100