rust-lang / rust-lang/rustfmt

Idea: settings hierarchy / categorization

Open
#6,644 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

C-discussion
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

Something to consider for 2.0

Right now settings are all over the place in terms of how they are named (e.g. wrap_comments, comment_width, format_code_in_comments, doc_comment_code_block_width) because they inhabit a single namespace. This makes finding formatting options related to various topics require a lexical search through a long document of semi-related items rather than a categorical search through a shorter list.

It might be useful to categorize the settings into groups.

E.g.:

rustfmt.edition
rustfmt.color

comments.wrap
comments.width
comments.doc_comment.format_code
comments.doc_comment.code_block_width

imports.granularity
imports.group

The toml files would have a similar structure to Cargo.toml files, with sections for each table:

[comments]
wrap = true
width = 100

[comments.doc_comments]
# ...

This would make documentation easier to navigate, and make it possible to providing tooling that modifies the config while showing docs and the allowable settings in a GUI (e.g. similar to how vscode displays rust-analyzer settings).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating rustfmt's settings definitions, configuration parsing, and documentation, then determine the scope of introducing categorized settings and the compatibility implications; done would require an agreed hierarchy and documented behavior.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.