Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatter: wrap_long_dict_values_in_parens preview style #8897

Closed
Tracked by #8678
MichaReiser opened this issue Nov 29, 2023 · 2 comments
Closed
Tracked by #8678

Formatter: wrap_long_dict_values_in_parens preview style #8897

MichaReiser opened this issue Nov 29, 2023 · 2 comments
Labels
formatter Related to the formatter preview Related to preview mode features

Comments

@MichaReiser
Copy link
Member

Implement Black's wrap_long_dict_values_in_parens style as a Ruff preview style.

Note:
This new style may not be accepted as part of Black's 2024 style guide.

my_dict = {
    "a key in my dict": a_very_long_variable * and_a_very_long_function_call() * and_another_long_func() / 100000.0
}

Ruff Stable

my_dict = {
    "a key in my dict": a_very_long_variable
    * and_a_very_long_function_call()
    * and_another_long_func()
    / 100000.0
}

Black Preview

my_dict = {
    "a key in my dict": (
        a_very_long_variable
        * and_a_very_long_function_call()
        * and_another_long_func()
        / 100000.0
    )
}

This new style does not apply to subscripts, although it probably should? But this is a non goal for now and tracked separately

@MichaReiser
Copy link
Member Author

MichaReiser commented Dec 22, 2023

We don't plan to implement this preview style as part of Ruff's 2024 style guide because we believe that improving the binary expression formatting solves the problem more holistically. See psf/black#4123 for the details

@MichaReiser MichaReiser removed this from the Formatter: Stable milestone Dec 22, 2023
@MichaReiser MichaReiser closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2024
@MichaReiser
Copy link
Member Author

This style did not ship as part of Black 24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter preview Related to preview mode features
Projects
None yet
Development

No branches or pull requests

1 participant