@@ -90,27 +90,21 @@ you'd like to only change formatting when you're touching the code for other rea
9090This can also be useful
9191when contributing to upstream codebases that are not under your complete control.
9292
93- Partial formatting is not supported by Black _ itself,
94- for various good reasons, and so far there hasn't been a plan to implemented it either
95- (`134 `__, `142 `__, `245 `__, `370 `__, `511 `__, `830 `__).
96- However, in September 2021 Black developers started to hint towards adding this feature
97- after all (`1352 `__). This might at least simplify Darker's algorithm substantially.
93+ Partial formatting was not supported by Black _ itself when Darker was originally
94+ created, which is why Darker was developed to provide this functionality.
95+ However, Black has since added the `-\- line-ranges `_ command line option for partial
96+ formatting, which could potentially simplify Darker's implementation.
97+
98+ .. _-\- line-ranges : https://black.readthedocs.io/en/latest/usage_and_configuration/the_basics.html#line-ranges
9899
99100The ``--range `` option in `the Ruff formatter `_
100- does allow for partial formatting of a single range,
101+ allows for partial formatting of a single range as well ,
101102but to make use of it,
102103Darker would need call `the Ruff formatter `_ once for each modified chunk.
103104
104- __ https://github.com/psf/black/issues/134
105- __ https://github.com/psf/black/issues/142
106- __ https://github.com/psf/black/issues/245
107- __ https://github.com/psf/black/issues/370
108- __ https://github.com/psf/black/issues/511
109- __ https://github.com/psf/black/issues/830
110- __ https://github.com/psf/black/issues/1352
111-
112- But for the time being, this is where ``darker `` enters the stage.
113- This tool is for those who want to do partial formatting right now.
105+ However, Black doesn't help in determining which line ranges to format.
106+ This is where ``darker `` enters the stage.
107+ This tool is for those who want to do partial formatting for modified parts of the code.
114108
115109Note that this tool is meant for special situations
116110when dealing with existing code bases.
@@ -950,10 +944,10 @@ To sort imports when the ``--isort`` option was specified, Darker proceeds like
950944Limitations and work-arounds
951945=============================
952946
953- Black doesn't support partial formatting natively,
954- and `the Ruff formatter `_ only accepts a single line range.
955- Because of this, Darker lets them reformat complete files.
956- Darker then accepts or rejects chunks of contiguous lines touched by the formatter ,
947+ Although Black has added support for partial formatting with the ` --line-ranges ` command
948+ line option, and `the Ruff formatter `_ accepts a single line range for `` --range ``,
949+ Darker lets Black or Ruff reformat complete files.
950+ Darker then accepts or rejects chunks of contiguous lines touched by Black or Ruff ,
957951depending on whether any of the lines in a chunk were edited or added
958952between the two revisions.
959953
0 commit comments