inconsistency in partial formatting with Darker #529
-
Hello,
i am seeking assistance to understand why Darker is recommending these additional changes and how i might configure it to respect the boundaries of partial formatting ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi @Eyobkibret15, thanks for your report! Since Black doesn't support partial formatting natively, Darker takes a diff between the original and modified versions of the file and tries to track down which lines correspond to each other, and how they map to the reformatting made by Black. It then takes a conservative approach to apply minimal diff chunks which intersect with detected changes. Unfortunately it's very tricky to get this approach to really minimize the changes since we're not digging down to analyzing the Python code. So unfortunately this is a known limitation which can't be approved using the current approach with reasonable effort. Let me know if the documentation can be improved to explain this limitation better! |
Beta Was this translation helpful? Give feedback.
Hi @Eyobkibret15, thanks for your report!
Since Black doesn't support partial formatting natively, Darker takes a diff between the original and modified versions of the file and tries to track down which lines correspond to each other, and how they map to the reformatting made by Black. It then takes a conservative approach to apply minimal diff chunks which intersect with detected changes. Unfortunately it's very tricky to get this approach to really minimize the changes since we're not digging down to analyzing the Python code.
So unfortunately this is a known limitation which can't be approved using the current approach with reasonable effort.
Let me know if the documentation can be im…