ruff/crates/ruff_python_formatter/tests
Andrew Gallant b972455ac7
ruff_python_formatter: implement "dynamic" line width mode for docstring code formatting (#9098)
## Summary

This PR changes the internal `docstring-code-line-width` setting to
additionally accept a string value `dynamic`. When `dynamic` is set, the
line width is dynamically adjusted when reformatting code snippets in
docstrings based on the indent level of the docstring. The result is
that the reformatted lines from the code snippet should not exceed the
"global" line width configuration for the surrounding source.

This PR does not change the default behavior, although I suspect the
default should probably be `dynamic`.

## Test Plan

I added a new configuration to the existing docstring code tests and
also added a new set of tests dedicated to the new `dynamic` mode.
2023-12-12 09:58:07 -05:00
..
snapshots ruff_python_formatter: implement "dynamic" line width mode for docstring code formatting (#9098) 2023-12-12 09:58:07 -05:00
fixtures.rs ruff_python_formatter: implement "dynamic" line width mode for docstring code formatting (#9098) 2023-12-12 09:58:07 -05:00
normalizer.rs ruff_python_formatter: support reformatting Markdown code blocks (#9030) 2023-12-07 14:30:43 -05:00