ruff/crates/ruff_formatter/src
Jane Lewis 7504bf347b
--show-settings displays active settings in a far more readable format (#9464)
<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

Fixes #8334.

`Display` has been implemented for `ruff_workspace::Settings`, which
gives a much nicer and more readable output to `--show-settings`.

Internally, a `display_settings` utility macro has been implemented to
reduce the boilerplate of the display code.

### Work to be done

- [x] A lot of formatting for `Vec<_>` and `HashSet<_>` types have been
stubbed out, using `Debug` as a fallback. There should be a way to add
generic formatting support for these types as a modifier in
`display_settings`.
- [x] Several complex types were also stubbed out and need proper
`Display` implementations rather than falling back on `Debug`.
- [x] An open question needs to be answered: how important is it that
the output be valid TOML? Some types in settings, such as a hash-map
from a glob pattern to a multi-variant enum, will be hard to rework into
valid _and_ readable TOML.
- [x] Tests need to be implemented.

## Test Plan

Tests consist of a snapshot test for the default `--show-settings`
output and a doctest for `display_settings!`.
2024-01-12 14:30:29 -05:00
..
format_element Allow parenthesized content exceed configured line width (#7490) 2023-09-20 08:39:25 +02:00
printer Hug multiline-strings preview style (#9243) 2024-01-10 12:47:34 +01:00
arguments.rs remove several uses of unsafe (#8600) 2023-11-28 09:50:03 -05:00
buffer.rs Introduce Token element (#7048) 2023-09-02 10:05:47 +02:00
builders.rs remove several uses of unsafe (#8600) 2023-11-28 09:50:03 -05:00
diagnostics.rs Fix Printer group modes (#6815) 2023-08-24 08:42:59 +02:00
format_element.rs remove several uses of unsafe (#8600) 2023-11-28 09:50:03 -05:00
format_extensions.rs Allow parenthesized content exceed configured line width (#7490) 2023-09-20 08:39:25 +02:00
formatter.rs Introduce Token element (#7048) 2023-09-02 10:05:47 +02:00
group_id.rs Fix Printer group modes (#6815) 2023-08-24 08:42:59 +02:00
lib.rs --show-settings displays active settings in a far more readable format (#9464) 2024-01-12 14:30:29 -05:00
macros.rs remove several uses of unsafe (#8600) 2023-11-28 09:50:03 -05:00
prelude.rs Remove dependency on ruff_rowan (#2875) 2023-02-15 03:54:08 +00:00
source_code.rs Implement Ranged on more structs (#6921) 2023-08-27 19:03:08 +00:00