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: multiline_string_handling preview style #8896

Closed
Tracked by #8678
MichaReiser opened this issue Nov 29, 2023 · 0 comments · Fixed by #9243
Closed
Tracked by #8678

Formatter: multiline_string_handling preview style #8896

MichaReiser opened this issue Nov 29, 2023 · 0 comments · Fixed by #9243
Labels
formatter Related to the formatter preview Related to preview mode features

Comments

@MichaReiser
Copy link
Member

Implement Black's multiline_string_handling as a preview style.

Ruff already implements (as part of stable) the new style when calling functions on a multiline string:

MULTILINE = """
foobar
""".replace(
    "\n", ""
)

Get's formatted to

MULTILINE = """
foobar
""".replace("\n", "")

However, Ruff doesn't yet implement the new style when passing a multiline string in a function call:

textwrap.dedent(
    """\
    This is a
    multiline string
"""
)

Gets formatted to:

textwrap.dedent("""\
    This is a
    multiline string
""")

Note: It's not yet decided if this style will make it into Black's 2024 stable style

@MichaReiser MichaReiser added formatter Related to the formatter preview Related to preview mode features labels Nov 29, 2023
@MichaReiser MichaReiser added this to the Formatter: Stable milestone Nov 29, 2023
@MichaReiser MichaReiser changed the title Formatter: multiline_string_handling preview style. Ruff stable implements this partially, and we generally received positive feedback. Formatter: multiline_string_handling preview style Nov 29, 2023
@MichaReiser MichaReiser modified the milestone: Formatter: Stable Dec 21, 2023
@MichaReiser MichaReiser linked a pull request Dec 22, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant