Any thoughts on implementing automated line wrapping as an optional post-processing step? #59
NathanLovato
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
|
I actually tried to add line wrapping today. Instead of as a postprocess I tried to do it as a preprocess step (so I could add one new line and then topiary will format it as a multiline statement), but this approach has less control over the final output. I will try to make it as a postprocess step instead in the following days. A few things that I discovered doing that:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Now that we have the post processing step in place after briefly checking how the black formatter handles line wrapping, perhaps we could have something like this eventually in this formatter at least as an option.
Black tries to fit entire expressions on one line and wraps using different strategies over multiple lines if that does not work.
It also turns line continuations into parentheses if they need multiple lines.
You can see examples and details on this page, in the top section: https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html
As we already post-process the formatter...
Beta Was this translation helpful? Give feedback.
All reactions