Explain spans of the input file which were excluded from the formatter
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Often I see sections of source code which do not get reformatted, and afaics there is no way to know a) it was skipped, and b) why it was skipped.
I know of macros as a common source of this, c.f. https://github.com/rust-lang/rustfmt/issues/8 , but sometimes that doesn't explain why a section of the source code was not formatted.
I think it would be helpful if rustfmt was able to inform the user why it skipped spans of the input file while checking, or spans of the output file if reformatting. This will increase awareness in the Rust community of the current limitations of rustfmt, so they know when not to rely on it, likely also steering developers to using syntax which is compatible with rustfmt if they want to rely on rustfmt more, and possibly bringing in more contributors to rustfmt.
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 reviewing rustfmt's handling of source spans that are not reformatted, including the macro-related limitations referenced in rust-lang/rustfmt#8. Identify how skipped spans are detected during checking or reformatting and determine a user-visible way to explain both the skipped location and reason. Done means rustfmt reports excluded spans and why they were excluded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100